Most Common Web Application Security Vulnerabilities #1: Injection flaws

Injection flaws are a highly popular technique among security weakness that permits a client to break the web applications logic and the context. In the event that your web application takes input from the user and inserts that input into a back-end database, operating system call or shell command, the application might be vulnerable to an injection flaw. The issue is that the attacker can inject commands to these elements resulting in loss of data or hijacking clients browsers.

An attacker could exploit this by breaking out of the intended configurations and attaches extra and often unintended functionality. By permitting injection flaws in your application you are permitting an attacker to insert, delete, update or view any self-assertive information available within the application.

  • SQL InjectionRefers to a client side injection attack where an attacker tricking the application into sending unexpected SQL commands which control the web application’s database server.
  • LDAP Injection The attacker injects Lightweight Directory Access Protocol code sample to execute arbitrary LDAP commands. As a result of that it is possible to gain sensitive information or permissions from the LDAP directory.
  • OS Command Injection — Execute arbitrary commands on a host operating system using the privileges of a user in the vulnerable web application. Through that the attacker may exploit additional privilege escalation vulnerabilities, which may lead to full system compromise.
  • XML Injection Manipulate or compromise the logic of an XML application or service.
  • HTML or XSS InjectionThe attacker injects an arbitrary script (usually in JavaScript) into a legitimate website or web application. This script is then executed inside the victim’s browser.

The most ideal approach to decide whether the application is vulnerable to injection flaws is, the source code of your application. In the event that the source code permits external resources to link to backend data, at that point it is conceivable that you are or will possibly be enduring an attack. External resources including system call, fork, SQL queries, using exec, runtime. exec or any other syntax that can request interpreters to deal with input data. With various languages using various ways to execute external commands, developers are required to take into close consideration on exploring and reviewing their source codes. and also, it is important to look for HTTP requests being invoked by input data to make a malicious action.

The possible consequences of this injection attacks can be a data loss, unintentional expose of confidential data, denial of services (DOS), and unauthorized control of the system by the culprit.

  • Validation- Verify whether or not the type of input submitted by a user is allowed.
  • Filtering- Block or Removes some characters that are often used in injection attacks.
  • Sanitizing or encoding- Removing characters or replacing special characters with a different representation.
  • Escaping- Stripping out unwanted data, like malformed HTML or script tags.
  • Parameterization- Precompiling a statement as such you only need to supply are the “parameters”

Basically, anything that your application gets from untrusted sources must be filtered, preferably as per a whitelist. You should almost never use a blacklist, as getting that privilege is extremely hard and generally easy to sidestep. Antivirus products commonly provide stellar instances of failing blacklists where the Pattern matching does not work.

So as that the protecting against injection is simply a matter of filtering the client input appropriately and ensuring about whether a user input can be trusted… Yet, the awful fact is, that each and every input requires to be appropriately filtered except if it can be trusted unquestionably.

Since filtering is quite difficult to do, what generally recommends to do is depend on your framework’s filtering functions, as they are proven to work and are thoroughly scrutinized. In the event that you don’t utilize frameworks, you truly need to think about whether not utilizing them makes any sense when it comes to the security context which is 99% of the time it does not!

Application Security Engineer at 99x | OWASP Community Volunteer | Interested in Challenges which pushes to think outside the box.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store