Wednesday, March 25, 2015

Description of standard tables in joomla

Source : http://www.informit.com/articles/article.aspx?p=1728831&seqNum=9

Standard Joomla Tables

Table Name
Description
PHP Class
jos_assets
New table added for ACL in version 1.6. Includes a row for every component, Contains a row for every item that has ACL permissions. This includes a "Root Asset" for the global permissions, a row for every component, plus a row for every component category, and finally a row for every article. The "rules" column stores the group permissions in JSON format. This table is used whenever we check if a user is authorized to perform an action.
JTableAsset
jos_banners
Contains a row for every banner defined in the site.
none
jos_banner_clients
Contains a row for every banner client defined in the site.
none
jos_banner_tracks
Contains a row for every banner track defined in the site.
none
jos_categories
Contains a row for every category defined in the site. This includes article, banner, contact, newsfeed, and weblinks categories.
JTableCategory
jos_contact_details
Contains a row for every contact defined in the site.
none
jos_content
Contains a row for every article defined in the site.
JTableContent
jos_content_frontpage
Contains a row for every article assigned to the featured blog menu item.
none
jos_content_rating
Contains a row for every rated article in the site.
none
jos_core_log_searches
Contains a row for every search term logged by the site.
none
jos_extensions
Contains a row for every extension installed in the site. This includes component, library, module, plugin, template, language, and file extensions.
JTableExtension
jos_languages
Contains a row for every language installed in the site.
JTableLanguage
jos_menu
Contains a row for every front and back-end menu item defined for the site.
JTableMenu
jos_menu_types
Contains a row for every front-end menu defined for the site.
JTableMenuType
jos_messages
Contains a row for every private message sent in the site.
none
jos_messages_cfg
Contains a row for every back-end user who sets a configuration in the Components → Messaging → My Settings option.
none
jos_modules
Contains a row for every module defined in the system. A "client_id" column of "0" indicates it is a front end module, "1" indicates a back-end module.
JTableModule
jos_modules_menu
Mapping table to show which modules are assigned to which menu items. The "menuid" column indicates which menu items the module is assigned to, as follows: "0" means assigned to all menu items; positive integer means assigned to this one menu item; and negative integer means assigned to all menu items except for this menu item.
none
jos_newsfeeds
Contains a row for every newsfeed created in the site.
none
jos_redirect_links
Contains a row for every redirect created in the site.
none
jos_schemas
Contains a row for each extension that has made database changes during its installation, along with the latest installed version of the extension.
none
jos_session
Contains a row for every active session for the site.
JTableSession
jos_template_styles
Contains a row for every template style defined for the site.
none
jos_updates
Contains a row for every available package to be installed.
JTableUpdate
jos_update_categories
This table is used to categorize the updates. It is maintained automatically by Joomla.
none
jos_update_sites
List of update sites. This comes from the update XML file for each extension.
none
jos_update_sites_extensions
Mapping table that links jos_extensions with jos_updates. Contains a row for each combination of extension and update site where that extension can be updated.
none
jos_usergroups
Contains a row for every user group defined for the site.
JTableUsergroup
jos_users
Contains a row for every user defined for the site.
JTableUser
jos_user_profiles
Contains a row for every combination of user id and profile field. This table is used if you have the User – Profile plugin enabled.
none
jos_user_usergroup_map
Contains a row for every group that a user is a member of.
none
jos_viewlevels
Contains a row for every View Level defined in the site.
JTableViewlevel
jos_weblinks
Contains a row for every weblink defined in the site.
none
Figure 46: List of Joomla Database Tables

Friday, March 20, 2015

6 Steps for Starting a Business From Zero

