Injecting Security into vulnerable web apps at Runtime

Ajin Abraham
Ajin AbrahamSecurity Engineer | Freelance Security Consultant | Speaker at IMMUNIO
SECURITY ENGINEER
AJIN ABRAHAM
INJECTING SECURITY INTO
WEB APPS WITH RUNTIME
PATCHING
AND CONTEXT LEARNING
▸ Security Engineering @
▸ Research on Runtime Application Self Defence
▸ Authored MobSF, Xenotix and NodeJSScan
▸ Teach Security: https://opsecx.com
▸ Blog: http://opensecurity.in
#WHOAMI
AGENDA : WHAT THE TALK IS ABOUT?
RASP
WAF
WHAT THE TALK IS NOT ABOUT?
APPSEC CHALLENGES
▸ Writing Secure Code is not Easy
▸ Most follows agile development strategies
▸ Frequent releases and builds
▸ Any release can introduce or reintroduce vulnerabilities
▸ Problems by design. 

Ex: Session Hijacking, Credential Stuffing
STATE OF WEB FRAMEWORK SECURITY
▸ Automatic CSRF Token - Anti CSRF
▸ Templates escapes User Input - No XSS
▸ Uses ORM - No SQLi
You need to use secure APIs or write Code to 

enable some of these
Security Bugs happens when people write bad code.
STATE OF WEB FRAMEWORK SECURITY
▸ Anti CSRF - Can easily be turned off/miss configurations
▸ Templates escapes User Input - Just HTML Escape -> XSS
▸ https://jsfiddle.net/1c4f271c/
▸ Uses ORM - SQLi is still possible
▸ http://rails-sqli.org/
STATE OF WEB FRAMEWORK SECURITY
▸ Remote OS Command Execution - No
▸ Remote Code Injection - No
▸ Server Side Template Injection RCE - No
▸ Session Hijacking - No
▸ Verb Tampering - No
▸ File Upload Restriction - No
The list goes on…..
WE NEED TO PREVENT EXPLOITATION
LET’S USE WAF
▸ First WAF AppShield in 1999, almost 18 years of existence
▸ Quick question : How many of you run a WAF in defence/
protection mode?
▸ Most organisations use them, but in monitor mode due

high rate false positives.
▸ Most WAFs use BLACKLISTS
CAN A WAF SOLVE THIS?
20%
70%
10%
False Negatives False Positive Detection
APPLICATION SECURITY RULE OF THUMB
Gets bypassed, today or tomorrow
WHAT WAF SEES?
ATTACK != VULNERABILITY
HOW WAF WORKS
▸ The strength of WAF is the blacklist
▸ They detect Attacks not Vulnerability
▸ WAF has no application context
▸ Doesn’t know if a vulnerability got exploited inside

the app server or not.
WAFGET http://xyz.com APP SERVER
HTTP REQUEST
HTTP RESPONSE
▸ How long they keep on building the black lists?
▸ WAFs used to downgrade your security.
▸ No Perfect Forward Secrecy
▸ Can’t Support elliptic curves like ECDHE
▸ Some started to support with a Reverse Proxy
▸ Organisations are moving to PFS (Heartbleed bug)
▸ SSL Decryption and Re-encryption Overhead
WAF PROBLEMS
TLS 1.3 COMING SOON ….
SO WHAT’S THE IDEAL PLACE FOR SECURITY?
REQUEST
RESPONSE APP SERVER
APP SERVER CORE
SECURITY LAYER
We can do much better.

It’s time to evolve
WAF - > SAST -> DAST -> IAST -> RASP
Attack Detection 

&

Prevention/Neutralization

+

Precise 

Vulnerability Detection

+

Extras
Attack Detection 

&

Prevention
Vulnerability Detection
Precise 

Vulnerability Detection
RUNTIME APPLICATION SELF DEFENCE
▸ Detect both Attacks and Vulnerability
▸ Zero Code Modification and Easy Integration
▸ No Hardware Requirements
▸ Apply defence inside the application
▸ Have Code Level insights
▸ Fewer False positives
▸ Inject Security at Runtime
▸ No use of Blacklists
TYPES OF RASP
▸ Pattern Matching with Blacklist - Old wine in new
bottle (Fancy WAF)
▸ Dynamic Tainting - Good but Performance over head
▸ Virtualisation and Compartmentalisation - Good, but
Less Precise, Container oriented and not application
oriented, Platform Specific (JVM)
▸ Code Instrumentation and Dynamic Whitelist - Good,
but specific to Frameworks, Developer deployed
FOCUS OF RESEARCH
▸ Other AppSec Challenges
▸ Preventing Verb Tampering
▸ Preventing Header Injection
▸ File Upload Protection
▸ Ongoing Research
▸ Preventing Session Hijacking
▸ Preventing Layer 7 DDoS
▸ Credential Stuffing
▸ RASP by API Instrumentation

and Dynamic Whitelist
▸ Securing a vulnerable Python 

Tornado app with Zero Code change.
▸ Code Injection Vulnerabilities
▸ Preventing SQLi
▸ Preventing RCE
▸ Preventing Stored & Reflected XSS
▸ Preventing DOM XSS
RASP BY API INSTRUMENTATION AND DYNAMIC WHITELIST
▸ MONKEY PATCHING
▸ LEXICAL ANALYSIS
▸ CONTEXT DETERMINATION
MONKEY PATCHING
▸ Also know as Runtime Hooking and Patching of functions/
methods.
▸ https://jsfiddle.net/h1gves49/2/
LEXICAL ANALYSIS AND TOKEN GENERATION
▸ A lexical analyzer breaks these syntaxes into a series of
tokens, by removing any whitespace or comments in the
source code.
▸ Lexical analyzer generates error if it sees an invalid token.
LEXICAL ANALYSIS AND TOKEN GENERATION
SYNTAX TOKEN
int KEYWORD
value IDENTIFIER
= OPERATOR
100 CONSTANT
; SYMBOL
INPUT: int value = 100;//value is 100
Normal Lexer
SYNTAX TOKEN
int KEYWORD
WHITESPACE
value IDENTIFIER
WHITESPACE
= OPERATOR
WHITESPACE
100 CONSTANT
; SYMBOL
//value is 100 COMMENT
Custom Lexer
CONTEXT DETERMINATION
HTML PARSER
HTML CODE
DOM TREE
PREVENTING CODE INJECTION VULNERABILITIES
Interpreter cannot distinguish between 

