SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
Hash DoS Attack
Miroslav Štampar
(mstampar@zsis.hr)
Hash DoS Attack
Miroslav Štampar
(mstampar@zsis.hr)
FER 2014, Zagreb (Croatia) January 17th, 2014 2
What is DoS (Denial of Service)?
“...attack where an attacker attempts
to prevent legitimate users from
accessing information or services...”
(source: US-CERT)
FER 2014, Zagreb (Croatia) January 17th, 2014 3
High bandwidth DoS
Exhaustion of (network) resources using high
speed packet traffic generation
Bandwidth is the most important factor
TCP/SYN Flood, UDP Flood, ICMP Flood, HTTP
Flood, Xmas Attack, etc.
Low sophistication level (i.e. script-kiddie)
Low to medium success rate (mostly
depending on target's security awareness)
Rate limitation, signatures, traffic anomalies,
traffic redirection (i.e. CloudFlare), challenge/
response, etc.
Booters/Stressers (e.g. 60GBps – 24.99$/1h)
FER 2014, Zagreb (Croatia) January 17th, 2014 4
Low bandwidth DoS
Exhaustion of resources without special
bandwidth requirements
In most cases one broadband line is enough
Targeting higher layers of OSI model
Standards, protocols and applications are
(usually) made without covering all “malicious”
scenarios (virtually impossible)
Application Attacks, Slow Attacks, VoIP DoS,
DNS Amplification, NTP Amplification, etc.
Medium to high success rate
Mitigation is hard (usually done at lower layers
in generic manner)
FER 2014, Zagreb (Croatia) January 17th, 2014 5
#DoS
Denial of Service through hash table (i.e.
dictionary) multi-collisions (oCERT-2011-003)
“...an attacker can degenerate the hash table
by sending lots of colliding keys...”
This issue has been known since at least 2003,
but influenced only Perl and CRuby to adapt
Insertion is O(n) in case of collision instead of
O(1) (i.e. O(n²) for inserting n elements)
POST requests are most interesting for this
attack (typical malicious data is 1-4MB)
100% of CPU usage for up to several hours per
single HTTP request
FER 2014, Zagreb (Croatia) January 17th, 2014 6
Example HTTP request
FER 2014, Zagreb (Croatia) January 17th, 2014 7
Consequences
FER 2014, Zagreb (Croatia) January 17th, 2014 8
Affected versions
Apache Tomcat – 5.5.34 and prior, 6.0.34 and
prior, 7.0.22 and prior
Java – all versions
JRuby – 1.6.5 and prior
Microsoft ASP.NET – all versions (if unpatched
with MS11-100)
PHP – 5.3.8 and prior, 5.4.0RC3 and prior
Python – 3.3.0 and prior (inadequate fix in
2.7.3 and 3.2.3)
Ruby – 1.8.7-p356 and prior
...
FER 2014, Zagreb (Croatia) January 17th, 2014 9
Dictionary / Hash table
HTTP request parameters are stored in a
dictionary (i.e. {}) for fast and easy lookup
Most common implementation of the dictionary
is a hash table
Insert, delete and lookup are (normally) being
made with O(1)
Hash tables must be able to deal with hash
collisions (expected phenomenon)
Used algorithms have to be fast and provide
reasonable distribution of hashes
No need for “cryptographically secure”
properties (like in algorithms MD5 or SHA1)
FER 2014, Zagreb (Croatia) January 17th, 2014 10
Library analogy
Imagine a librarian in a (huge) new library
He wants to be able to do the lookups as fast
as possible
Instead of sequential (i.e. alphabetical) fill up,
he programs a clever little “black box” that
gives the location based on a book's title
Result is (mostly) unique and calculated in a
highly dispersed manner
In case of collision he'll just put the book
beside the existing or run another iteration
In programming world that “black box” is called
a hash algorithm
FER 2014, Zagreb (Croatia) January 17th, 2014 11
Insertion (oversimplified)
FER 2014, Zagreb (Croatia) January 17th, 2014 12
DJBX33A / DJBX31A / DJBX33X
Daniel J. Bernstein “Times 33 Addition”
Popular hash algorithm family used across
number of programming languages
uint32_t djbx33a(const char *arKey, uint32_t
nKeyLength) {
uint32_t hash = 5381;
for (; nKeyLength > 0; nKeyLength -=1) {
hash = ((hash << 5) + hash) + *arKey++;
}
return hash;
}
DJBX33A used in PHP 5, DJBX31A used in Java,
DJBX33X used in PHP 4 and .NET, etc.
FER 2014, Zagreb (Croatia) January 17th, 2014 13
Demo #1
Brute force collision search
FER 2014, Zagreb (Croatia) January 17th, 2014 14
Equivalent substrings
Characteristic of linear hash functions (e.g.
DJBX33A)
If hashes of two strings collide then hashes of
strings having them as substrings (at same
position) will collide too
djbx33a(s)=33
n
×5381+∑
i=1
i=n
33
n−i
×si
djbx33a(' ws' )=332
×5381+331
×119+115=5863951
djbx33a(' xR ')=332
×5381+331
×120+82=5863951
djbx33a(' AwsB')=334
×5381+333
×65+332
×119+331
×115+66=6383910258
djbx33a(' AxRB')=33
4
×5381+33
3
×65+33
2
×120+33
1
×82+66=6383910258
FER 2014, Zagreb (Croatia) January 17th, 2014 15
Counting method
Popular method for linear hash functions
If hashes of two strings collide then hashes of
their binary permutations will collide too
djbx33a(' ws' )=33
2
×5381+33
1
×119+115=5863951
djbx33a(' xR' )=332
×5381+331
×120+82=5863951
djbx33a(' wsws' )=33
4
×5381+33
3
×119+33
2
×115+33
1
×119+115=6385846681
djbx33a(' wsxR' )=334
×5381+333
×119+332
×115+331
×120+82=6385846681
djbx33a(' xRws')=33
4
×5381+33
3
×120+33
2
×82+33
1
×119+115=6385846681
djbx33a(' xRxR' )=334
×5381+333
×120+332
×82+331
×120+82=6385846681
' ws'=0,' xR'=1
djbx33a(00)=djbx33a(01)=djbx33a(10)=djbx33a(11)
djbx33a(000)=djbx33a(001)=djbx33a(010)=djbx33a(011)=djbx33a(100)=...
FER 2014, Zagreb (Croatia) January 17th, 2014 16
Demo #2
Counting method collision search
FER 2014, Zagreb (Croatia) January 17th, 2014 17
Meet-in-the-middle (1)
In case of non-linear hash functions (e.g.
DJBX33X) guessing (brute force) approach
seems to be the obvious way
Choose target string (e.g. 'XzwAr2tq') and find
colliding matches by birthday (guessing) attack
50% probability for hitting a target with the
chosen hash value in tries (if the hash is a
32-bit value)
50% probability for hitting a target with one of
two chosen hash values in tries (if the hash
is a 32-bit value)
...
2
31
230
FER 2014, Zagreb (Croatia) January 17th, 2014 18
Meet-in-the-middle (2)
This method tries to attack more than one
(intermediate) target at a time
Necessity is that the final hash value uniquely
represents hash internal state and that hash
iterative function can be inverted
Searching for all strings s of length n having a
final hash value (colliding)
Iterate over all possible l-sized postfix strings
and match with random m-sized prefix strings
hi≡33×hi−1⊕si (mod 232
)
33×1041204193≡1(mod 2
32
)
1041204193×(hi⊕si )≡hi−1(mod 232
)
hn
FER 2014, Zagreb (Croatia) January 17th, 2014 19
Meet-in-the-middle (3)
Choose arbitrary values m and l such as m+l=n
(value l will depend on available memory)
Choose arbitrary hash value
Iterate over all l-sized strings and store them
into the memory together with respective hash
states got by inverse iterative process
Perform a birthday (guessing) attack by
randomly finding m-sized strings having
Combining such m-sized (prefix) string value
with corresponding (stored) l-sized (postfix)
string value gives a colliding result
Results are fastest obtained when m=l=n/2
hn−l
hn
hm=hn−l
s=sm+sl
FER 2014, Zagreb (Croatia) January 17th, 2014 20
Meet-in-the-middle (4)
FER 2014, Zagreb (Croatia) January 17th, 2014 21
Meet-in-the-middle (5)
Splitting in the middle (m=l=n/2) reduces the
complexity of this attack by square root
50% probability for hitting a target with the
chosen hash value in tries (if the hash is a
32-bit value)
Also works for linear hash functions (e.g.
DJBX33A)
Originally targeting encryption methods
achieving increased security by using multiple
iterations of the same algorithm (e.g. 3DES)
215.5
FER 2014, Zagreb (Croatia) January 17th, 2014 22
Demo #3
Meet-in-the-middle collision search
FER 2014, Zagreb (Croatia) January 17th, 2014 23
Demo #4
LAMP Server (PHP 5)
FER 2014, Zagreb (Croatia) January 17th, 2014 24
Demo #5
IIS Server (ASP.NET)
FER 2014, Zagreb (Croatia) January 17th, 2014 25
Mitigation (low level)
Hash (seed) randomization
new seed is generated on every interpreter,
application and/or system start
breaking code that incorrectly relies on specific
ordering of dictionary keys (official explanation
from Python team)
CPython (-R) random seed has been successfully
remotely recovered (by Jean-Philippe Aumasson
and Daniel J. Bernstein :)
Changing hash algorithm (e.g. to SipHash
chosen by Python, Ruby, Perl, Rust, FreeBSD,
Redis, etc.)
FER 2014, Zagreb (Croatia) January 17th, 2014 26
Mitigation (high level)
Limiting CPU time (e.g. max_input_time in
PHP, CGITimeout in IIS, etc.)
Limiting maximum POST size (e.g.
post_max_size in PHP,
suhosin.post.max_value_length in Suhosin
hardened PHP, maxAllowedContentLength in
ASP.NET, etc.)
Limiting maximum number of HTTP request
parameters (e.g. suhosin.request.max_vars
in Suhosin hardened PHP,
org.apache.tomcat.util.http.Parameters.M
AX_COUNT in Tomcat, etc.)
FER 2014, Zagreb (Croatia) January 17th, 2014 27
Questions?

Mais conteúdo relacionado

Mais procurados

Http Parameter Pollution, a new category of web attacks
Http Parameter Pollution, a new category of web attacksHttp Parameter Pollution, a new category of web attacks
Http Parameter Pollution, a new category of web attacksStefano Di Paola
 
Python tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterPython tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterJeff Hale
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Hossam .M Hamed
 
New methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsNew methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsMikhail Egorov
 
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Django Tutorial | Django Web Development With Python | Django Training and Ce...Django Tutorial | Django Web Development With Python | Django Training and Ce...
Django Tutorial | Django Web Development With Python | Django Training and Ce...Edureka!
 
DVWA BruCON Workshop
DVWA BruCON WorkshopDVWA BruCON Workshop
DVWA BruCON Workshoptestuser1223
 
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS FilterX-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS FilterMasato Kinugawa
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.pptsentayehu
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Amit Tyagi
 
Pentesting GraphQL Applications
Pentesting GraphQL ApplicationsPentesting GraphQL Applications
Pentesting GraphQL ApplicationsNeelu Tripathy
 

Mais procurados (20)

Http Parameter Pollution, a new category of web attacks
Http Parameter Pollution, a new category of web attacksHttp Parameter Pollution, a new category of web attacks
Http Parameter Pollution, a new category of web attacks
 
Dart ppt
Dart pptDart ppt
Dart ppt
 
Python tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterPython tools to deploy your machine learning models faster
Python tools to deploy your machine learning models faster
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop
 
New methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsNew methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applications
 
Sql Injection 0wning Enterprise
Sql Injection 0wning EnterpriseSql Injection 0wning Enterprise
Sql Injection 0wning Enterprise
 
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Django Tutorial | Django Web Development With Python | Django Training and Ce...Django Tutorial | Django Web Development With Python | Django Training and Ce...
Django Tutorial | Django Web Development With Python | Django Training and Ce...
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 
Api presentation
Api presentationApi presentation
Api presentation
 
REST full API Design
REST full API DesignREST full API Design
REST full API Design
 
Spring AOP
Spring AOPSpring AOP
Spring AOP
 
DVWA BruCON Workshop
DVWA BruCON WorkshopDVWA BruCON Workshop
DVWA BruCON Workshop
 
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS FilterX-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter
 
Sql injection
Sql injectionSql injection
Sql injection
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
 
Lfi
LfiLfi
Lfi
 
DJango
DJangoDJango
DJango
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
 
Pentesting GraphQL Applications
Pentesting GraphQL ApplicationsPentesting GraphQL Applications
Pentesting GraphQL Applications
 

Semelhante a Hash DoS Attack

Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and NowMiroslav Stampar
 
Miroslav Stampar. Sqlmap — Under the Hood.
Miroslav Stampar. Sqlmap — Under the Hood.Miroslav Stampar. Sqlmap — Under the Hood.
Miroslav Stampar. Sqlmap — Under the Hood.Positive Hack Days
 
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hoodPh days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hoodPositive Hack Days
 
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hoodPh days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hoodPositive Hack Days
 
2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)Miroslav Stampar
 
Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?Miroslav Stampar
 