Every great business started with drive and a passion. Even moguls like Richard Branson, Oprah, Bill Gates and Warren Buffett started at zero.
If you know my story, you know that after I was injured in professional football, my lifelong dream of playing came to an end. I spent a year and a half broke and sleeping on my sister’s couch trying to figure out what I was going to do with my life.
At that time my main passion was sports, and that was my focus for as long as I could remember. I wanted to have the flexibility to do what I love, and make a living that would set me up for the rest of my life. But I had no idea where to begin.
Through equal parts luck and persistence, that year I found a brilliant mentor. I interned with him for close to a year and he paid me about $500 a month. I poured myself into learning from him. I also did whatever I could to earn income on the side working event marketing gigs and other odd jobs.
As I put one foot in front of the other, I started seeing where my passion and skills intersected. I loved connecting people and adding value to their lives. I loved providing whatever service I could to them that would help solve a problem they had. As I pursued the things that interested me, I began to put together networking events. I started to form what would become my business and brand, ever evolving along the way.
It wasn’t as if I had a perfect plan mapped out. I combined my passions, strengths and vision to create the ideal business for me along the way. The most passionate entrepreneurs are driven by more than just money. They’re driven by living a fulfilled life.  
If you haven’t yet discovered your passion, I encourage you to do so. That’s part of the reason I started The School of Greatness Academy -- to help people pursue their passions. Think about what excited you as a kid, or the thing that when you do it you lose all sense of time and space, you are so lost in the moment. You will be happiest when you follow your passion. I love what Steve Jobs had to say about this:
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it.
Once you have figured out what you want to do, here are some important things to keep in mind while starting your business from zero:

1. Research your market.

Knowing what the competition knows won’t cut it. Go deep. Dive in to your market and study it like an expert.  
Search Google for keywords that are related to your industry. Don’t get discouraged if the market seems flooded. You can use this to your advantage. It means that it is working for those people and you can make it work for you. There is money there.

2. Set a tangible financial goal.

I set new goals every six months and always stretch my initial mark. Work backwards and figure out what you need to do each day to get to where you want to be. Set a goal that is a stretch for you and look at the steps you need to take every day to accomplish that goal.

3. When you create a website, make the content shareable.

It’s great to reference some the leaders in your space, but when you are developing your own brand, it’s important to create unique content on a single hub. A site that your readers and viewers can reference back to, for more of your incredible content. I lean on Derek Halpern who’s a pro at this.  

4. Build a list.

Email is best form of currency online and building an email list is one of the most important tools in building a business. As you develop your shareable site, begin building a list of emails of the people that visit your site. Then continue to provide them with value. This will translate into buyers for the future launch of your product or service.
Adding in an opt-in form on your website and having a place to store your emails are the first two steps to building your email list. Free resources like HelloBar.com and AppSumo.com allow you to collect email information on your website. To store email addresses, I recommend the program Aweber, which even offers a free 30-day trial.

5. Launch a product or service you can sell.

If you have a financial goal that you’ve set out for the next six months, then you have to sell something. Take the time to figure out the biggest challenges your audience is facing and build your relationship with them. Then create something that solves their problem. I know this is easier said than done, but it’s critical. Your leads come from your list, you convert them to customers, follow up and build a relationship.  

6.  Start NOW and improve as you go.

A lot of people waste time thinking about making things perfect before they launch their business. The logo, the website, the copy -- everything. This is a waste of time. Sell your product before you make it by offering a pre-order. Focus on getting sales and attracting leads. Successful companies launch all the time and they aren’t perfect.  
Think of Facebook and all the changes and improvements it has made. Start with a small product and always be improving.  Launch online you can sell over and over and not have to trade time for dollars.
The most important thing is to enjoy the process and know that you don’t have to make it perfect. Start today. If not now, when?

Comuter Graphics openGL

OpenGL tutorials
https://github.com/opentk/opentk

https://www.youtube.com/watch?v=2KEHrB82Z2M&spfreload=10%20Message%3A%20Unexpected%20end%20of%20input%20(url%3A%20http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2KEHrB82Z2M)
http://www.youtube.com/watch?v=xNGmQ6lO6NY

OpenTK tutorials for beginers

https://www.youtube.com/watch?v=IXxc9yNBpuo

http://neokabuto.blogspot.de/2013/02/opentk-tutorial-1-opening-windows-and.html
http://www.opentk.com/doc/graphics/graphicscontext

https://www.youtube.com/watch?v=idnyxboXNMI