Code and Data
Solve that and you solve the code injection problems
PREVENTING CODE INJECTION VULNERABILITIES
▸ Preventing SQL Injection
▸ Preventing Remote OS Command Execution
▸ Preventing Stored & Reflected Cross Site Scripting
▸ Preventing DOM XSS
SQL INJECTION
SELECT * FROM <user_input>
SQL INJECTION : HOOK
SQL Execution API

cursor.execute(‘SELECT * FROM logs‘)
SQL INJECTION : LEARN
SELECT * FROM logs
SYNTAX TOKEN
SELECT KEYWORD
WHITESPACE
* OPERATOR
WHITESPACE
FROM KEYWORD
WHITESPACE
logs STRING
SQL INJECTION : PROTECT
SYNTAX TOKEN
SELECT KEYWORD
WHITESPACE
* OPERATOR
WHITESPACE
FROM KEYWORD
WHITESPACE
logs STRING
WHITESPACE
AND KEYWORD
WHITESPACE
DROP KEYWORD
WHITESPACE
TABLE KEYWORD
WHITESPACE
admin STRING
SELECT * FROM logs AND DROP TABLE admin
SQL INJECTION : PROTECT
KEYWORD WHITESPACE OPERATOR WHITESPACE KEYWORD WHITESPACE STRING
Rule for Context: SELECT * FROM <user_input>
SELECT * FROM logs
SELECT * FROM history
SELECT * FROM logs AND DROP TABLE admin
KEYWORD WHITESPACE OPERATOR WHITESPACE KEYWORD WHITESPACE STRING 

WHITESPACE KEYWORD WHITESPACE KEYWORD WHITESPACE KEYWORD WHITESPACE STRING
DEMO
REMOTE OS COMMAND INJECTION
ping -c 3 <user input>
REMOTE OS COMMAND INJECTION : HOOK
Command Execution API

os.system(ping -c 3 127.0.0.1)
REMOTE OS COMMAND INJECTION : LEARN
ping -c 3 127.0.0.1
SYNTAX TOKEN
ping EXECUTABLE
WHITESPACE
-c ARGUMENT_DASH
WHITESPACE
3 NUMBER
WHITESPACE
127.0.0.1 IP_OR_DOMAIN
REMOTE OS COMMAND INJECTION : PROTECT
ping -c 3 127.0.0.1 & cat /etc/passwd
SYNTAX TOKEN
ping EXECUTABLE
WHITESPACE
-c ARGUMENT_DASH
WHITESPACE
3 NUMBER
WHITESPACE
127.0.0.1 IP_OR_DOMAIN
WHITESPACE
& SPLITTER
WHITESPACE
cat EXECUTABLE
WHITESPACE
/etc/passwd UNIX_PATH
REMOTE OS COMMAND INJECTION : PROTECT
EXECUTABLE WHITESPACE ARGUMENT_DASH WHITESPACE NUMBER WHITESPACE IP_OR_DOMAIN
Rule for Context: ping -c 3 <user_input>
ping -c 3 127.0.0.1

ping -c 3 google.com
ping -c 3 127.0.0.1 & cat /etc/passwd 

EXECUTABLE WHITESPACE ARGUMENT_DASH WHITESPACE NUMBER WHITESPACE IP_OR_DOMAIN

WHITESPACE SPLITTER WHITESPACE EXECUTABLE WHITESPACE UNIX_PATH
DEMO
CROSS SITE SCRIPTING
<body><h1>hello {{user_input1}} </h1></body>

<script> var x=‘{{user_input2}}’;</script>
CROSS SITE SCRIPTING : HOOK
Template Rendering API



template.render(“<body><h1>hello {{user_input1}}

</h1></body><script> var x=‘{{user_input2}}’;

</script>“, user_input1, user_input2)
CROSS SITE SCRIPTING : CONTEXT DETERMINATION
Parsing the DOM Tree
<body><h1>hello {{user_input1}}

</h1></body><script> var x=‘{{user_input2}}’;

</script>
HTML_CONTEXT
JAVASCRIPT_VALUE_CONTEXT
CROSS SITE SCRIPTING : PROTECT
<body><h1>hello {{user_input1}} </h1></body>

<script> var x=‘{{user_input2}}’;</script>
<body><h1>hello World </h1></body>

<script> var x=‘Hello World’;</script>
user_input1 = “World”

user_input2 = “Hello World”
CROSS SITE SCRIPTING : PROTECT
<body><h1>hello &lt;script&gt;alert(0)&lt;/
script&gt; </h1></body>

<script> var x=‘';alert(0);//x3C/scriptx3E’;</
script>
user_input1 = “<script>alert(0)</script>”

user_input2 = “‘;alert(0);//</script>”
DEMO
PREVENTING DOM XSS
https://jsfiddle.net/vno23woL/3/
▸ Inject Security into JavaScript Frameworks
▸ Common JavaScript Frameworks - jQuery, AngularJS, MustacheJS etc…
▸ DOMPurify - https://github.com/cure53/DOMPurify
▸ jPurify - https://github.com/cure53/jPurify
OTHER APPSEC CHALLENGES
▸ Preventing Verb Tampering
▸ Preventing Header Injection
▸ File Upload Protection
▸ Preventing Path Traversal
▸ WAFs blindly blocks TRACE and OPTION Request
▸ Hook HTTP Request API
▸ Learn the HTTP Verbs and Generate Whitelist
▸ Block if not in the list
PREVENTING VERB TAMPERING
DEMO
PREVENTING HEADER INJECTION
▸ Unlike WAF we don’t have to keep a blacklist 

of every possible encoded combination of 

“%0a” and “%0d”
▸ Hook HTTP Request API
▸ Look for “%0a,%0d“ in HTTP Request Headers
▸ Block if Present
DEMO
FILE UPLOAD PROTECTION
▸ Classic File Upload Bypass