Data mining-2011-09
Data mining-2011-09Data mining-2011-09
Data mining-2011-09Ted Dunning
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and NowMiroslav Stampar
 
Deep Learning and Watson Studio
Deep Learning and Watson StudioDeep Learning and Watson Studio
Deep Learning and Watson StudioSasha Lazarevic
 
Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016Chris Fregly
 
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016MLconf
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JFlorent Biville
 
Homomorphic encryption in_cloud
Homomorphic encryption in_cloudHomomorphic encryption in_cloud
Homomorphic encryption in_cloudShivam Singh
 
Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13specialk29
 
Language Technology Enhanced Learning
Language Technology Enhanced LearningLanguage Technology Enhanced Learning
Language Technology Enhanced Learningtelss09
 

Semelhante a Hash DoS Attack (20)

Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and Now
 
Miroslav Stampar. Sqlmap — Under the Hood.
Miroslav Stampar. Sqlmap — Under the Hood.Miroslav Stampar. Sqlmap — Under the Hood.
Miroslav Stampar. Sqlmap — Under the Hood.
 
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hoodPh days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hood
 
sqlmap - Under the Hood
sqlmap - Under the Hoodsqlmap - Under the Hood
sqlmap - Under the Hood
 
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hoodPh days 2013-miroslav-stampar_-_sqlmap_under_the_hood
Ph days 2013-miroslav-stampar_-_sqlmap_under_the_hood
 