Download DLL
http://originaldll.com/download/16502.dll

Dragging and rotating cube tutorial
http://svn.opentk.net/node/2871
Cocept: https://www3.ntu.edu.sg/home/ehchua/programming/opengl/CG_Examples.html

http://sjbaker.org/steve/omniv/projection_abuse.html
https://www.opengl.org/archives/resources/faq/technical/viewing.htm


Drawing polygon using triangulation.
http://polygontriangulation.codeplex.com/

http://www.codeproject.com/Articles/8499/Generating-Outlines-in-OpenGL

Tuesday, March 17, 2015

Access control mechanisms in a software application

Introduction

This article is focused on providing clear, simple, actionable guidance for providing Access Control security in your applications.

What is Access Control / Authorization?

Authorization is the process where requests to access a particular resource should be granted or denied. It should be noted that authorization is not equivalent to authentication - as these terms and their definitions are frequently confused.
Access Control is the method or mechanism of authorization to enforce that requests to a system resource or functionality should be granted.

Role Based Access Control (RBAC)

In Role-Based Access Control (RBAC), access decisions are based on an individual's roles and responsibilities within the organization or user base. The process of defining roles is usually based on analyzing the fundamental goals and structure of an organization and is usually linked to the security policy. For instance, in a medical organization, the different roles of users may include those such as doctor, nurse, attendant, nurse, patients, etc. Obviously, these members require different levels of access in order to perform their functions, but also the types of web transactions and their allowed context vary greatly depending on the security policy and any relevant regulations (HIPAA, Gramm-Leach-Bliley, etc.).
An RBAC access control framework should provide web application security administrators with the ability to determine who can perform what actions, when, from where, in what order, and in some cases under what relational circumstances.http://csrc.nist.gov/rbac/ provides some great resources for RBAC implementation. The following aspects exhibit RBAC attributes to an access control model.
  • Roles are assigned based on organizational structure with emphasis on the organizational security policy
  • Roles are assigned by the administrator based on relative relationships within the organization or user base. For instance, a manager would have certain authorized transactions over his employees. An administrator would have certain authorized transactions over his specific realm of duties (backup, account creation, etc.)
  • Each role is designated a profile that includes all authorized commands, transactions, and allowable information access.
  • Roles are granted permissions based on the principle of least privilege.
  • Roles are determined with a separation of duties in mind so that a developer Role should not overlap a QA tester Role.
  • Roles are activated statically and dynamically as appropriate to certain relational triggers (help desk queue, security alert, initiation of a new project, etc.)
  • Roles can be only be transferred or delegated using strict sign-offs and procedures.
  • Roles are managed centrally by a security administrator or project leader
OWASP has a role based access control implementation project, OWASP RBAC Project.

Discretionary Access Control (DAC)'

Discretionary Access Control (DAC) is a means of restricting access to information based on the identity of users and/or membership in certain groups. Access decisions are typically based on the authorizations granted to a user based on the credentials he presented at the time of authentication (user name, password, hardware/software token, etc.). In most typical DAC models, the owner of information or any resource is able to change its permissions at his discretion (thus the name). DAC has the drawback of the administrators not being able to centrally manage these permissions on files/information stored on the web server. A DAC access control model often exhibits one or more of the following attributes.
  • Data Owners can transfer ownership of information to other users
  • Data Owners can determine the type of access given to other users (read, write, copy, etc.)
  • Repetitive authorization failures to access the same resource or object generates an alarm and/or restricts the user's access
  • Special add-on or plug-in software required to apply to an HTTP client to prevent indiscriminate copying by users ("cutting and pasting" of information)
  • Users who do not have access to information should not be able to determine its characteristics (file size, file name, directory path, etc.)
  • Access to information is determined based on authorizations to access control lists based on user identifier and group membership.

Mandatory Access Control (MAC)

