Airlock WAF has a longstanding tradition of promoting dynamic whitelisting technologies, including URL encryption, the cookie store, smart HTML form protection, or ADAPS. The common goal behind these approaches is to infer implicit application APIs and to automatically enforce proper usage by clients, without the need for cumbersome manual WAF configuration.
With the shift towards less standardized technologies, such as JSON or REST, implicit APIs get rare. To overcome these limitations, Airlock WAF 6 offers a new feature called Dynamic Value Endorsement (DyVE). Using DyVE, it is possible to scan JSON objects delivered by back-ends and to dynamically endorse values of selected attributes within a session's scope. Parameters or JSON attributes of subsequent requests (e.g., REST API calls) can then be matched against previously endorsed values.
The feature is currently in prototype status. The functionality and configuration directives may change in future and are not update resistant.
DyVE can be enabled globally or per mapping on Airlock WAF. No changes on application side are necessary to protect the application. DyVE extracts a dynamic set of JSON parameter values from HTTP responses and stores hashes of these values in the local session store. Parameters reflected from the client back to the application which must not be modified by the user are identified using pre-defined rule set. If the value of a protected parameter is missing in the local session store the request is blocked. Request parameters are validated independently whether they are sent in a HTTP form POST (x-www-form-urlencoded or multipart), as HTTP query parameters or in a JSON structure.
In a cluster setup all DyVE session information is synched to the partner node to provide high availability in case of failure.
Consider the following balance transfer example in a online banking application:
In contrast to static black- or whitelisting DyVE does not only validate the syntax and format of a value but also the concrete value within the context of the current user session. This prevents any kind of injection attacks on protected parameters but also prevents business logic attacks.
If your application fulfills the following criteria it can be protected by DyVE.
The following configuration steps must be performed to configure DyVE.
DyVE is configured using Security Gate expert settings globally or per mapping context. In this example, DyVE is configured on a specific mapping (tab "Expert Settings").
The following SG expert settings enable DyVE on the request and response way respectively.
Response.DynamicValueEndorsement.Enable "TRUE"
Request.DynamicValueEndorsement.Enable "TRUE"
By default the JSON parser only considers responses with content-type header "application/json". If necessary, this can be changed with the following setting. Note that only valid and pure JSON responses can be handled by the JSON parser.
Response.Json.Parser.ContentType.Pattern "^application/json$"
The following rule collects all JSON parameters containing the word "account" in all JSON responses matching the path pattern "/invoice_data". These values are endorsed (dynamic whitelisted) by Airlock WAF and can be used by the client in protected request parameters.
Response.DynamicValueEndorsement.Rule.0.Path.Pattern "/invoice_data"
Response.DynamicValueEndorsement.Rule.0.Parameter.Name.Pattern "account"
Response.DynamicValueEndorsement.Rule.0.ValueSet 0
It is possible to collect and endorse all JSON values from all JSON responses for testing purposes by defining a wildcard pattern.
Response.DynamicValueEndorsement.Rule.0.Path.Pattern ".*"
Response.DynamicValueEndorsement.Rule.0.Parameter.Name.Pattern ".*"
Response.DynamicValueEndorsement.Rule.0.ValueSet 0
Note that the format of the JSON parameter names follow the Airlock WAF standard parameter syntax for JSON objects.
Example:
The values "Simon" and "Smith" in the following JSON structure can be referenced using the parameter names "#json#name#first" and "#json#name#last".
{ "name" : { "first": "Simon", "last" : "Smith" } }
A detailed description of the Airlock WAF parameter syntax for JSON objects can be found in the section "JSON Filtering" in the Airlock WAF online manual.
The following rule validates all parameters with a name matching the pattern "target_account_id" in all HTTP requests matching the path pattern "/transfer". If the protected parameter value is not found within the value store on Airlock WAF the request will be blocked.
Request.DynamicValueEndorsement.Rule.0.Path.Pattern "/transfer"
Request.DynamicValueEndorsement.Rule.0.Parameter.Name.Pattern "^target_account_id$"
Request.DynamicValueEndorsement.Rule.0.ValueSet 0
Multiple DyVE rules can be defined by incrementing the rule index (Rule.0, Rule.1, ..., Rule.<N>). The index must be ascending without gaps.
For each DyVe rule a value set is defined which defines where to store endorsed values and lookup values of protected parameters respectively. Multiple value sets can be useful to implement a more fine-grained policy. Assume you want to limit the allowed values for a drop down list to the precise set of values received in a certain JSON response. This can be done by defining a dedicated value set for the corresponding request and response rule.
Blocked requests due to a DyVE rule violation will cause a production log message of the following form.
m:WR-SG-BLOCK-125 c:Y th:BLOCK , parameter "account" with value "01-1234-4" is illegal according to dynamic value endorsementBy setting the log level to "Trace" a log messages for all extracted JSON values is logged.
m:WR-SG-RESP-130 c:Y Value "val9" added to value set 2 due to DyVE rule 2 matching path "/dyve_res/asis/dyve.asis" and parameter name "#json#obj3#arr3#2" on mapping:DynamicValueEndorsement with audit token "-"
The maximal size of all collected values per session can be restricted with the following expert setting (value in bytes)
SecurityGateway * DynamicValueEndorsementStoreSize "32768"
Each collected value (hash) occupies 4 bytes in the value store. If the maximal size is reached no further values are saved into the value store and a corresponding production log message is logged. Further requests may be blocked because the protected parameter value is is missing in the value store.
If the parameter naming scheme of your application can be modified, custom pre- or suffixes for parameters to be endorsed and protected by Airlock WAF can be used to reduce the size and complexity of the DyVE rule set. Further the rules must not be modified if the application changes. As a consequence responsibility for a correct policy definition is shifted to the application side.