# HDIV

HDIV is a Web Application Security Framework that controls the information flow between the server and the client avoiding many of the most important web risks. HDIV extends web applications behaviour by adding security functionalities while maintaining the API and the framework specification. This implies that HDIV may be used in applications developed in Spring MVC, Grails, JSTL, Struts 1, Struts 2, JavaServer Faces, Symfony in a transparent way to the programmer and without adding any complexity to the application development.

## OWASP Top 10

* A1 (Injection): Injection flaws, such as SQL Injection occur when malicious data is sent to an interpreter as part of a command or query. The attacker's malicious data tricks the interpreter into executing unintended commands and may be used to create, modify, access and delete data without proper authorization. Hdiv minimizes the existence of these vulnerabilities thanks to the web information flow control system that avoids injection vulnerabilities. This architecture minimizes the risk to just the new data generated legally from editable form elements. It is important to note that even if using prepared statements, as long as the query is based on untrusted data generated previously at the server side (for instance the identification ID of an item within a list) it is possible to exploit an SQL injection risk. Hdiv also implements an internal system that detects SQL Injection risks within source-code.
* A2 (Broken authentication and session management): Application functions related to authentication and session management are often not implemented correctly. This allows attackers to compromise passwords, keys, and session tokens, or to exploit other implementation flaws and assume other users' identities. HDIV does not create a parallel authentication system delegating this responsibility to application servers.
* A3 (XSS): XSS flaws occur whenever an application takes untrusted data and sends it to a web browser without proper validation or escaping. XSS allows attackers to execute scripts in the victim's browser which can hijack user sessions, deface websites, or redirect the user to malicious sites. Hdiv minimizes the existence of untrusted data thanks to the web information flow control system implemented by Hdiv, minimizing the risk to the new data generated legally from editable form elements. In addition to that Hdiv implements an internal system that detects XSS risks within source-code.
* A4 (Insecure direct object reference): A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, or database key. Without an access control check or other protection, attackers can manipulate these references to access unauthorized data. The source of the problem of this risk is based on the manipulation or updating of the data generated previously on the server side. For instance, a list is sent to the client with an ID for each item. The client manipulated the ID and tried to access a forbidden id. Hdiv web information flow control system control all the data generated at the server side ensuring the integrity of the data generated at serve side. In addition to that and optionally is possible to ensure the confidentiality of the data generated at the server side avoiding the exposition of critical (such as credit cards, etc.).
* A5 (security misconfiguration): Good security requires having a secure configuration defined and deployed for the application, frameworks, application server, web server, database server, and platform. Secure settings should be defined, implemented, and maintained, as defaults are often insecure. Additionally, software should be kept up to date. Current application security architectures do not follow security by default approach, on the contrary, the programmers must apply security configuration to avoid access to private or confidential resources. Thanks to the information flow control system implemented by Hdiv all the resources (links and forms) exposed by the application are controlled by Hdiv and don't allow breaking the original contract offered by the server. In other words, even when the programmer doesn't use access control systems or ACL (Java EE or Spring Security) Hdiv is able to know which resource is accessible by each user.
* A6 (Sensitive data exposure): Many web applications do not properly protect sensitive data, such as credit cards, tax IDs, and authentication credentials. Attackers may steal or modify such weakly protected data to conduct credit card fraud, identity theft, or other crimes. Sensitive data deserves extra protection such as encryption at rest or in transit, as well as special precautions when exchanged with the browser. Hdiv offers a confidential property to all data generated at the server side. That is to say, Hdiv replaces original parameter values generated at the server side by relative values (0,1,2,4, etc.) that avoid exposing critical data to the client side.
* A7 (Missing function level access control): Most web applications verify function level access rights before making that functionality visible in the UI. However, applications need to perform the same access control checks on the server when each function is accessed. If requests are not verified, attackers will be able to forge requests in order to access functionality without proper authorization. Current application security architectures don't follow security by default approach, on the contrary, the programmers must apply security controls to avoid access to private or confidential resources. Thanks to the information flow control system implemented by Hdiv all the resources (links and forms) exposed by the application are controlled by Hdiv and do not allow breaking the original contract offered by the server. In other words, even when the programmer doesn't use access control systems or ACL (Java EE or Spring Security) Hdiv is able to know which resource is accessible by each user.
* A8 (CSRF): A CSRF attack forces a logged-on victim's browser to send a forged HTTP request, including the victim's session cookie and any other automatically included authentication information, to a vulnerable web application. This allows the attacker to force the victim's browser to generate requests the vulnerable application thinks are legitimate requests from the victim. Hdiv adds random tokens to each link or form existing within the application. It makes it extremely difficult to implement a CSRF attack because the attacker does not know which is the value. In order to offer an extreme security level, Hdiv does not use a random token per session and creates a new token for each requested page. Even the token used by links and forms within the same page are different avoiding the reuse of link tokens to exploit a web form. One token is created for data retrieval requests (GET, HEAD, TRACE and OPTIONS HTTP methods) and another for data modification (POST, PATCH, PUT and DELETE methods).
* A9 (using components with known vulnerabilities): Components, such as libraries, frameworks, and other software modules, almost always run with full privileges. If a vulnerable component is exploited, such an attack can facilitate serious data loss or server takeover. Applications using components with known vulnerabilities may undermine application defenses and enable a range of possible attacks and impacts. Although Hdiv can't update the base software of web applications and is advisable to update the software versions to the latest, the web information flow control system implemented by Hdiv avoid and makes more difficult to exploit many or known and unknown of the vulnerabilities of base software. In other words, in many cases (see: Struts cancel vulnerability), the risks are based on an unexpected use of a web application. Hdiv doesn't allow breaking the original contract and thanks to this property it is more difficult to exploit existing risks.
* A10 (Invalidated redirects and forwards): Web applications frequently redirect and forward users to other pages and websites, and use untrusted data to determine the destination pages. Without proper validation, attackers can redirect victims to phishing or malware sites, or use forwards to access unauthorized pages. This vulnerability is mainly related to the manipulation of read-only data or data generated previously on the server side. Hdiv controls all the data server by the server and does not allow the redirection to malicious websites.