Mandatory Access Control (MAC) ensures that the enforcement of organizational security policy does not rely on voluntary web application user compliance. MAC secures information by assigning sensitivity labels on information and comparing this to the level of sensitivity a user is operating at. In general, MAC access control mechanisms are more secure than DAC yet have trade offs in performance and convenience to users. MAC mechanisms assign a security level to all information, assign a security clearance to each user, and ensure that all users only have access to that data for which they have a clearance. MAC is usually appropriate for extremely secure systems including multilevel secure military applications or mission critical data applications. A MAC access control model often exhibits one or more of the following attributes.
  • Only administrators, not data owners, make changes to a resource's security label.
  • All data is assigned security level that reflects its relative sensitivity, confidentiality, and protection value.
  • All users can read from a lower classification than the one they are granted (A "secret" user can read an unclassified document).
  • All users can write to a higher classification (A "secret" user can post information to a Top Secret resource).
  • All users are given read/write access to objects only of the same classification (a "secret" user can only read/write to a secret document).
  • Access is authorized or restricted to objects based on the time of day depending on the labeling on the resource and the user's credentials (driven by policy).
  • Access is authorized or restricted to objects based on the security characteristics of the HTTP client (e.g. SSL bit length, version information, originating IP address or domain, etc.)

Attribute Based Access Control (ABAC)

Attacks on Access Control

Vertical Access Control Attacks - A standard user accessing administration functionality
Horizontal Access Control attacks - Same role, but accessing another user's private data
Business Logic Access Control Attacks - Abuse of one or more linked activities that collectively realize a business objective

Access Control Issues

  • Many applications used the "All or Nothing" approach - Once authenticated, all users have equal privileges
  • Authorization Logic often relies on Security by Obscurity (STO) by assuming:
    • Users will not find unlinked or hidden paths or functionality
    • Users will not find and tamper with "obscured" client side parameters (i.e. "hidden" form fields, cookies, etc.)
  • Applications with multiple permission levels/roles often increases the possibility of conflicting permission sets resulting in unanticipated privileges
  • Many administrative interfaces require only a password for authentication
  • Shared accounts combined with a lack of auditing and logging make it extremely difficult to differentiate between malicious and honest administrators
  • Administrative interfaces are often not designed as “secure” as user-level interfaces given the assumption that administrators are trusted users
  • Authorization/Access Control relies on client-side information (e.g., hidden fields)
  • Web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts
  • Some web applications access the database via sa or other administrative account (or more privileges than required)
  • Some applications implement authorization controls by including a file or web control or code snippet on every page in the application
    <input type="text" name="fname" value="Derek">
    <input type="text" name="lname" value="Jeter">
    <input type="hidden" name="usertype" value="admin">

Access Control Anti-Patterns

  • Hard-coded role checks in application code
  • Lack of centralized access control logic
  • Untrusted data driving access control decisions
  • Access control that is "open by default"
  • Lack of addressing horizontal access control in a standardized way (if at all)
  • Access control logic that needs to be manually added to every endpoint in code
  • non-anonymous entry point DO NOT have an access control check
  • No authorization check at or near the beginning of code implementing sensitive activities

Hard Coded Roles

 if (user.isManager() ||
     user.isAdministrator() ||
     user.isEditor() ||
     user.isUser()) {
     //execute action
 }
Hard Codes Roles can create several issues including:
  • Making the policy of an application difficult to "prove" for audit or Q/A purposes
  • Causing new code to be pushed each time an access control policy needs to be changed.
  • They are fragile and easy to make mistakes

Order Specific Operations

Imagine the following parameters
 http://example.com/buy?action=chooseDataPackage
 http://example.com/buy?action=customizePackage
 http://example.com/buy?action=makePayment
 http://example.com/buy?action=downloadData
Can an attacker control the sequence?
Can an attacker abuse this with concurrency?

Never Depend on Untrusted Data

  • Never trust user data for access control decisions
  • Never make access control decisions in JavaScript
  • Never depend on the order of values sent from the client
  • Never make authorization decisions based solely on
    • hidden fields
    • cookie values
    • form parameters
    • URL parameters
    • anything else from the request

Attacking Access Controls

  • Elevation of privileges
  • Disclosure of confidential data - Compromising admin-level accounts often result in access to a user's confidential data
  • Data tampering - Privilege levels do not distinguish users who can only view data and users permitted to modify data