image.jpg.php, image.php3 etc.
▸ Hook File/IO API : 

io.open(“/tmp/nice.jpg”, 'wb')
▸ Learn file extensions to create a whitelist.
▸ Block any unknown file extensions

io.open(“/tmp/nice.py”, 'wb')
DEMO
PREVENTING PATH TRAVERSAL
▸ WAF Looks for
PREVENTING PATH TRAVERSAL
▸ Hook File/IO API:

io.open(“/read_dir/index.txt”, ‘rb')
▸ Learn directories and file extensions
▸ Block any unknown directories and file extensions

io.open(“/read_dir/../../etc/passwd”, 'rb')
DEMO
ON GOING RESEARCH
▸ Preventing Session Hijacking
▸ Preventing Layer 7 DDoS
▸ Credential Stuffing
THE RASP ADVANTAGES
▸ Accurate and Precise in Vulnerability Detection & Prevention
▸ Code Level Insight (Line no, Stack trace)
▸ Not based on Heuristics - Zero/Negligible False Positives
▸ No SSL Decryption and Re-encryption overhead
▸ Doesn’t Downgrade your Security
▸ Preemptive security - Zero Day protection
▸ Zero Code Change and easy integration



pip install rasp_module

import rasp_module
BIGGEST ADVANTAGE
Now you can deploy it on protection mode
CHARACTERISTICS OF AN IDEAL RASP
▸ Ideal RASP should have minimal Performance impact
▸ Should not introduce vulnerabilities
▸ Must not consume PII of users
▸ Should not learn the bad stuff
▸ Should be a “real RASP” not a fancy WAF with Blacklist.
▸ Minimal Configuration and Easy deployment
THAT’S ALL FOLKS!
▸ Thanks to
▸ Zaid Al Hamami, Mike Milner, Steve
Williams, Oliver Lavery

(Team IMMUNIO inc).
▸ Kamaiah, Francis, Bharadwaj,
Surendar, Sinu, Vivek 

(Team Yodlee Security Office - YSO)
▸ Due Credits
▸ Graphics/Image Owners
@ajinabraham
ajin25@gmail.com
1 of 56

Recommended

Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ... by
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...Ajin Abraham
67K views38 slides
Polyglot payloads in practice by avlidienbrunn at HackPra by
Polyglot payloads in practice by avlidienbrunn at HackPraPolyglot payloads in practice by avlidienbrunn at HackPra
Polyglot payloads in practice by avlidienbrunn at HackPraMathias Karlsson
14.5K views49 slides
Burp suite by
Burp suiteBurp suite
Burp suiteSOURABH DESHMUKH
5.5K views12 slides
Ssrf by
SsrfSsrf
SsrfIlan Mindel
522 views4 slides
OWASP Mobile Top 10 Deep-Dive by
OWASP Mobile Top 10 Deep-DiveOWASP Mobile Top 10 Deep-Dive
OWASP Mobile Top 10 Deep-DivePrathan Phongthiproek
1.4K views72 slides
Firmware Extraction & Fuzzing - Jatan Raval by
Firmware Extraction & Fuzzing - Jatan RavalFirmware Extraction & Fuzzing - Jatan Raval
Firmware Extraction & Fuzzing - Jatan RavalNSConclave
1.1K views21 slides

More Related Content

What's hot

64 Methods for Mimikatz Execution by
64 Methods for Mimikatz Execution64 Methods for Mimikatz Execution
64 Methods for Mimikatz ExecutionHadess
270 views66 slides
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend by
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backendAPIsecure_ Official
151 views21 slides
Application Security by
Application SecurityApplication Security
Application SecurityReggie Niccolo Santos
1.2K views96 slides
Secure Coding 101 - OWASP University of Ottawa Workshop by
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopPaul Ionescu
906 views97 slides
Lightweight static code analysis with semgrep by
Lightweight static code analysis with semgrepLightweight static code analysis with semgrep
Lightweight static code analysis with semgrepNull Bhubaneswar
112 views28 slides

What's hot(20)

64 Methods for Mimikatz Execution by Hadess
64 Methods for Mimikatz Execution64 Methods for Mimikatz Execution
64 Methods for Mimikatz Execution
Hadess270 views
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend by APIsecure_ Official
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
2022 APIsecure_Method for exploiting IDOR on nodejs+mongodb based backend
Secure Coding 101 - OWASP University of Ottawa Workshop by Paul Ionescu
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa Workshop
Paul Ionescu906 views
Lightweight static code analysis with semgrep by Null Bhubaneswar
Lightweight static code analysis with semgrepLightweight static code analysis with semgrep
Lightweight static code analysis with semgrep
Null Bhubaneswar 112 views
Getting Started with API Security Testing by SmartBear
Getting Started with API Security TestingGetting Started with API Security Testing
Getting Started with API Security Testing
SmartBear19.3K views
Pentesting iOS Applications by jasonhaddix
Pentesting iOS ApplicationsPentesting iOS Applications
Pentesting iOS Applications
jasonhaddix24.7K views
Secure coding practices by Scott Hurrey
Secure coding practicesSecure coding practices
Secure coding practices
Scott Hurrey8.3K views
[Defcon] Hardware backdooring is practical by Moabi.com
[Defcon] Hardware backdooring is practical[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical
Moabi.com130.2K views
Web Hacking With Burp Suite 101 by Zack Meyers
Web Hacking With Burp Suite 101Web Hacking With Burp Suite 101
Web Hacking With Burp Suite 101
Zack Meyers8K views
Secure code practices by Hina Rawal
Secure code practicesSecure code practices
Secure code practices
Hina Rawal274 views
Pentesting Android Applications by Cláudio André
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
Cláudio André8.2K views
Pentesting Rest API's by :- Gaurang Bhatnagar by OWASP Delhi
Pentesting Rest API's by :- Gaurang BhatnagarPentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang Bhatnagar
OWASP Delhi6K views
API Security Best Practices and Guidelines by WSO2
API Security Best Practices and GuidelinesAPI Security Best Practices and Guidelines
API Security Best Practices and Guidelines
WSO2556 views
APISecurity_OWASP_MitigationGuide by Isabelle Mauny
APISecurity_OWASP_MitigationGuide APISecurity_OWASP_MitigationGuide
APISecurity_OWASP_MitigationGuide
Isabelle Mauny392 views
Security testing presentation by Confiz
Security testing presentationSecurity testing presentation
Security testing presentation
Confiz8.2K views

Viewers also liked

AntiVirus Evasion Reconstructed - Veil 3.0 by
AntiVirus Evasion Reconstructed - Veil 3.0AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0CTruncer
8.9K views60 slides
Invoke-Obfuscation nullcon 2017 by
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Daniel Bohannon
6.8K views220 slides
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF by
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAjin Abraham
23K views38 slides
Automated Security Analysis of Android & iOS Applications with Mobile Securit... by
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Ajin Abraham
26.1K views24 slides
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S... by
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...Ajin Abraham
10K views18 slides
Design in Tech Report 2017 by
Design in Tech Report 2017Design in Tech Report 2017
Design in Tech Report 2017John Maeda
1.1M views47 slides

Viewers also liked(20)

AntiVirus Evasion Reconstructed - Veil 3.0 by CTruncer
AntiVirus Evasion Reconstructed - Veil 3.0AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0
CTruncer8.9K views
Invoke-Obfuscation nullcon 2017 by Daniel Bohannon
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017
Daniel Bohannon6.8K views
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF by Ajin Abraham
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
Ajin Abraham23K views
Automated Security Analysis of Android & iOS Applications with Mobile Securit... by Ajin Abraham
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Ajin Abraham26.1K views
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S... by Ajin Abraham
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
Ajin Abraham10K views
Design in Tech Report 2017 by John Maeda
Design in Tech Report 2017Design in Tech Report 2017
Design in Tech Report 2017
John Maeda1.1M views
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015 by Ajin Abraham
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Ajin Abraham8K views
Abusing Google Apps and Data API: Google is My Command and Control Center by Ajin Abraham
Abusing Google Apps and Data API: Google is My Command and Control CenterAbusing Google Apps and Data API: Google is My Command and Control Center
Abusing Google Apps and Data API: Google is My Command and Control Center
Ajin Abraham8.7K views
TEDx Manchester: AI & The Future of Work by Volker Hirsch
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
Volker Hirsch903.2K views
Indice de bienveillance des marques - Agence Change 2017 présentation by Amelle Nebia
Indice de bienveillance des marques - Agence Change 2017 présentationIndice de bienveillance des marques - Agence Change 2017 présentation
Indice de bienveillance des marques - Agence Change 2017 présentation
Amelle Nebia5.4K views
WAI-ARIAの考え方と使い方を整理しよう by Nozomi Sawada
WAI-ARIAの考え方と使い方を整理しようWAI-ARIAの考え方と使い方を整理しよう
WAI-ARIAの考え方と使い方を整理しよう
Nozomi Sawada14.2K views
Advanced search and Top-k queries in Cassandra - Cassandra Summit Europe 2014 by Andrés de la Peña
Advanced search and Top-k queries in Cassandra - Cassandra Summit Europe 2014Advanced search and Top-k queries in Cassandra - Cassandra Summit Europe 2014
Advanced search and Top-k queries in Cassandra - Cassandra Summit Europe 2014
The Power of the Log by Ben Stopford
The Power of the LogThe Power of the Log
The Power of the Log
Ben Stopford4.9K views
Workshop: Docker on Elastic Beanstalk by 輝 子安
Workshop: Docker on Elastic BeanstalkWorkshop: Docker on Elastic Beanstalk
Workshop: Docker on Elastic Beanstalk
輝 子安1.4K views
Xenotix XSS Exploit Framework: Clubhack 2012 by Ajin Abraham
Xenotix XSS Exploit Framework: Clubhack 2012 Xenotix XSS Exploit Framework: Clubhack 2012
Xenotix XSS Exploit Framework: Clubhack 2012
Ajin Abraham3.9K views
How Ofsted evaluates special educational needs and disabilities provision in ... by Ofsted
How Ofsted evaluates special educational needs and disabilities provision in ...How Ofsted evaluates special educational needs and disabilities provision in ...
How Ofsted evaluates special educational needs and disabilities provision in ...
Ofsted16.4K views
10 Must-Know Commercial Real Estate Terms by REoptimizer®
10 Must-Know Commercial Real Estate Terms10 Must-Know Commercial Real Estate Terms
10 Must-Know Commercial Real Estate Terms
REoptimizer® 7K views
OWASP Xenotix XSS Exploit Framework v3 : Nullcon Goa 2013 by Ajin Abraham
OWASP Xenotix XSS Exploit Framework v3 : Nullcon Goa 2013OWASP Xenotix XSS Exploit Framework v3 : Nullcon Goa 2013
OWASP Xenotix XSS Exploit Framework v3 : Nullcon Goa 2013
Ajin Abraham4.7K views
Top 5 Deep Learning and AI Stories 3/9 by NVIDIA
Top 5 Deep Learning and AI Stories 3/9Top 5 Deep Learning and AI Stories 3/9
Top 5 Deep Learning and AI Stories 3/9
NVIDIA5.1K views

Similar to Injecting Security into vulnerable web apps at Runtime

Внедрение безопасности в веб-приложениях в среде выполнения by
Внедрение безопасности в веб-приложениях в среде выполненияВнедрение безопасности в веб-приложениях в среде выполнения
Внедрение безопасности в веб-приложениях в среде выполненияPositive Hack Days
300 views56 slides
Technical Architecture of RASP Technology by
Technical Architecture of RASP TechnologyTechnical Architecture of RASP Technology
Technical Architecture of RASP TechnologyPriyanka Aash
1.2K views50 slides
System Hardening Using Ansible by
System Hardening Using AnsibleSystem Hardening Using Ansible
System Hardening Using AnsibleSonatype
4.3K views30 slides
The Dev, Sec and Ops of API Security - API World by
The Dev, Sec and Ops of API Security - API WorldThe Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API World42Crunch
714 views26 slides
Automating Security Testing with the OWTF by
Automating Security Testing with the OWTFAutomating Security Testing with the OWTF
Automating Security Testing with the OWTFJerod Brennen
1.1K views42 slides
Penetration testing web application web application (in) security by
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) securityNahidul Kibria
2.7K views95 slides

Similar to Injecting Security into vulnerable web apps at Runtime(20)

Внедрение безопасности в веб-приложениях в среде выполнения by Positive Hack Days
Внедрение безопасности в веб-приложениях в среде выполненияВнедрение безопасности в веб-приложениях в среде выполнения
Внедрение безопасности в веб-приложениях в среде выполнения
Positive Hack Days300 views
Technical Architecture of RASP Technology by Priyanka Aash
Technical Architecture of RASP TechnologyTechnical Architecture of RASP Technology
Technical Architecture of RASP Technology
Priyanka Aash1.2K views
System Hardening Using Ansible by Sonatype
System Hardening Using AnsibleSystem Hardening Using Ansible
System Hardening Using Ansible
Sonatype 4.3K views
The Dev, Sec and Ops of API Security - API World by 42Crunch
The Dev, Sec and Ops of API Security - API WorldThe Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API World
42Crunch714 views
Automating Security Testing with the OWTF by Jerod Brennen
Automating Security Testing with the OWTFAutomating Security Testing with the OWTF
Automating Security Testing with the OWTF
Jerod Brennen1.1K views
Penetration testing web application web application (in) security by Nahidul Kibria
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
Nahidul Kibria2.7K views
OWASP_Top_Ten_Proactive_Controls_v2.pptx by azida3
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
azida37 views
How the antiviruses work by Dawid Golak
How the antiviruses workHow the antiviruses work
How the antiviruses work
Dawid Golak171 views
Building Secure Apps in the Cloud by Atlassian
Building Secure Apps in the CloudBuilding Secure Apps in the Cloud
Building Secure Apps in the Cloud
Atlassian14.5K views
10 Mistakes Hackers Want You to Make by Joe Kutner
10 Mistakes Hackers Want You to Make10 Mistakes Hackers Want You to Make
10 Mistakes Hackers Want You to Make
Joe Kutner919 views
DevSecOps - automating security by John Staveley
DevSecOps - automating securityDevSecOps - automating security
DevSecOps - automating security
John Staveley727 views
Null bhopal Sep 2016: What it Takes to Secure a Web Application by Anant Shrivastava
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationNull bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web Application
Anant Shrivastava4.1K views
DevOps and the Future of Enterprise Security by Priyanka Aash
DevOps and the Future of Enterprise SecurityDevOps and the Future of Enterprise Security
DevOps and the Future of Enterprise Security
Priyanka Aash131 views
Problems with parameters b sides-msp by Mike Saunders
Problems with parameters b sides-mspProblems with parameters b sides-msp
Problems with parameters b sides-msp
Mike Saunders539 views
香港六合彩 by baoyin
香港六合彩香港六合彩
香港六合彩
baoyin564 views
OWASP_Top_Ten_Proactive_Controls_v2.pptx by FernandoVizer
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
FernandoVizer8 views
Application Security on a Dime: A Practical Guide to Using Functional Open So... by POSSCON
Application Security on a Dime: A Practical Guide to Using Functional Open So...Application Security on a Dime: A Practical Guide to Using Functional Open So...
Application Security on a Dime: A Practical Guide to Using Functional Open So...
POSSCON1K views

More from Ajin Abraham

Injecting Security into Web apps at Runtime Whitepaper by
Injecting Security into Web apps at Runtime WhitepaperInjecting Security into Web apps at Runtime Whitepaper
Injecting Security into Web apps at Runtime WhitepaperAjin Abraham
3.1K views9 slides
Hacking Tizen: The OS of everything - Whitepaper by
Hacking Tizen: The OS of everything - WhitepaperHacking Tizen: The OS of everything - Whitepaper
Hacking Tizen: The OS of everything - WhitepaperAjin Abraham
3.8K views11 slides
Hacking Tizen : The OS of Everything - Nullcon Goa 2015 by
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Ajin Abraham
7K views50 slides
Abusing Exploiting and Pwning with Firefox Addons by
Abusing Exploiting and Pwning with Firefox AddonsAbusing Exploiting and Pwning with Firefox Addons
Abusing Exploiting and Pwning with Firefox AddonsAjin Abraham
5.7K views20 slides
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains by
Exploit Research and Development Megaprimer: DEP Bypassing with ROP ChainsExploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Exploit Research and Development Megaprimer: DEP Bypassing with ROP ChainsAjin Abraham
4.6K views16 slides
Exploit Research and Development Megaprimer: Win32 Egghunter by
Exploit Research and Development Megaprimer: Win32 EgghunterExploit Research and Development Megaprimer: Win32 Egghunter
Exploit Research and Development Megaprimer: Win32 EgghunterAjin Abraham
3.1K views21 slides

More from Ajin Abraham(16)

Injecting Security into Web apps at Runtime Whitepaper by Ajin Abraham
Injecting Security into Web apps at Runtime WhitepaperInjecting Security into Web apps at Runtime Whitepaper
Injecting Security into Web apps at Runtime Whitepaper
Ajin Abraham3.1K views
Hacking Tizen: The OS of everything - Whitepaper by Ajin Abraham
Hacking Tizen: The OS of everything - WhitepaperHacking Tizen: The OS of everything - Whitepaper
Hacking Tizen: The OS of everything - Whitepaper
Ajin Abraham3.8K views
Hacking Tizen : The OS of Everything - Nullcon Goa 2015 by Ajin Abraham
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Ajin Abraham7K views
Abusing Exploiting and Pwning with Firefox Addons by Ajin Abraham
Abusing Exploiting and Pwning with Firefox AddonsAbusing Exploiting and Pwning with Firefox Addons
Abusing Exploiting and Pwning with Firefox Addons
Ajin Abraham5.7K views
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains by Ajin Abraham
Exploit Research and Development Megaprimer: DEP Bypassing with ROP ChainsExploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Ajin Abraham4.6K views
Exploit Research and Development Megaprimer: Win32 Egghunter by Ajin Abraham
Exploit Research and Development Megaprimer: Win32 EgghunterExploit Research and Development Megaprimer: Win32 Egghunter
Exploit Research and Development Megaprimer: Win32 Egghunter
Ajin Abraham3.1K views
Exploit Research and Development Megaprimer: mona.py, Exploit Writer's Swiss ... by Ajin Abraham
Exploit Research and Development Megaprimer: mona.py, Exploit Writer's Swiss ...Exploit Research and Development Megaprimer: mona.py, Exploit Writer's Swiss ...
Exploit Research and Development Megaprimer: mona.py, Exploit Writer's Swiss ...
Ajin Abraham5K views
Exploit Research and Development Megaprimer: Unicode Based Exploit Development by Ajin Abraham
Exploit Research and Development Megaprimer: Unicode Based Exploit DevelopmentExploit Research and Development Megaprimer: Unicode Based Exploit Development
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
Ajin Abraham1.9K views
Exploit Research and Development Megaprimer: Buffer overflow for beginners by Ajin Abraham
Exploit Research and Development Megaprimer: Buffer overflow for beginnersExploit Research and Development Megaprimer: Buffer overflow for beginners
Exploit Research and Development Megaprimer: Buffer overflow for beginners
Ajin Abraham1.4K views
Pwning with XSS: from alert() to reverse shell: Defcon Banglore 2013 by Ajin Abraham
Pwning with XSS: from alert() to reverse shell: Defcon Banglore 2013Pwning with XSS: from alert() to reverse shell: Defcon Banglore 2013
Pwning with XSS: from alert() to reverse shell: Defcon Banglore 2013
Ajin Abraham10.3K views
Abusing, Exploiting and Pwning with Firefox Add-ons: OWASP Appsec 2013 Presen... by Ajin Abraham
Abusing, Exploiting and Pwning with Firefox Add-ons: OWASP Appsec 2013 Presen...Abusing, Exploiting and Pwning with Firefox Add-ons: OWASP Appsec 2013 Presen...
Abusing, Exploiting and Pwning with Firefox Add-ons: OWASP Appsec 2013 Presen...
Ajin Abraham3.6K views
Abusing, Exploiting and Pwning with Firefox Add-ons by Ajin Abraham
Abusing, Exploiting and Pwning with Firefox Add-onsAbusing, Exploiting and Pwning with Firefox Add-ons
Abusing, Exploiting and Pwning with Firefox Add-ons
Ajin Abraham8.5K views
Wi-Fi Security with Wi-Fi P+ by Ajin Abraham
Wi-Fi Security with Wi-Fi P+Wi-Fi Security with Wi-Fi P+
Wi-Fi Security with Wi-Fi P+
Ajin Abraham2.4K views
Shellcoding in linux by Ajin Abraham
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
Ajin Abraham3.4K views
Phishing With Data URI by Ajin Abraham
Phishing With Data URIPhishing With Data URI
Phishing With Data URI
Ajin Abraham2.3K views
Buffer overflow for Beginners by Ajin Abraham
Buffer overflow for BeginnersBuffer overflow for Beginners
Buffer overflow for Beginners
Ajin Abraham948 views

Recently uploaded

Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...ShapeBlue
117 views25 slides
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...ShapeBlue
158 views20 slides
Microsoft Power Platform.pptx by
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptxUni Systems S.M.S.A.
80 views38 slides
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
197 views13 slides
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
222 views23 slides
Future of AR - Facebook Presentation by
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook PresentationRob McCarty
62 views27 slides

Recently uploaded(20)

Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue117 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue158 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue197 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue222 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty62 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software385 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson156 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue176 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue79 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely78 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10126 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue132 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue166 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue146 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li80 views

Injecting Security into vulnerable web apps at Runtime

  • 1. SECURITY ENGINEER AJIN ABRAHAM INJECTING SECURITY INTO WEB APPS WITH RUNTIME PATCHING AND CONTEXT LEARNING
  • 2. ▸ Security Engineering @ ▸ Research on Runtime Application Self Defence ▸ Authored MobSF, Xenotix and NodeJSScan ▸ Teach Security: https://opsecx.com ▸ Blog: http://opensecurity.in #WHOAMI
  • 3. AGENDA : WHAT THE TALK IS ABOUT? RASP WAF WHAT THE TALK IS NOT ABOUT?
  • 4. APPSEC CHALLENGES ▸ Writing Secure Code is not Easy ▸ Most follows agile development strategies ▸ Frequent releases and builds ▸ Any release can introduce or reintroduce vulnerabilities ▸ Problems by design. 
 Ex: Session Hijacking, Credential Stuffing
  • 5. STATE OF WEB FRAMEWORK SECURITY ▸ Automatic CSRF Token - Anti CSRF ▸ Templates escapes User Input - No XSS ▸ Uses ORM - No SQLi You need to use secure APIs or write Code to 
 enable some of these Security Bugs happens when people write bad code.
  • 6. STATE OF WEB FRAMEWORK SECURITY ▸ Anti CSRF - Can easily be turned off/miss configurations ▸ Templates escapes User Input - Just HTML Escape -> XSS ▸ https://jsfiddle.net/1c4f271c/ ▸ Uses ORM - SQLi is still possible ▸ http://rails-sqli.org/
  • 7. STATE OF WEB FRAMEWORK SECURITY ▸ Remote OS Command Execution - No ▸ Remote Code Injection - No ▸ Server Side Template Injection RCE - No ▸ Session Hijacking - No ▸ Verb Tampering - No ▸ File Upload Restriction - No The list goes on…..
  • 8. WE NEED TO PREVENT EXPLOITATION LET’S USE WAF
  • 9. ▸ First WAF AppShield in 1999, almost 18 years of existence ▸ Quick question : How many of you run a WAF in defence/ protection mode? ▸ Most organisations use them, but in monitor mode due
 high rate false positives. ▸ Most WAFs use BLACKLISTS CAN A WAF SOLVE THIS? 20% 70% 10% False Negatives False Positive Detection
  • 10. APPLICATION SECURITY RULE OF THUMB Gets bypassed, today or tomorrow
  • 11. WHAT WAF SEES? ATTACK != VULNERABILITY
  • 12. HOW WAF WORKS ▸ The strength of WAF is the blacklist ▸ They detect Attacks not Vulnerability ▸ WAF has no application context ▸ Doesn’t know if a vulnerability got exploited inside
 the app server or not. WAFGET http://xyz.com APP SERVER HTTP REQUEST HTTP RESPONSE
  • 13. ▸ How long they keep on building the black lists? ▸ WAFs used to downgrade your security. ▸ No Perfect Forward Secrecy ▸ Can’t Support elliptic curves like ECDHE ▸ Some started to support with a Reverse Proxy ▸ Organisations are moving to PFS (Heartbleed bug) ▸ SSL Decryption and Re-encryption Overhead WAF PROBLEMS
  • 14. TLS 1.3 COMING SOON ….
  • 15. SO WHAT’S THE IDEAL PLACE FOR SECURITY? REQUEST RESPONSE APP SERVER APP SERVER CORE SECURITY LAYER
  • 16. We can do much better.
 It’s time to evolve WAF - > SAST -> DAST -> IAST -> RASP Attack Detection 
 &
 Prevention/Neutralization
 +
 Precise 
 Vulnerability Detection
 +
 Extras Attack Detection 
 &
 Prevention Vulnerability Detection Precise 
 Vulnerability Detection
  • 17. RUNTIME APPLICATION SELF DEFENCE ▸ Detect both Attacks and Vulnerability ▸ Zero Code Modification and Easy Integration ▸ No Hardware Requirements ▸ Apply defence inside the application ▸ Have Code Level insights ▸ Fewer False positives ▸ Inject Security at Runtime ▸ No use of Blacklists
  • 18. TYPES OF RASP ▸ Pattern Matching with Blacklist - Old wine in new bottle (Fancy WAF) ▸ Dynamic Tainting - Good but Performance over head ▸ Virtualisation and Compartmentalisation - Good, but Less Precise, Container oriented and not application oriented, Platform Specific (JVM) ▸ Code Instrumentation and Dynamic Whitelist - Good, but specific to Frameworks, Developer deployed
  • 19. FOCUS OF RESEARCH ▸ Other AppSec Challenges ▸ Preventing Verb Tampering ▸ Preventing Header Injection ▸ File Upload Protection ▸ Ongoing Research ▸ Preventing Session Hijacking ▸ Preventing Layer 7 DDoS ▸ Credential Stuffing ▸ RASP by API Instrumentation
 and Dynamic Whitelist ▸ Securing a vulnerable Python 
 Tornado app with Zero Code change. ▸ Code Injection Vulnerabilities ▸ Preventing SQLi ▸ Preventing RCE ▸ Preventing Stored & Reflected XSS ▸ Preventing DOM XSS
  • 20. RASP BY API INSTRUMENTATION AND DYNAMIC WHITELIST ▸ MONKEY PATCHING ▸ LEXICAL ANALYSIS ▸ CONTEXT DETERMINATION
  • 21. MONKEY PATCHING ▸ Also know as Runtime Hooking and Patching of functions/ methods. ▸ https://jsfiddle.net/h1gves49/2/
  • 22. LEXICAL ANALYSIS AND TOKEN GENERATION ▸ A lexical analyzer breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code. ▸ Lexical analyzer generates error if it sees an invalid token.
  • 23. LEXICAL ANALYSIS AND TOKEN GENERATION SYNTAX TOKEN int KEYWORD value IDENTIFIER = OPERATOR 100 CONSTANT ; SYMBOL INPUT: int value = 100;//value is 100 Normal Lexer SYNTAX TOKEN int KEYWORD WHITESPACE value IDENTIFIER WHITESPACE = OPERATOR WHITESPACE 100 CONSTANT ; SYMBOL //value is 100 COMMENT Custom Lexer
  • 25. PREVENTING CODE INJECTION VULNERABILITIES Interpreter cannot distinguish between 
 Code and Data Solve that and you solve the code injection problems
  • 26. PREVENTING CODE INJECTION VULNERABILITIES ▸ Preventing SQL Injection ▸ Preventing Remote OS Command Execution ▸ Preventing Stored & Reflected Cross Site Scripting ▸ Preventing DOM XSS
  • 27. SQL INJECTION SELECT * FROM <user_input>
  • 28. SQL INJECTION : HOOK SQL Execution API
 cursor.execute(‘SELECT * FROM logs‘)
  • 29. SQL INJECTION : LEARN SELECT * FROM logs SYNTAX TOKEN SELECT KEYWORD WHITESPACE * OPERATOR WHITESPACE FROM KEYWORD WHITESPACE logs STRING
  • 30. SQL INJECTION : PROTECT SYNTAX TOKEN SELECT KEYWORD WHITESPACE * OPERATOR WHITESPACE FROM KEYWORD WHITESPACE logs STRING WHITESPACE AND KEYWORD WHITESPACE DROP KEYWORD WHITESPACE TABLE KEYWORD WHITESPACE admin STRING SELECT * FROM logs AND DROP TABLE admin
  • 31. SQL INJECTION : PROTECT KEYWORD WHITESPACE OPERATOR WHITESPACE KEYWORD WHITESPACE STRING Rule for Context: SELECT * FROM <user_input> SELECT * FROM logs SELECT * FROM history SELECT * FROM logs AND DROP TABLE admin KEYWORD WHITESPACE OPERATOR WHITESPACE KEYWORD WHITESPACE STRING 
 WHITESPACE KEYWORD WHITESPACE KEYWORD WHITESPACE KEYWORD WHITESPACE STRING
  • 32. DEMO
  • 33. REMOTE OS COMMAND INJECTION ping -c 3 <user input>
  • 34. REMOTE OS COMMAND INJECTION : HOOK Command Execution API
 os.system(ping -c 3 127.0.0.1)
  • 35. REMOTE OS COMMAND INJECTION : LEARN ping -c 3 127.0.0.1 SYNTAX TOKEN ping EXECUTABLE WHITESPACE -c ARGUMENT_DASH WHITESPACE 3 NUMBER WHITESPACE 127.0.0.1 IP_OR_DOMAIN
  • 36. REMOTE OS COMMAND INJECTION : PROTECT ping -c 3 127.0.0.1 & cat /etc/passwd SYNTAX TOKEN ping EXECUTABLE WHITESPACE -c ARGUMENT_DASH WHITESPACE 3 NUMBER WHITESPACE 127.0.0.1 IP_OR_DOMAIN WHITESPACE & SPLITTER WHITESPACE cat EXECUTABLE WHITESPACE /etc/passwd UNIX_PATH
  • 37. REMOTE OS COMMAND INJECTION : PROTECT EXECUTABLE WHITESPACE ARGUMENT_DASH WHITESPACE NUMBER WHITESPACE IP_OR_DOMAIN Rule for Context: ping -c 3 <user_input> ping -c 3 127.0.0.1
 ping -c 3 google.com ping -c 3 127.0.0.1 & cat /etc/passwd 
 EXECUTABLE WHITESPACE ARGUMENT_DASH WHITESPACE NUMBER WHITESPACE IP_OR_DOMAIN
 WHITESPACE SPLITTER WHITESPACE EXECUTABLE WHITESPACE UNIX_PATH
  • 38. DEMO
  • 39. CROSS SITE SCRIPTING <body><h1>hello {{user_input1}} </h1></body>
 <script> var x=‘{{user_input2}}’;</script>
  • 40. CROSS SITE SCRIPTING : HOOK Template Rendering API
 
 template.render(“<body><h1>hello {{user_input1}}
 </h1></body><script> var x=‘{{user_input2}}’;
 </script>“, user_input1, user_input2)
  • 41. CROSS SITE SCRIPTING : CONTEXT DETERMINATION Parsing the DOM Tree <body><h1>hello {{user_input1}}
 </h1></body><script> var x=‘{{user_input2}}’;
 </script> HTML_CONTEXT JAVASCRIPT_VALUE_CONTEXT
  • 42. CROSS SITE SCRIPTING : PROTECT <body><h1>hello {{user_input1}} </h1></body>
 <script> var x=‘{{user_input2}}’;</script> <body><h1>hello World </h1></body>
 <script> var x=‘Hello World’;</script> user_input1 = “World”
 user_input2 = “Hello World”
  • 43. CROSS SITE SCRIPTING : PROTECT <body><h1>hello &lt;script&gt;alert(0)&lt;/ script&gt; </h1></body>
 <script> var x=‘';alert(0);//x3C/scriptx3E’;</ script> user_input1 = “<script>alert(0)</script>”
 user_input2 = “‘;alert(0);//</script>”
  • 44. DEMO
  • 45. PREVENTING DOM XSS https://jsfiddle.net/vno23woL/3/ ▸ Inject Security into JavaScript Frameworks ▸ Common JavaScript Frameworks - jQuery, AngularJS, MustacheJS etc… ▸ DOMPurify - https://github.com/cure53/DOMPurify ▸ jPurify - https://github.com/cure53/jPurify
  • 46. OTHER APPSEC CHALLENGES ▸ Preventing Verb Tampering ▸ Preventing Header Injection ▸ File Upload Protection ▸ Preventing Path Traversal
  • 47. ▸ WAFs blindly blocks TRACE and OPTION Request ▸ Hook HTTP Request API ▸ Learn the HTTP Verbs and Generate Whitelist ▸ Block if not in the list PREVENTING VERB TAMPERING DEMO
  • 48. PREVENTING HEADER INJECTION ▸ Unlike WAF we don’t have to keep a blacklist 
 of every possible encoded combination of 
 “%0a” and “%0d” ▸ Hook HTTP Request API ▸ Look for “%0a,%0d“ in HTTP Request Headers ▸ Block if Present DEMO
  • 49. FILE UPLOAD PROTECTION ▸ Classic File Upload Bypass
 image.jpg.php, image.php3 etc. ▸ Hook File/IO API : 
 io.open(“/tmp/nice.jpg”, 'wb') ▸ Learn file extensions to create a whitelist. ▸ Block any unknown file extensions
 io.open(“/tmp/nice.py”, 'wb') DEMO
  • 51. PREVENTING PATH TRAVERSAL ▸ Hook File/IO API:
 io.open(“/read_dir/index.txt”, ‘rb') ▸ Learn directories and file extensions ▸ Block any unknown directories and file extensions
 io.open(“/read_dir/../../etc/passwd”, 'rb') DEMO
  • 52. ON GOING RESEARCH ▸ Preventing Session Hijacking ▸ Preventing Layer 7 DDoS ▸ Credential Stuffing
  • 53. THE RASP ADVANTAGES ▸ Accurate and Precise in Vulnerability Detection & Prevention ▸ Code Level Insight (Line no, Stack trace) ▸ Not based on Heuristics - Zero/Negligible False Positives ▸ No SSL Decryption and Re-encryption overhead ▸ Doesn’t Downgrade your Security ▸ Preemptive security - Zero Day protection ▸ Zero Code Change and easy integration
 
 pip install rasp_module
 import rasp_module
  • 54. BIGGEST ADVANTAGE Now you can deploy it on protection mode
  • 55. CHARACTERISTICS OF AN IDEAL RASP ▸ Ideal RASP should have minimal Performance impact ▸ Should not introduce vulnerabilities ▸ Must not consume PII of users ▸ Should not learn the bad stuff ▸ Should be a “real RASP” not a fancy WAF with Blacklist. ▸ Minimal Configuration and Easy deployment
  • 56. THAT’S ALL FOLKS! ▸ Thanks to ▸ Zaid Al Hamami, Mike Milner, Steve Williams, Oliver Lavery
 (Team IMMUNIO inc). ▸ Kamaiah, Francis, Bharadwaj, Surendar, Sinu, Vivek 
 (Team Yodlee Security Office - YSO) ▸ Due Credits ▸ Graphics/Image Owners @ajinabraham ajin25@gmail.com