2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
 
Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?
 
Data mining-2011-09
Data mining-2011-09Data mining-2011-09
Data mining-2011-09
 
Tutorial5
Tutorial5Tutorial5
Tutorial5
 
Ruby quick ref
Ruby quick refRuby quick ref
Ruby quick ref
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and Now
 
Deep Learning and Watson Studio
Deep Learning and Watson StudioDeep Learning and Watson Studio
Deep Learning and Watson Studio
 
Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016
 
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4J
 
Software Security
Software SecuritySoftware Security
Software Security
 
Homomorphic encryption in_cloud
Homomorphic encryption in_cloudHomomorphic encryption in_cloud
Homomorphic encryption in_cloud
 
Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13
 
Language Technology Enhanced Learning
Language Technology Enhanced LearningLanguage Technology Enhanced Learning
Language Technology Enhanced Learning
 

Mais de Miroslav Stampar

sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"Miroslav Stampar
 
Improving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic DenoiseImproving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic DenoiseMiroslav Stampar
 
APT Attacks on Critical Infrastructure
APT Attacks on Critical InfrastructureAPT Attacks on Critical Infrastructure
APT Attacks on Critical InfrastructureMiroslav Stampar
 
WARNING: Do Not Feed the Bears
WARNING: Do Not Feed the BearsWARNING: Do Not Feed the Bears
WARNING: Do Not Feed the BearsMiroslav Stampar
 