Testing for Broken Access Control

  • Attempt to access administrative components or functions as an anonymous or regular user
    • Scour HTML source for “interesting” hidden form fields
    • Test web accessible directory structure for names like admin, administrator, manager, etc (i.e. attempt to directly browse to “restricted” areas)
  • Determine how administrators are authenticated. Ensure that adequate authentication is used and enforced
  • For each user role, ensure that only the appropriate pages or components are accessible for that role.
  • Login as a low-level user, browse history for a higher level user’s cache, load the page to see if the original authorization is passed to a previous session.
  • If able to compromise administrator-level account, test for all other common web application vulnerabilities (poor input validation, privileged database access, etc)

Defenses Against Access Control Attacks

  • Implement role based access control to assign permissions to application users for vertical access control requirements
  • Implement data-contextual access control to assign permissions to application users in the context of specific data items for horizontal access control requirements
  • Avoid assigning permissions on a per-user basis
  • Perform consistent authorization checking routines on all application pages
  • Where applicable, apply DENY privileges last, issue ALLOW privileges on a case-by-case basis
  • Where possible restrict administrator access to machines located on the local area network (i.e. it’s best to avoid remote administrator access from public facing access points)
  • Log all failed access authorization requests to a secure location for review by administrators
  • Perform reviews of failed login attempts on a periodic basis
  • Utilize the strengths and functionality provided by the SSO solution you chose
Java
if ( authenticated ) {

 request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;

}

