Ajin Abraham

Security Engineer, IMMUNIO

Ajin Abraham

Talk Title

Injecting Security into Web apps with Runtime Patching and Context Learning


Web Application Security is not hard, but it’s easy to get it wrong as writing secure code is not easy as preaching. So to overcome incidents happening from such unforeseen events, organisations tend to rely on Web Application Firewalls or WAFs. Web Application Firewalls have been in the industry for a long time. Every one of them either work outside or around the web applications and act by intercepting the HTTP request coming to the web server, then take a decision to allow or block the request based on traditional signature checks. They are never aware of what is happening inside the application like how the user input is getting interpreted, Is the application/server under heavy load?, Is the attacker exfiltrating data by exploiting an SQLi that WAF couldn’t detect? etc. The strength of traditional WAF depends on manual or predefined rules/signature. As a result, they have the limitation that they will get bypassed if a payload is not present in their signature list. In the occurrence of a zero day, a WAF in most cases won’t be able to prevent an attack as they don’t know the signature of the exploit yet.

In this talk I will share my research outcomes on implementing a runtime application patching algorithm on an insecurely coded application to make it secure against code injection vulnerabilities and other logical issues related to web applications. I will introduce the next generation web application defending technology dubbed as Runtime Application Self Protection (RASP) that works by understanding your application to defend against web attacks by working inside the web application. RASP relies on Runtime Patching to inject security into web apps implicitly without introducing additional code changes. The root cause of all the code injection vulnerabilities is that the language interpreter cannot distinguish between data and code. The proposed solution will detect code context breakout to effectively detect and prevent code injections with the help of runtime hooking and patching at framework api or language api level. The research focuses mainly on detecting and preventing vulnerabilities like SQL Injection, Cross Site Scripting, Remote Command Execution, HTTP Verb Tampering, Header Injection etc and other application security challenges like Session Hijacking, Credential Stuffing and Layer 7 DDoS etc. This research is carried out by implementing a RASP module to a vulnerable web application written in python using tornado framework with sqlite backend.

I will discuss the following methodologies with proof of concept code and demo:

  1. Preventing Code Injection Vulnerabilities
    1. Preventing SQL Injection by monkey patching SQL drivers to extract the SQL queries and tokenise them for generating dynamic rules.
    2. Detecting Remote Command Injection by money patching shell execution APIs of the programming language, extracting the shell command and tokenise them to generate dynamic rules.
    3. Detecting Reflected and Stored XSS by monkey patching render function of the web framework to identify contexts and context breakouts.
    4. Neutralising XSS by determining the injection contexts and providing per context escaping.
    5. Detecting and Preventing DOM XSS by monkey patching html rendering methods in popular JS frameworks like jQuery, UnderscoreJS, MustacheJS, DustJS etc.
  2. Comparison with a traditional WAF
  3. Preventing Modern AppSec challenges that a WAF cannot handle
    1. Detecting and Preventing Session Hijacking.
    2. Detecting and Preventing Layer 7 DDoS that rely on targeting slow routes of the web application.
    3. Detecting Credential Stuffing attempts.
    4. Detecting Application Specific vulnerabilities like arbitary file upload, HTTP verb tampering, header injection etc.
    5. Preventing Zero days that affects framework/language components.

The talk concludes with the challenges in this new technology and gives you an insight on future of runtime protection.

Speaker Bio

Ajin Abraham is a Security Engineer for IMMUNIO with 7+ years of experience in Application Security including 4 years of Security Research. He is passionate on developing new and unique security tools. Some of his contributions to Hacker's arsenal include OWASP Xenotix XSS Exploit Framework, Mobile Security Framework (MobSF), Xenotix xBOT, NodeJsScan etc to name a few. He has been invited to speak at multiple security conferences including ClubHack, NULLCON, OWASP AppSec Eu & AsiaPac, BlackHat Europe, Hackmiami, Confidence, BlackHat US, BlackHat Asia, ToorCon, Ground Zero Summit, Hack In the Box and c0c0n.

Copyright © 2016-17 | Nullcon India | International Security Conference | All Rights Reserved