Non-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & TricksNon-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & TricksMiroslav Stampar
 
sqlmap - why (not how) it works?
sqlmap - why (not how) it works?sqlmap - why (not how) it works?
sqlmap - why (not how) it works?Miroslav Stampar
 
Heuristic methods used in sqlmap
Heuristic methods used in sqlmapHeuristic methods used in sqlmap
Heuristic methods used in sqlmapMiroslav Stampar
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web VulnerabilityMiroslav Stampar
 
Analysis of mass SQL injection attacks
Analysis of mass SQL injection attacksAnalysis of mass SQL injection attacks
Analysis of mass SQL injection attacksMiroslav Stampar
 
Data Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksData Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksMiroslav Stampar
 
DNS exfiltration using sqlmap
DNS exfiltration using sqlmapDNS exfiltration using sqlmap
DNS exfiltration using sqlmapMiroslav Stampar
 
It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)Miroslav Stampar
 
sqlmap - security development in Python
sqlmap - security development in Pythonsqlmap - security development in Python
sqlmap - security development in PythonMiroslav Stampar
 

Mais de Miroslav Stampar (18)

sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"
 
Blind WAF identification
Blind WAF identificationBlind WAF identification
Blind WAF identification
 
sqlmap internals
sqlmap internalssqlmap internals
sqlmap internals
 
