This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "OWASP Secure Application Design Project"
From OWASP
(→Main) |
Ashish Rao (talk | contribs) (→Design Flaws - Web) |
||
Line 156: | Line 156: | ||
=Design Flaws - Web= | =Design Flaws - Web= | ||
− | This section describes some of the important design flaws | + | This section describes some of the important design flaws are lesser known facts and can inadvertently leave a leave a backdoor in the application. We will understand the security flaws that can creep in while developing MVC applications. |
− | == | + | |
+ | A design of an application determines how different classes and files interact with each other to serve any user request. It is a structure that determines execution flow in the application. Most of the application designs are based on a concept of MVC. | ||
+ | |||
+ | The design and the architecture of the application must be understood thoroughly to analyze vulnerable areas that can lead to security breaches in the application. The key areas of the design that must be considered during threat analysis are given below. | ||
+ | • Data Flow/Code Layout | ||
+ | • Placement of security controls | ||
+ | • Entry points of non-user inputs | ||
+ | • Integrations with external services | ||
+ | • Location of configurations file and data sources | ||
+ | • Add-ons and customization present (in case of built-in design framework) | ||
+ | |||
+ | This will help in identifying the trust boundaries for an application and thus aid in taking decisions about the vulnerabilities and their risk levels posed to the application. | ||
+ | |||
+ | ==Business Logic Invocation Technique== | ||
+ | |||
+ | ''Introduction'' | ||
+ | |||
+ | In most of the design techniques the request parameters or the URL’s serve as sole factors to determine the processing logic. In such a scenario the elements in the request which are used for such identifications may be subject to manipulation attacks to obtain access to restricted resources or pages in the application. | ||
+ | |||
+ | Consider a design below; here the business logic class is identified based on a configuration file that keeps the mapping of the request URL and the business logic class i.e. action class. | ||
+ | <img1> | ||
+ | |||
+ | ''What is the flaw?'' | ||
+ | |||
+ | A flaw in such a design could be that unused configurations may be present in the configuration file that can be accessed by an attacker. Such configurations that are not exposed as valid features in the application and could serve as a potential backdoor to it. | ||
+ | An unused configuration present in the configuration file of the application is shown below: | ||
+ | |||
+ | Observe that the “TestAction” has an insecure logic to delete records from the system. This can act as a potential backdoor to the application. | ||
+ | |||
+ | ''Consider another scenario - Method Invocation'' | ||
+ | In the some designs request parameters are used to identify business logic methods. In the figure shown below a request parameter named “event” is used to identify and invoke the corresponding event handling methods of the business logic/action class. | ||
+ | |||
+ | ''What is the flaw?'' | ||
+ | Here, the user can attempt to invoke the methods of the events that are not visible to the user. | ||
+ | |||
+ | The applications must ensure to: | ||
+ | • Remove ALL redundant/test/unexposed business logic configurations from the file | ||
+ | • Apply necessary authorization check before processing business logic method | ||
+ | • Maintain a mapping of method/class/view names with the privilege level of the users, wherever applicable and restrict access of the users to restricted URLs/methods/views. | ||
+ | |||
+ | ''Review Criteria'' | ||
+ | |||
+ | With a view of the above mentioned factors we must carefully evaluate the design of any application to determine whether user inputs are directly (i.e. without any restriction) used to determine any of the following elements (as applicable): | ||
+ | |||
+ | • Business logic class | ||
+ | • Method names | ||
+ | • View component | ||
+ | |||
+ | In such case identify unexposed configurations and business logic methods as per the user privileges (wherever applicable) and attempt to access them. | ||
+ | |||
+ | |||
+ | In the some designs request parameters are used to identify business logic methods. In the figure shown below a request parameter named “event” is used to identify and invoke the corresponding event handling methods of the business logic/action class. | ||
+ | |||
+ | ==Model Object Binding Technique== | ||
'''Introduction''' | '''Introduction''' | ||
− | Another popular feature seen in most of the design frameworks today is | + | Another popular feature seen in most of the design frameworks today is binding of model objects with user inputs. Here the request parameters get directly bound to the variables of the corresponding business/command object. Binding here means that the instance variables of such classes get automatically initialized with the request parameter values based on their names. |
Consider a sample design given below; observe that the business logic class binds the business object with the request parameters. | Consider a sample design given below; observe that the business logic class binds the business object with the request parameters. | ||
Line 234: | Line 287: | ||
Check if there is an appropriate logic to terminate the execution flow is present in case of an error condition. Check for similar instances of insecure security controls built using “sendRedirect” method. | Check if there is an appropriate logic to terminate the execution flow is present in case of an error condition. Check for similar instances of insecure security controls built using “sendRedirect” method. | ||
− | + | ==Backdoor Parameters/ Business Logic Decision based on User input== | |
− | + | ||
− | + | During testing it is crucial to identify the key parameters related to business logic and understand how application handles them. This section will focus on insecure business logic decisions that are based on such parameters. There are 3 such cases listed below: | |
+ | |||
+ | ''CASE 1:'' The application must not depend on non-editable controls, drop-down menus or hidden fields for business logic processing. It is a secure practice to use the business logic parameters like price, max limit etc. from the server side. Even if the application sends these parameters as non-editable, select or hidden parameters it must maintain a separate copy of such values at the server side and use the same for business logic processing. | ||
+ | The users can easily alter such parameter values and try to manipulate business logic. | ||
+ | |||
+ | ''CASE 2:'' At times applications tend to make logical decisions merely on the basis of the values of certain request parameters. Such parameters are often the once indicating the type of the user, nature of the request, status of the transaction, etc. The application must not expose such parameters to the users. Even if they are exposed, the application must not rely on request parameters for logical decisions and analyse the same from server side processing. | ||
+ | The users can easily manipulate such parameter values and try to evade business logic validations or elevate privileges in the application. | ||
+ | |||
+ | ''CASE 3:'' Some application developers believe in the concept of – “what is hidden is secure”. They decide on the visibility of the some input fields for the features based on the role/privilege level of the logged-in user. This is especially observed in ASP.NET applications where there is provision to make the server side controls hidden/invisible for certain users. However, in most cases it has been observed that if the users add the parameters corresponding to the UI elements that are kept hidden/invisible to them into the request, they are able to change the behaviour of the server side logic. | ||
+ | Consider a scenario where only admin user can change password of other users of the system, as a result the field to enter username is only made visible to the admin user. However, if a normal a user tries to add username parameter in the request he/she will be able to trick the server in believing that the request has come from an admin user and try to change password of other users. Thus there exists a loophole in such applications where the server side behaviour can be influenced with request parameters. Users can perform unauthorized operations in the application by supplying the values for the inputs fields that are hidden from them. | ||
=FAQs= | =FAQs= |
Revision as of 18:02, 9 June 2015