Abstract:
Implementations of the present disclosure include methods, systems, and computer readable storage mediums for validating input parameters provided to an application, including executing the application using the one or more processors, collecting one or more validation aspects associated with the application to provide a set of validation aspects, receiving a first input parameter that is associated with a first validation point, extracting a first data type of the first input parameter, and determining that a validation aspect corresponding to the first data type is available in the set of validation aspects and, in response, applying a corresponding validation function to the first input parameter.

Description:
BACKGROUND 
       [0001]    Web site owners and web site users have a vested interest in protecting the security of web applications and web services provided to various users. However, many web applications and web services are prone to input validation vulnerabilities, which may result from inadequate or incorrect sanitation of user-supplied inputs to the web applications and web services. Inadequate or incorrect validation and/or sanitization of these inputs can arise from invalid input assumptions made by a developer for a particular application. Injection attacks, also known as code injection attacks, exploit input validation vulnerabilities by injecting inputs including special characters and/or markers that alter the behavior of a targeted application in some undesirable manner. Injection attacks include SQL injections, cross-site scripting (XSS), command shell injection, and other types of injection attacks. Such attacks have become prevalent across web applications and can have devastating consequences to the targeted web application, including information leakage and privilege escalation, in which an attacker may gain full control of a system under attack. 
       SUMMARY 
       [0002]    Implementations of the present disclosure include computer-implemented methods for validating input parameters provided to an application, the methods being performed using one or more processors and including the actions of executing the application using the one or more processors, collecting one or more validation aspects associated with the application to provide a set of validation aspects, receiving a first input parameter that is associated with a first validation point, extracting a first data type of the first input parameter, and determining that a validation aspect corresponding to the first data type is available in the set of validation aspects and, in response, applying a corresponding validation function to the first input parameter. 
         [0003]    In some implementations, actions further include determining that the first input parameter is valid based on applying the validation function, and in response to determining the first input parameter is valid, processing the first input parameter through the application. 
         [0004]    In some implementations, actions further include determining that the first input parameter is invalid based on applying the validation function, and in response to determining the first input parameter is invalid, prohibiting processing of the first input parameter through the application. 
         [0005]    In some implementations, actions further include displaying an error message to a user that provided the first input parameter. 
         [0006]    In some implementations, actions further include receiving a second input parameter that is associated with a second validation point, extracting a second data type of the second input parameter, and determining that a validation aspect corresponding to the second input parameter not available in the set of validation aspects and, in response, aborting execution of the application. 
         [0007]    In some implementations, the first data type is an enhanced data type. 
         [0008]    In some implementations, the application is a web application executed using one or more server computer devices. 
         [0009]    In some implementations, the first input parameter is received from a client computing device. 
         [0010]    In some implementations, actions further include identifying the one or more validation aspects based on annotations provided in source code of the application, each annotation corresponding to an input parameter and identifying a data type of the input parameter. 
         [0011]    In some implementations, actions further include generating computer program code using aspect-oriented programming based on annotations provided in source code of the application, and executing the computer program code to intercept execution flow of the application and to perform extracting the first data type and determining that the validation aspect corresponding to the first data type is available in the set of validation aspects. 
         [0012]    The present disclosure also provides a computer-readable storage medium coupled to one or more processors and having instructions stored thereon which, when executed by the one or more processors, cause the one or more processors to perform operations in accordance with implementations of the methods provided herein. 
         [0013]    The present disclosure further provides a system for implementing the methods provided herein. The system includes one or more processors, and a computer-readable storage medium coupled to the one or more processors having instructions stored thereon which, when executed by the one or more processors, cause the one or more processors to perform operations in accordance with implementations of the methods provided herein. 
         [0014]    It is appreciated that methods in accordance with the present disclosure can include any combination of the aspects and features described herein. That is, methods in accordance with the present disclosure are not limited to the combinations of aspects and features specifically described herein, but also include any combination of the aspects and features provided. 
         [0015]    The details of one or more implementations of the present disclosure are set forth in the accompanying drawings and the description below. Other features and advantages of the present disclosure will be apparent from the description and drawings, and from the claims. 
     
    
     
       DESCRIPTION OF DRAWINGS 
         [0016]      FIG. 1  depicts an example system that can be implemented in accordance with the present disclosure. 
           [0017]      FIG. 2  depicts an example system architecture that can be implemented in accordance with the present disclosure. 
           [0018]      FIG. 3  is a flowchart depicting an example process that can be executed in accordance with implementations of the present disclosure. 
           [0019]      FIG. 4  is a schematic illustration of example computer systems that can be used to execute implementations of the present disclosure. 
       
    
    
       [0020]    Like reference symbols in the various drawings indicate like elements. 
       DETAILED DESCRIPTION 
       [0021]    Implementations of the present disclosure are generally directed to validating inputs to targeted web applications. In some examples, preventing input validation vulnerabilities relies heavily on developers; thus, including prevention techniques within the design and implementation phases of software development can help in making web applications and web services more secure. In particular, implementations of the present disclosure are directed to input validation through assignment of semantic meaning to unstructured and/or untrusted inputs to an application and ensuring that these inputs conform to a set of well-defined input constraints. In accordance with implementations of the present disclosure, this is achieved through separation of input validation code from application code. Via this process, the assignment of data types to input can be enforced while maintaining consistency between input validation and application logic. Furthermore, Aspect-Oriented Programming (AOP) can be non-invasively used in the automatic generation of input validation code without altering the business logic of the targeted application. 
         [0022]    In accordance with AOP, an aspect can include a program feature that is linked to various parts of the program. In accordance with implementations of the present disclosure, an aspect can include an input to the program. In some implementations, an aspect can modify an input received by the program. In some implementations, an aspect can constrain an input to the program. In some examples, a pointcut can determine where or when an aspect should apply modifications to data affected by the program. A pointcut includes a set of join points, each join point being a point in the program where a piece of code associated with the pointcut (i.e., an advice) is executed. For example, a pointcut can determine where a point is located within the source code of an application or the events during which an application can be executed. In some implementations, pointcuts can further be expressed in pointcut languages. Pointcuts can include a large number of aspect-specific constructs that match specific structures of the language in which base applications are expressed, where the pattern language is based on language syntax. 
         [0023]    Advices can be used to define modifications that may be performed by an aspect on a base application. In some implementations, advices may be expressed in terms of some general purpose language with a small number of aspect-specific extensions. For example, the proceed construct can allow execution of the behavior of the base application that triggered the aspect application initially. 
         [0024]      FIG. 1  depicts an example system that can be implemented in accordance with the present disclosure. The system  100  can include a legitimate client computing device  102  and a malicious client computing device  104 . The client computing devices  102  and  104  can communicate with one or more of the computer systems  106  over a network  108 . The computer system  106  can communicate with the client computing devices  102  and  104  over the network  108 . The computer system  106  can include one or more servers  110  and one or more datastores  112 . In some implementations, the system  100  may represent a client/server system supporting multiple computer systems  106  including one or more clients (e.g., client computing devices  102  and  104 ) that are connectively coupled for communication with one another over the network  108 . 
         [0025]    The client computing devices  102  and  104  can represent various forms of processing devices including, but not limited to, a desktop computer, a laptop computer, a handheld computer, a personal digital assistant (PDA), a cellular telephone, a network appliance, a camera, a smart phone, an enhanced general packet radio service (EGPRS) mobile phone, a media player, a navigation device, an email device, a game console, or a combination of any two or more of these data processing devices or other data processing devices. The client computing devices  102  and  104  may access application software on one or more of the computer systems  106 . 
         [0026]    The computer system  106  can represent various forms of server systems including, but not limited to a web server, an application server, a proxy server, a network server, or a server farm. For example, one or more of the servers  110  can be an application server that executes software accessed by the client computing devices  102  and  104 . In some implementations, a user can invoke applications available on one or more of the servers  110  in a web browser running on a client (e.g., client computing device  102  and  104 ). Each application can individually access data from one or more repository resources (e.g., datastores  112 ). 
         [0027]    In some implementations, the client computing device  102  may communicate wirelessly through a communication interface (not shown), which may include digital signal processing circuitry where necessary. The communication interface may provide for communications under various modes or protocols, such as Global System for Mobile communication (GSM) voice calls, Short Message Service (SMS), Enhanced Messaging Service (EMS), or Multimedia Messaging Service (MMS) messaging, Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Personal Digital Cellular (PDC), Wideband Code Division Multiple Access (WCDMA), CDMA2000, or General Packet Radio System (GPRS), among others. For example, the communication may occur through a radio-frequency transceiver (not shown). In addition, short-range communication may occur, such Bluetooth, WiFi, or other such transceiver communications. 
         [0028]    The network  108  can be a large computer network, such as a local area network (LAN), wide area network (WAN), the Internet, a cellular network, or a combination thereof connecting any number of mobile clients, fixed clients, and/or servers. In some implementations, each client (e.g., client computing device  102 ) can communicate with one or more of the computer systems  106  via a virtual private network (VPN), Secure Shell (SSH) tunnel, or other secure network connection. In some implementations, the network  108  can include the Internet, a wireless service network and may include the Public Switched Telephone Network (PSTN). In other implementations, the network  108  may include a corporate network (e.g., an intranet) and one or more wireless access points. 
         [0029]    The client computing devices  102  and  104  can establish their own sessions with the computer system  106 . Each session can involve two-way information exchange between the computer system  106  and the client computing devices  102  and  104 . For example, a Hypertext Transfer Protocol (HTTP) session can allow the association of information with individual users. A session can be a stateful session, in which at least one of the communicating parts (e.g., the computer systems  106  or the client computing device  102  or  104 ) stores information about the session history in order to be able to communicate. Alternatively, stateless communication during a stateless session includes independent requests with associated responses. 
         [0030]    Each client computing device  102 ,  104  can provide input to a computer-executed application (e.g., a web application) executed on computer system  106 . In the depicted example, a user of the client computing device  102  can be a legitimate user that provides non-malicious input to the application. The user of the client computing device  104  can be a malicious user that attempts to provide malicious input to the application. As discussed in further detail herein, implementations of the present disclosure enable the input to the application to be intercepted and validated before the application is able to process the input. In some examples, if the input is validated, the application receives the input. In some examples, if the input is not validated, an error is triggered and the application does not receive the input. 
         [0031]    In accordance with the present disclosure, the source code underlying the application can be annotated. In particular, a developer can annotate the source code of the application. The annotations can each be associated with a point where input from an untrusted source is to be provided to the application. In some examples, annotations can provide a simple mechanism for non-invasively extending a programming language. Furthermore, annotations can designate input parameters and individually indicate their corresponding enhanced data types, discussed in further detail below. In some examples, a new executable or object code can be generated based on the annotated source code using AOP. The generated code can be executed to intercept the execution flow of the underlying program whenever an input is received. The input can be processed to determine whether the input conforms to a given pre-defined format. In some examples, an application reads a non-conforming input, and a programming exception can be raised. 
         [0032]    In some implementations, all input parameters in the code are by default annotated by the developer before the application executes. In some examples, the developers can partially annotate the code or disregard the annotation phase completely. In some implementations, parameters that are not annotated are not validated, which can provide less secure code. However, in some instances, non-annotated parameters can allow for flexible protection. In some instances, an alternative way of providing enhanced data type information can be provided. For example, automatic provisioning from various data sources can be used to gather information about an acceptable input for a program. Example data sources can include a database data model, a configuration file separated from the code, other information in the framework, and scanning at runtime for the detection of the correct type. 
         [0033]    Correct annotation of the input parameters within the application source code ensures correct verification of incoming data. In some examples, an incorrect validation mechanism can compromise the risk mitigation process. In order to correctly bind the parameters and variables of interest, the system can adopt a semi-automatic approach that combines user-based knowledge and automatic detection of data types (e.g., by using information gathered from model repositories, database schemas, etc.). 
         [0034]    In some implementations, the developer uses the annotations to define the enhanced data types (also called Global Data Types) that are used across the application. In some examples, enhanced data types include business semantics and provide more precision regarding the expected user inputs. Therefore, enhanced data types differ from basic built-in data types of the programming language used in the source code. Example enhanced data types can include a product ID, an e-mail address, phone numbers, and addresses. In some examples, abstract types can be added to provide a fine-grained, stronger typing related to variables and parameters used in the application. For example, in a declaration string such as String email, the developer could add the annotation @Email String email, indicating that only strings obeying a certain pattern of email addresses will be accepted. Thus, both the set of enhanced data types and their corresponding validation functionalities can be extensive. 
         [0035]    Referring now to  FIG. 2 , an example system architecture  200  for validating input parameters to an application will be discussed. The architecture  200  includes a source code module  202 , one or more data sources  204 , an input validation sub-system  206 , and an input validation module  208 . The input validation sub-system  206  includes a pointcut interface adaptor  210 , an aspect validation library module  212  and an aspect engine  214 . Components of the system architecture  200  can be provided as one or more computer program applications that are executed using one or more processors, and/or can be provided as computer-readable memory. 
         [0036]    The source code module  202  includes the annotated source code of a subject application and provides the annotated source code to the pointcut interface adaptor  210 . The one or more data sources  204  can include, for example, an enterprise service repository (ESR), a Global Data Types repository, database schema repositories, web service description language (WSDL) repositories, and/or other repositories. The pointcut interface adaptor  210  processes the annotated source code and identifies points in the application where input parameters are used. The pointcut interface adaptor  210  maintains a mapping between enhanced data types and validation functions. In some examples, the pointcut interface adaptor  210  can extract data type information from one or more of the data sources  204  to add meta-data information needed for input validation. The data sources  204  can provide information on the type structure used in the application parameters, such that the enhanced data types associated with the application parameters can be inferred. Other information can also be found within the data sources  204  including, for example, lengths required for data fields or enumerated values, which may be useful for improving accuracy of the input data validation. 
         [0037]    In some implementations, the aspect engine  214  can be provided as a traditional AOP aspect engine and can detect validation points during execution of the target application. In some examples, the aspect engine  214  can modify the data flow of the target application. For example, the aspect engine  214  can account for the types of annotations and insert data validation code wherever an assignment exists for an input parameter (i.e., a validation point). A validation point can refer to the validation of a specific parameter or variable from the target application. In some examples, a validation point can be inserted whenever data is read from an untrusted source or received from a final user. 
         [0038]    In some implementations, upon detection of a validation point, the aspect engine  214  can extract the data type of a parameter and search for an existing validation library. In some examples, a validation library is retrieved from the aspect validation library module  212 . If the aspect engine  206  finds such an appropriate validation library in the aspect validation library module  212 , the aspect engine  214  can apply one or more validation mechanisms. In some examples, validation mechanisms can use regular expressions. In some instances, validation mechanisms can check a value range for an input parameter. In some cases, validation mechanisms can perform cross-checking with database values. The aspect validation library module  212  can provide one or more libraries including validation functions for each enhanced data type. In some examples, the aspect validation library module  212  can map the enhanced data types stored in an ESR to respective validation functions that are provided as aspects. In some implementations, validation functions can have a standardized interface in order to provide compatibility, and the mapping configuration in the pointcut interface adaptor  210  can be updated accordingly. 
         [0039]    In some implementations, when a new specific data type is identified, an identifier name can be created for the data type. The name can be released among one or more application developers and stakeholders, such that the new available data type can be used to tag variables and parameters along the target application. In some examples, new names can have their corresponding validation aspects defined in the aspect validation library module  212  in parallel. In some examples, multiple validation aspects can be assigned to a single enhanced data type in the aspect validation library module  212 . The validation behaviour is represented by a code advice. In some examples, the behaviour for validating an enhanced data type can be provided in regular expressions. In many programming languages, the handling of regular expressions can be provided as a built-in functionality. In some examples, more sophisticated attack vectors can require advanced pattern matching, and therefore, the valid input can be specified through XML-Schema validation, for example. This can enable a more expressive class of languages (i.e., context-free languages) to be accepted as input. Once the advice code for a specific enhanced data type is created, the validation code can be encapsulated in an aspect and compiled. The binaries generated from this process can then be deployed in the aspect validation library module  212 . 
         [0040]    In some implementations, aspects may be inserted into a target application at run-time. In some examples, it is assumed that several aspects are present within the aspect validation library module  212 . In some examples, it is assumed that the application has accurate meta-information about the enhanced data types. Furthermore, the aspect engine  206  can be a specialized class loaded whose bootstraps target applications. 
         [0041]    In some implementations, the input validation module  208  receives an input parameter provided by a user of the application. The input validation module  208  can determine a data type of the input parameter, can determine whether a validation function corresponding to the input parameter is available, and can apply the validation function to the input parameter to validate the input parameter. If the input parameter is invalid, the input validation module  208  can issue an error message and inhibits processing of the input parameter through the application. If the input parameter is valid, the input validation module  208  can pass the input parameter to the application for processing. 
         [0042]      FIG. 3  is a flowchart depicting an example process  300  that can be executed in accordance with implementations of the present disclosure. Validation aspects are collected ( 302 ). In some implementations, the aspect engine can search for available aspects in the aspect validation library. As the application code is loaded, the aspect engine can gather the points in the code that will need input validation and collect the applicable validation aspects at those points. During execution of the application, a validation point is waited for ( 304 ). In some examples, the aspect engine waits for a validation point to arise. When a validation point is encountered an enhanced data type is extracted from the input parameter associated with the validation point ( 306 ). It can be determined whether a validation aspect exists (i.e., whether an annotation is found for an input parameter in the case where the aspect engine is set to enforce validation for all) ( 308 ). If no valid aspect exists, execution of the application is aborted ( 309 ). In some examples, the application engine can also abort the application execution if no validation aspect is found for a particular annotation. In some instances, if no valid aspect exists, then the aspect engine can raise one or more error exceptions. If a valid aspect does exist, the aspect engine can apply the validation function to the input parameter ( 310 ). It is determined whether the input parameter is valid ( 312 ). If the input parameter is valid, the application is able to process the input parameter. If the input parameter is not valid, the application is not able to process the input parameters and an error message is displayed ( 314 ) (e.g., to the user who provided the input parameter). If there are no further validation points, the example process  300  ends. 
         [0043]    Thus, implementations of the present disclosure include a number of advantages. In some examples, the non-invasive use of AOP can relieve developers from having to learn a new programming paradigm. In some examples, the program security can be increased with a high degree of automation with minimal effort. Furthermore, implementations of the present disclosure can relieve the developer from having to be familiar with program security. In some examples, the extensibility of the system can enable developers to create business-specific enhanced data types and corresponding validation aspects. New security functionality can further be integrated modularly without disrupting existing code. In some implementations, an administrator can disable the default requirement for annotation of all code. In some examples, implementations of the present disclosure can also be applied to an isolated application with a single user on a single client device, enabling the single user to benefit from the protections described herein. 
         [0044]    Referring now to  FIG. 4 , a schematic diagram of an example computing system  400  is provided. The system  400  can be used for the operations described in association with the implementations described herein. For example, the system  400  may be included in any or all of the server components discussed herein. The system  400  includes a processor  410 , a memory  420 , a storage device  430 , and an input/output device  440 . Each of the components  410 ,  420 ,  430 , and  440  are interconnected using a system bus  450 . The processor  410  is capable of processing instructions for execution within the system  400 . In one implementation, the processor  410  is a single-threaded processor. In another implementation, the processor  410  is a multi-threaded processor. The processor  410  is capable of processing instructions stored in the memory  420  or on the storage device  430  to display graphical information for a user interface on the input/output device  440 . 
         [0045]    The memory  420  stores information within the system  400 . In one implementation, the memory  420  is a computer-readable medium. In one implementation, the memory  420  is a volatile memory unit. In another implementation, the memory  420  is a non-volatile memory unit. The storage device  430  is capable of providing mass storage for the system  400 . In one implementation, the storage device  430  is a computer-readable medium. In various different implementations, the storage device  430  may be a floppy disk device, a hard disk device, an optical disk device, or a tape device. The input/output device  440  provides input/output operations for the system  400 . In one implementation, the input/output device  440  includes a keyboard and/or pointing device. In another implementation, the input/output device  440  includes a display unit for displaying graphical user interfaces. 
         [0046]    The features described can be implemented in digital electronic circuitry, or in computer hardware, firmware, software, or in combinations of them. The apparatus can be implemented in a computer program product tangibly embodied in an information carrier, e.g., in a machine-readable storage device, for execution by a programmable processor; and method steps can be performed by a programmable processor executing a program of instructions to perform functions of the described implementations by operating on input data and generating output. The described features can be implemented advantageously in one or more computer programs that are executable on a programmable system including at least one programmable processor coupled to receive data and instructions from, and to transmit data and instructions to, a data storage system, at least one input device, and at least one output device. A computer program is a set of instructions that can be used, directly or indirectly, in a computer to perform a certain activity or bring about a certain result. A computer program can be written in any form of programming language, including compiled or interpreted languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. 
         [0047]    Suitable processors for the execution of a program of instructions include, by way of example, both general and special purpose microprocessors, and the sole processor or one of multiple processors of any kind of computer. Generally, a processor will receive instructions and data from a read-only memory or a random access memory or both. The essential elements of a computer are a processor for executing instructions and one or more memories for storing instructions and data. Generally, a computer will also include, or be operatively coupled to communicate with, one or more mass storage devices for storing data files; such devices include magnetic disks, such as internal hard disks and removable disks; magneto-optical disks; and optical disks. Storage devices suitable for tangibly embodying computer program instructions and data include all forms of non-volatile memory, including by way of example semiconductor memory devices, such as EPROM, EEPROM, and flash memory devices; magnetic disks such as internal hard disks and removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks. The processor and the memory can be supplemented by, or incorporated in, ASICs (application-specific integrated circuits). 
         [0048]    To provide for interaction with a user, the features can be implemented on a computer having a display device such as a CRT (cathode ray tube) or LCD (liquid crystal display) monitor for displaying information to the user and a keyboard and a pointing device such as a mouse or a trackball by which the user can provide input to the computer. 
         [0049]    The features can be implemented in a computer system that includes a back-end component, such as a data server, or that includes a middleware component, such as an application server or an Internet server, or that includes a front-end component, such as a client computer having a graphical user interface or an Internet browser, or any combination of them. The components of the system can be connected by any form or medium of digital data communication such as a communication network. Examples of communication networks include, e.g., a LAN, a WAN, and the computers and networks forming the Internet. 
         [0050]    The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a network, such as the described one. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. 
         [0051]    In addition, the logic flows depicted in the figures do not require the particular order shown, or sequential order, to achieve desirable results. In addition, other steps may be provided, or steps may be eliminated, from the described flows, and other components may be added to, or removed from, the described systems. Accordingly, other implementations are within the scope of the following claims. 
         [0052]    A number of implementations of the present disclosure have been described. Nevertheless, it will be understood that various modifications may be made without departing from the spirit and scope of the present disclosure. Accordingly, other implementations are within the scope of the following claims.