sqlmap internals
sqlmap internalssqlmap internals
sqlmap internals
 
Improving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic DenoiseImproving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic Denoise
 
APT Attacks on Critical Infrastructure
APT Attacks on Critical InfrastructureAPT Attacks on Critical Infrastructure
APT Attacks on Critical Infrastructure
 
WARNING: Do Not Feed the Bears
WARNING: Do Not Feed the BearsWARNING: Do Not Feed the Bears
WARNING: Do Not Feed the Bears
 
Non-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & TricksNon-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & Tricks
 
sqlmap - why (not how) it works?
sqlmap - why (not how) it works?sqlmap - why (not how) it works?
sqlmap - why (not how) it works?
 
Smashing the Buffer
Smashing the BufferSmashing the Buffer
Smashing the Buffer
 
Curious Case of SQLi
Curious Case of SQLiCurious Case of SQLi
Curious Case of SQLi
 
Heuristic methods used in sqlmap
Heuristic methods used in sqlmapHeuristic methods used in sqlmap
Heuristic methods used in sqlmap
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability
 
Analysis of mass SQL injection attacks
Analysis of mass SQL injection attacksAnalysis of mass SQL injection attacks
Analysis of mass SQL injection attacks
 
Data Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksData Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection Attacks
 
DNS exfiltration using sqlmap
DNS exfiltration using sqlmapDNS exfiltration using sqlmap
DNS exfiltration using sqlmap
 
It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)
 
sqlmap - security development in Python
sqlmap - security development in Pythonsqlmap - security development in Python
sqlmap - security development in Python
 