.NET (C#)
if ( authenticated ) {

 Session[“AUTHLEVEL”] = X_USER;

}


PHP
if ( authenticated ) {

 $_SESSION[‘authlevel’] = X_USER;  // X_USER is defined elsewhere as meaning, the user is authorized

}

Best Practices

Best Practice: Code to the Activity

  if (AC.hasAccess(ARTICLE_EDIT)) {
      //execute activity
  }
  • Code it once, never needs to change again
  • Implies policy is persisted/centralized in some way
  • Avoid assigning permissions on a per-user basis
  • Requires more design/work up front to get right

Best Practice: Centralized ACL Controller

  • Define a centralized access controller
     ACLService.isAuthorized(ACTION_CONSTANT)
     ACLService.assertAuthorized(ACTION_CONSTANT)
  • Access control decisions go through these simple API’s
  • Centralized logic to drive policy behavior and persistence
  • May contain data-driven access control policy information
  • Policy language needs to support ability to express both access rights and prohibitions

Best Practice: Using a Centralized Access Controller

  • In Presentation Layer
      if (isAuthorized(VIEW_LOG_PANEL))
      {
         Here are the logs
         <%=getLogs();%/>
      }
  • In Controller
      try (assertAuthorized(DELETE_USER))
      {
         deleteUser();
      }

Best Practice: Verifying policy server-side

  • Keep user identity verification in session
  • Load entitlements server side from trusted sources
  • Force authorization checks on ALL requests
    • JS file, image, AJAX and FLASH requests as well!
    • Force this check using a filter if possible

SQL Integrated Access Control

Example Feature
   http://mail.example.com/viewMessage?msgid=2356342
This SQL would be vulnerable to tampering
 select * from messages where messageid = 2356342
Ensure the owner is referenced in the query!
 select * from messages where messageid = 2356342 AND messages.message_owner = 

Access Control Positive Patterns

  • Code to the activity, not the role
  • Centralize access control logic
  • Design access control as a filter
  • Deny by default, fail securely
  • Build centralized access control mechanism
  • Apply same core logic to presentation and server-side access control decisions
  • Determine access control through Server-side trusted data

Data Contextual Access Control

Data Contextual / Horizontal Access Control API examples
   ACLService.isAuthorized(EDIT_ORG, 142)
   ACLService.assertAuthorized(VIEW_ORG, 900)
Long Form
   isAuthorized(user, EDIT_ORG, Organization.class, 14)
  • Essentially checking if the user has the right role in the context of a specific object
  • Centralize access control logic
  • Protecting data at the lowest level!

Authors and Primary Editors

Jim Manico - jim [at] owasp dot org
Fred Donovan - fred.donovan [at] owasp dot org
Mennouchi Islam Azeddine - azeddine.mennouchi [at] owasp.org

Other Cheatsheets

OWASP Cheat Sheets Project Homepage
Developer Cheat Sheets (Builder)
Assessment Cheat Sheets (Breaker)
Mobile Cheat Sheets
OpSec Cheat Sheets (Defender)
Draft Cheat Sheets

Saturday, March 7, 2015

Convert html , css template to wordpress

Basic file layout for blog

  1.  insid wordpress>> wp-content >> themes >>our project >> index.php -> when post page is set from settings >> Reading >> Front page displays , it executes index.php where we should set up layout of the page like 

     - <?php get_header('blog'); ?>  :- it will look for header-blog.php file executes content in it.

    -  <?php get_template_part('loop'); ?> :- it will look for loop.php file and executes content in it.It should contain the code for displaying all the posts

    -  <?php get_footer(); ?> :- it will look for footer.php file executes content in it.

   -  single.php :- it should contain the code for displaying one blog post with comments_template(); this       comment template will look for comments.php which should contain the code for displaying all the    comments for one post. 


- code snipped for including thumbnail image in php file
<?php if ( has_post_thumbnail()) : // Check if Thumbnail exists ?>
                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                                                                         <?php the_post_thumbnail();  ?>
                 </a>
 <?php endif; ?>
- we can set thumbnail image  for posts from wordpress admin panel , by using Set Featured Image on edit post option on bottom left side.


Learning wordpress from scratch:
https://www.youtube.com/watch?v=GHTZn3atTcM

https://www.youtube.com/watch?v=sd0grLQ4voU

Customize color picker:

http://buildwpyourself.com/building-theme-color-options-customizer/

https://www.youtube.com/watch?v=8OBfr46Y0cQ

https://www.youtube.com/watch?v=dwxIdLSK22o

http://themefoundation.com/wordpress-theme-customizer/

Embedding twitter in wordpress
https://www.youtube.com/watch?v=MB70_RTCZOU

How to develop wordpress plugin
https://www.youtube.com/watch?v=GAwPa4fP90c

Embeding custom code using shortcode in page or post
http://codex.wordpress.org/Shortcode_API


Embedding widgets in wordpress
https://www.tipsandtricks-hq.com/how-to-add-widgets-to-wordpress-themes-footer-1033

Wordress error: can connect to database server but cannot select the database in localhost:
Solution : Navigate to WordpressProject >> wp_config.php and change the single quote of database name, user name.

Hosting wordpress website using openshift
https://developers.openshift.com/en/php-wordpress.html


Ninja forms plugin
http://wpninjas.com/add-custom-css-to-your-ninja-forms/

https://www.youtube.com/watch?v=mA9ITyh8uRg

https://www.youtube.com/watch?v=mA9ITyh8uRg

How to add twitter feed widget to your wordpress blog.
https://www.youtube.com/watch?v=76lxy9xCA2c

How to develop wordpress plugin from scratch
https://www.youtube.com/watch?v=PCVk1hzjJ4c&index=2&list=PLQM9yk66qO4HdE3EcSNpVAQaTKxf2NXSo


Truncate post content while displaying list of posts
https://wordpress.org/support/topic/truncating-the-content-output
Instead of using the_content(); use following
<?php the_excerpt();
<p><a href="<?php the_permalink();?>"><?php _e('read more &hellip;');</a></p>

// Custom excerpt length , edit functions.php
function my_excerpt_length($length) {
 return 100; // Or whatever you want the length to be.
}
add_filter('excerpt_length', 'my_excerpt_length');


How to add video thumbnail in posts?
use plugin featured video plus plugin 
https://www.youtube.com/watch?v=2wuP723zCdE

How to add customer login feature in wordpress website?
list of plugins for adding customer login feature
http://wpdevshed.com/members-only-on-your-wordpress-website/

http://premium.wpmudev.org/blog/20-wordpress-plugins-for-improved-user-login-and-registration/