Último

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Último (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Hash DoS Attack

  • 1. Hash DoS Attack Miroslav Štampar (mstampar@zsis.hr) Hash DoS Attack Miroslav Štampar (mstampar@zsis.hr)
  • 2. FER 2014, Zagreb (Croatia) January 17th, 2014 2 What is DoS (Denial of Service)? “...attack where an attacker attempts to prevent legitimate users from accessing information or services...” (source: US-CERT)
  • 3. FER 2014, Zagreb (Croatia) January 17th, 2014 3 High bandwidth DoS Exhaustion of (network) resources using high speed packet traffic generation Bandwidth is the most important factor TCP/SYN Flood, UDP Flood, ICMP Flood, HTTP Flood, Xmas Attack, etc. Low sophistication level (i.e. script-kiddie) Low to medium success rate (mostly depending on target's security awareness) Rate limitation, signatures, traffic anomalies, traffic redirection (i.e. CloudFlare), challenge/ response, etc. Booters/Stressers (e.g. 60GBps – 24.99$/1h)
  • 4. FER 2014, Zagreb (Croatia) January 17th, 2014 4 Low bandwidth DoS Exhaustion of resources without special bandwidth requirements In most cases one broadband line is enough Targeting higher layers of OSI model Standards, protocols and applications are (usually) made without covering all “malicious” scenarios (virtually impossible) Application Attacks, Slow Attacks, VoIP DoS, DNS Amplification, NTP Amplification, etc. Medium to high success rate Mitigation is hard (usually done at lower layers in generic manner)
  • 5. FER 2014, Zagreb (Croatia) January 17th, 2014 5 #DoS Denial of Service through hash table (i.e. dictionary) multi-collisions (oCERT-2011-003) “...an attacker can degenerate the hash table by sending lots of colliding keys...” This issue has been known since at least 2003, but influenced only Perl and CRuby to adapt Insertion is O(n) in case of collision instead of O(1) (i.e. O(n²) for inserting n elements) POST requests are most interesting for this attack (typical malicious data is 1-4MB) 100% of CPU usage for up to several hours per single HTTP request
  • 6. FER 2014, Zagreb (Croatia) January 17th, 2014 6 Example HTTP request
  • 7. FER 2014, Zagreb (Croatia) January 17th, 2014 7 Consequences
  • 8. FER 2014, Zagreb (Croatia) January 17th, 2014 8 Affected versions Apache Tomcat – 5.5.34 and prior, 6.0.34 and prior, 7.0.22 and prior Java – all versions JRuby – 1.6.5 and prior Microsoft ASP.NET – all versions (if unpatched with MS11-100) PHP – 5.3.8 and prior, 5.4.0RC3 and prior Python – 3.3.0 and prior (inadequate fix in 2.7.3 and 3.2.3) Ruby – 1.8.7-p356 and prior ...
  • 9. FER 2014, Zagreb (Croatia) January 17th, 2014 9 Dictionary / Hash table HTTP request parameters are stored in a dictionary (i.e. {}) for fast and easy lookup Most common implementation of the dictionary is a hash table Insert, delete and lookup are (normally) being made with O(1) Hash tables must be able to deal with hash collisions (expected phenomenon) Used algorithms have to be fast and provide reasonable distribution of hashes No need for “cryptographically secure” properties (like in algorithms MD5 or SHA1)
  • 10. FER 2014, Zagreb (Croatia) January 17th, 2014 10 Library analogy Imagine a librarian in a (huge) new library He wants to be able to do the lookups as fast as possible Instead of sequential (i.e. alphabetical) fill up, he programs a clever little “black box” that gives the location based on a book's title Result is (mostly) unique and calculated in a highly dispersed manner In case of collision he'll just put the book beside the existing or run another iteration In programming world that “black box” is called a hash algorithm
  • 11. FER 2014, Zagreb (Croatia) January 17th, 2014 11 Insertion (oversimplified)
  • 12. FER 2014, Zagreb (Croatia) January 17th, 2014 12 DJBX33A / DJBX31A / DJBX33X Daniel J. Bernstein “Times 33 Addition” Popular hash algorithm family used across number of programming languages uint32_t djbx33a(const char *arKey, uint32_t nKeyLength) { uint32_t hash = 5381; for (; nKeyLength > 0; nKeyLength -=1) { hash = ((hash << 5) + hash) + *arKey++; } return hash; } DJBX33A used in PHP 5, DJBX31A used in Java, DJBX33X used in PHP 4 and .NET, etc.
  • 13. FER 2014, Zagreb (Croatia) January 17th, 2014 13 Demo #1 Brute force collision search
  • 14. FER 2014, Zagreb (Croatia) January 17th, 2014 14 Equivalent substrings Characteristic of linear hash functions (e.g. DJBX33A) If hashes of two strings collide then hashes of strings having them as substrings (at same position) will collide too djbx33a(s)=33 n ×5381+∑ i=1 i=n 33 n−i ×si djbx33a(' ws' )=332 ×5381+331 ×119+115=5863951 djbx33a(' xR ')=332 ×5381+331 ×120+82=5863951 djbx33a(' AwsB')=334 ×5381+333 ×65+332 ×119+331 ×115+66=6383910258 djbx33a(' AxRB')=33 4 ×5381+33 3 ×65+33 2 ×120+33 1 ×82+66=6383910258
  • 15. FER 2014, Zagreb (Croatia) January 17th, 2014 15 Counting method Popular method for linear hash functions If hashes of two strings collide then hashes of their binary permutations will collide too djbx33a(' ws' )=33 2 ×5381+33 1 ×119+115=5863951 djbx33a(' xR' )=332 ×5381+331 ×120+82=5863951 djbx33a(' wsws' )=33 4 ×5381+33 3 ×119+33 2 ×115+33 1 ×119+115=6385846681 djbx33a(' wsxR' )=334 ×5381+333 ×119+332 ×115+331 ×120+82=6385846681 djbx33a(' xRws')=33 4 ×5381+33 3 ×120+33 2 ×82+33 1 ×119+115=6385846681 djbx33a(' xRxR' )=334 ×5381+333 ×120+332 ×82+331 ×120+82=6385846681 ' ws'=0,' xR'=1 djbx33a(00)=djbx33a(01)=djbx33a(10)=djbx33a(11) djbx33a(000)=djbx33a(001)=djbx33a(010)=djbx33a(011)=djbx33a(100)=...
  • 16. FER 2014, Zagreb (Croatia) January 17th, 2014 16 Demo #2 Counting method collision search
  • 17. FER 2014, Zagreb (Croatia) January 17th, 2014 17 Meet-in-the-middle (1) In case of non-linear hash functions (e.g. DJBX33X) guessing (brute force) approach seems to be the obvious way Choose target string (e.g. 'XzwAr2tq') and find colliding matches by birthday (guessing) attack 50% probability for hitting a target with the chosen hash value in tries (if the hash is a 32-bit value) 50% probability for hitting a target with one of two chosen hash values in tries (if the hash is a 32-bit value) ... 2 31 230
  • 18. FER 2014, Zagreb (Croatia) January 17th, 2014 18 Meet-in-the-middle (2) This method tries to attack more than one (intermediate) target at a time Necessity is that the final hash value uniquely represents hash internal state and that hash iterative function can be inverted Searching for all strings s of length n having a final hash value (colliding) Iterate over all possible l-sized postfix strings and match with random m-sized prefix strings hi≡33×hi−1⊕si (mod 232 ) 33×1041204193≡1(mod 2 32 ) 1041204193×(hi⊕si )≡hi−1(mod 232 ) hn
  • 19. FER 2014, Zagreb (Croatia) January 17th, 2014 19 Meet-in-the-middle (3) Choose arbitrary values m and l such as m+l=n (value l will depend on available memory) Choose arbitrary hash value Iterate over all l-sized strings and store them into the memory together with respective hash states got by inverse iterative process Perform a birthday (guessing) attack by randomly finding m-sized strings having Combining such m-sized (prefix) string value with corresponding (stored) l-sized (postfix) string value gives a colliding result Results are fastest obtained when m=l=n/2 hn−l hn hm=hn−l s=sm+sl
  • 20. FER 2014, Zagreb (Croatia) January 17th, 2014 20 Meet-in-the-middle (4)
  • 21. FER 2014, Zagreb (Croatia) January 17th, 2014 21 Meet-in-the-middle (5) Splitting in the middle (m=l=n/2) reduces the complexity of this attack by square root 50% probability for hitting a target with the chosen hash value in tries (if the hash is a 32-bit value) Also works for linear hash functions (e.g. DJBX33A) Originally targeting encryption methods achieving increased security by using multiple iterations of the same algorithm (e.g. 3DES) 215.5
  • 22. FER 2014, Zagreb (Croatia) January 17th, 2014 22 Demo #3 Meet-in-the-middle collision search
  • 23. FER 2014, Zagreb (Croatia) January 17th, 2014 23 Demo #4 LAMP Server (PHP 5)
  • 24. FER 2014, Zagreb (Croatia) January 17th, 2014 24 Demo #5 IIS Server (ASP.NET)
  • 25. FER 2014, Zagreb (Croatia) January 17th, 2014 25 Mitigation (low level) Hash (seed) randomization new seed is generated on every interpreter, application and/or system start breaking code that incorrectly relies on specific ordering of dictionary keys (official explanation from Python team) CPython (-R) random seed has been successfully remotely recovered (by Jean-Philippe Aumasson and Daniel J. Bernstein :) Changing hash algorithm (e.g. to SipHash chosen by Python, Ruby, Perl, Rust, FreeBSD, Redis, etc.)
  • 26. FER 2014, Zagreb (Croatia) January 17th, 2014 26 Mitigation (high level) Limiting CPU time (e.g. max_input_time in PHP, CGITimeout in IIS, etc.) Limiting maximum POST size (e.g. post_max_size in PHP, suhosin.post.max_value_length in Suhosin hardened PHP, maxAllowedContentLength in ASP.NET, etc.) Limiting maximum number of HTTP request parameters (e.g. suhosin.request.max_vars in Suhosin hardened PHP, org.apache.tomcat.util.http.Parameters.M AX_COUNT in Tomcat, etc.)
  • 27. FER 2014, Zagreb (Croatia) January 17th, 2014 27 Questions?