SlideShare a Scribd company logo
Data normalization
weaknesses
@d0znpp
VolgaCTF, 03/09/2013
Intro
• Researcher, bug-hunter, CEO
• Web application security in depth
• @d0znpp personal twitter
• lab.onsec.ru our blog (@ONsec_lab)
What is normalization?
• Transferring and storing data are always
accompanied by their formatting
• First normalization than formatting
• Encoding (different charsets)
• Truncation (limited sizes)
• Trims
• Canonizations
• ...
Data normalization or input
validation weaknesses?
Web application basics
• Client-Server model
• Client is browser (Chrome, Safari, IE, FF)
• Server is web server software (Nginx,
Apache)
• Application server (FastCGI,Tomcat)
• Database storage (SQL or noSQL)
Web application
example. Depth #1
Browser WebServer
Database
AppServer
HTTP FCGI SQL
Web application
example. Depth #2
Browser WebServer
Database
AppServer
HTTP FCGI SQL
Operation System
File System
FS driver
Web application
example. Depth #3
Browser WebServer
Database
AppServer
HTTP FCGI SQL
OS
File System
FS driver
Network layer
Protocol level
normalization
Browser WebServer
Database
AppServer
HTTP FCGI SQL
OS
File System
FS driver
Network layer
Protocol level
normalization
• Urlencoding - what could be simpler?
• %22 to «
• %23 to #
• %25 to %
• Double url-encoding is basic bypass for
many input validators, right?
2+ urlencoding
Why not?!
Browser Frontend Backend
HTTP FCGI
OS
Balancer
HTTP
%252527 %2527 %27
Input
validator
Protocol level
normalization
Browser WebServer
Database
AppServer
HTTP FCGI SQL
OS
File System
FS driver
Network layer
Protocol level
normalization
• HTTP parameter pollution
• https://www.owasp.org/images/b/ba/
AppsecEU09_CarettoniDiPaola_v0.8.pdf
• ?id=1&id=2 id=1,2
• HTTP parameter contamination
• http://netsec.rs/files/Http%20Parameter
%20Contamination%20-%20Ivan%20Markovic
%20NSS.pdf
• ?load[file ?load_file
Protocol level
normalization
• Something new?
• Why only parameters?
• Let’s try to fuzz smth else! :)
• GET{F}/{F}HTTP.1.1
• {F} = 0x09, 0x0b, 0x0c, 0x0d, 0x32
• Apache/2.2.22 (Unix)
• GET / bla-bla bla bla bla ehohoh
Valid packet!
File paths normalization
Browser WebServer
Database
AppServer
HTTP FCGI SQL
OS
File System
FS driver
Network layer
Filesystem names
canonization
• Path Traversal
• /../../../../../../etc/passwd
• Normalization
• http://www.ush.it/2009/02/08/php-
filesystem-attack-vectors/
• http://onsec.ru/
onsec.whitepaper-02.eng.pdf
Filesystem names
canonization
• Normalization
• /etc/passwd//////////////////////////////////.php
• C:boot.<<
• C:boot’‘ini
• C:boot.in>
Database storing
normalization
Browser WebServer
Database
AppServer
HTTP FCGI SQL
OS
File System
FS driver
Network layer
Database storing
normalization
• Encodings
• Client encoding
• Storing encoding
• Trim
• Size limited truncation
Database storing
normalization
• VARCHAR or BLOB ?
• What size limit of CREATE TABLE t1 (login
TEXT) ?
• INSERT INTO loginsVALUES
(:id, :login, :password)
• $login = « admin aa»
Application layer
normalization
Browser WebServer
Database
AppServer
HTTP FCGI SQL
OS
File System
FS driver
Network layer
Application layer
normalization
• SSRF bible. Cheatsheet
• https://docs.google.com/document/d/
1v1TkWZtrhzRLy0bYXBcdLUedXGb9nj
TNIJXa3u9akHM/#
• PHP fsockopen() url parsing tricks
Application layer
normalization
• Port overwriting, formatting
• localhost:81
• localhost:+81AAAAA
• localhost: 00081 AAA
IT IS ENCODING !!!
Multibyte encodings
• One byte for one char
• More bytes for one char !
• á
• 0xE1
• 0xC3A1 UTF-8 C-form
• 0x61CC81 UTF-8 D-form
addslashes() bypass
• http://shiflett.org/blog/2006/jan/addslashes-
versus-mysql-real-escape-string
• ’ to ’
• Replace 0x27 byte to 0x5c27
• But what about multibyte?
• 0xbf5c - valid char for GBK encoding
• 0xbf5c27 -> 0xbf5c 0x27
addslashes() bypass
• http://kuza55.blogspot.ru/2007/06/mysql-
injection-encoding-attacks.html
• Find all encodings where 0x5c is valid second
byte at any char
• big5, [A1-F9]
• sjis, [81-9F], [E0-FC]
• gbk, [81-FE]
• cp932, [81-9F], [E0-FC]
Homework!
escapeshellarg/cmd()
• Note that:
• PHP use SH by default at system(), not
BASH
• SH have no multibyte encoding
• escapeshellarg cut bytes 0x80-0xFF
But... escapeshellarg()
• http://lab.onsec.ru/2013/03/breaking-
escapeshellarg-news.html
• for shell no differences between
• ls -la
• ls ‘’-la’’
• ls ‘-la’
• unzip ‘-d/var/www’ - escaped, but arg!
PHP string encoding
http://www.php.net/manual/
language.types.string.php#language.types.string.details
• String will be encoded in whatever fashion it is encoded in
the script file
• If Zend Multibyte is enabled, the script may be written in
an arbitrary encoding (which is explicity declared or is
detected) and then converted to a certain internal
encoding, which is then the encoding that will be used for
the string literals
• State-dependent encodings where the same byte values can
be used in initial and non-initial shift states may be
problematic
Multibyte problems
• Lengths in chars or bytes?
• State-dependent encodings
• 0x0102 char
• 0x0203 char
• 0x01020203 two chars
• But what about case when 0x0202 is valid
char also?
• Try to find 0x0202 in this string ;)
Thanks for attention!
d0znpp@ONsec.ru
@d0znpp
@ONsec_lab
lab.onsec.ru

More Related Content

PDF
Distributed computing in browsers as client side attack
Ivan Novikov
 
PDF
Lie to Me: Bypassing Modern Web Application Firewalls
Ivan Novikov
 
PDF
SSRF workshop
Ivan Novikov
 
PDF
Mongo performance tuning: tips and tricks
Vladimir Malyk
 
PDF
On Centralizing Logs
Sematext Group, Inc.
 
PPTX
A Forgotten HTTP Invisibility Cloak
Soroush Dalili
 
KEY
MongoDB Command Line Tools
Rainforest QA
 
PPTX
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
Soroush Dalili
 
Distributed computing in browsers as client side attack
Ivan Novikov
 
Lie to Me: Bypassing Modern Web Application Firewalls
Ivan Novikov
 
SSRF workshop
Ivan Novikov
 
Mongo performance tuning: tips and tricks
Vladimir Malyk
 
On Centralizing Logs
Sematext Group, Inc.
 
A Forgotten HTTP Invisibility Cloak
Soroush Dalili
 
MongoDB Command Line Tools
Rainforest QA
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
Soroush Dalili
 

What's hot (20)

PDF
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
ronwarshawsky
 
PDF
YoctoDB в Яндекс.Вертикалях
CEE-SEC(R)
 
PPTX
Understanding and tuning WiredTiger, the new high performance database engine...
Ontico
 
PPT
Breaking The Cross Domain Barrier
Alex Sexton
 
PDF
Firebird Interbase Database engine hacks or rtfm
qqlan
 
PDF
Optimizing MongoDB: Lessons Learned at Localytics
andrew311
 
PDF
Defcon CTF quals
snyff
 
PDF
Making the case for write-optimized database algorithms / Mark Callaghan (Fac...
Ontico
 
PPTX
Иван Новиков «Elastic search»
Mail.ru Group
 
PDF
Preparing your web services for Android and your Android app for web services...
Droidcon Eastern Europe
 
PPTX
CORS - Enable Alfresco for CORS
Jared Ottley
 
PDF
Mongo db in 3 minutes BoilerMake
Valeri Karpov
 
PPTX
Improve aws withproxysql
Marco Tusa
 
PPTX
MongoDB Performance Tuning and Monitoring
MongoDB
 
PDF
Ruxmon feb 2013 what happened to rails
snyff
 
PPTX
Ajax xml json
Andrii Siusko
 
PDF
Jinx - Malware 2.0
Itzik Kotler
 
PDF
CORS and (in)security
n|u - The Open Security Community
 
PDF
Finding Needles in Haystacks
snyff
 
PDF
Jwt == insecurity?
snyff
 
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
ronwarshawsky
 
YoctoDB в Яндекс.Вертикалях
CEE-SEC(R)
 
Understanding and tuning WiredTiger, the new high performance database engine...
Ontico
 
Breaking The Cross Domain Barrier
Alex Sexton
 
Firebird Interbase Database engine hacks or rtfm
qqlan
 
Optimizing MongoDB: Lessons Learned at Localytics
andrew311
 
Defcon CTF quals
snyff
 
Making the case for write-optimized database algorithms / Mark Callaghan (Fac...
Ontico
 
Иван Новиков «Elastic search»
Mail.ru Group
 
Preparing your web services for Android and your Android app for web services...
Droidcon Eastern Europe
 
CORS - Enable Alfresco for CORS
Jared Ottley
 
Mongo db in 3 minutes BoilerMake
Valeri Karpov
 
Improve aws withproxysql
Marco Tusa
 
MongoDB Performance Tuning and Monitoring
MongoDB
 
Ruxmon feb 2013 what happened to rails
snyff
 
Ajax xml json
Andrii Siusko
 
Jinx - Malware 2.0
Itzik Kotler
 
CORS and (in)security
n|u - The Open Security Community
 
Finding Needles in Haystacks
snyff
 
Jwt == insecurity?
snyff
 
Ad

Viewers also liked (8)

PDF
OpenSSL rands (fork-safe)
Ivan Novikov
 
PDF
Методы разработки качественного и чистого кода
Ivan Novikov
 
PDF
Proactive approach
Ivan Novikov
 
PPT
Normalization
JTHSICT
 
PDF
XML Attack Surface - Pierre Ernst (OWASP Ottawa)
OWASP Ottawa
 
PPT
Normalization
ochesing
 
PPT
DBMS - Normalization
Jitendra Tomar
 
PDF
Database design & Normalization (1NF, 2NF, 3NF)
Jargalsaikhan Alyeksandr
 
OpenSSL rands (fork-safe)
Ivan Novikov
 
Методы разработки качественного и чистого кода
Ivan Novikov
 
Proactive approach
Ivan Novikov
 
Normalization
JTHSICT
 
XML Attack Surface - Pierre Ernst (OWASP Ottawa)
OWASP Ottawa
 
Normalization
ochesing
 
DBMS - Normalization
Jitendra Tomar
 
Database design & Normalization (1NF, 2NF, 3NF)
Jargalsaikhan Alyeksandr
 
Ad

Similar to Data normalization weaknesses (20)

PPT
Writing Secure Code – Threat Defense
amiable_indian
 
PPTX
Vulnerabilities on Various Data Processing Levels
Positive Hack Days
 
PPTX
Vulnerabilities in data processing levels
beched
 
PPTX
Software Security information security
mubeen arshad
 
PPT
Web Bugs
Dr Rushi Raval
 
PPT
Unusual Web Bugs
amiable_indian
 
PPTX
Real-World WebAppSec Flaws - Examples and Countermeasues
volvent
 
PPT
Filter Evasion: Houdini on the Wire
Rob Ragan
 
PPTX
20101017 program analysis_for_security_livshits_lecture03_security
Computer Science Club
 
PPTX
Ebu class edgescan-2017
Eoin Keary
 
PDF
Dip Your Toes in the Sea of Security (PHP UK 2016)
James Titcumb
 
PPTX
Course_Presentation cyber --------------.pptx
ssuser020436
 
PDF
DEF CON 27 - DANIEL ROMERO and MARIO RIVAS - why you should fear your mundane...
Felipe Prado
 
PDF
Wfuzz para Penetration Testers
Source Conference
 
PDF
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
DefconRussia
 
PDF
Python Cookbook 1st Edition Alex Martelli
dechiaraisp
 
PDF
Ch 10: Attacking Back-End Components
Sam Bowne
 
PDF
Ch 13: Attacking Other Users: Other Techniques (Part 1)
Sam Bowne
 
PPTX
Interpolique
Dan Kaminsky
 
PDF
Making Web Development "Secure By Default"
Duo Security
 
Writing Secure Code – Threat Defense
amiable_indian
 
Vulnerabilities on Various Data Processing Levels
Positive Hack Days
 
Vulnerabilities in data processing levels
beched
 
Software Security information security
mubeen arshad
 
Web Bugs
Dr Rushi Raval
 
Unusual Web Bugs
amiable_indian
 
Real-World WebAppSec Flaws - Examples and Countermeasues
volvent
 
Filter Evasion: Houdini on the Wire
Rob Ragan
 
20101017 program analysis_for_security_livshits_lecture03_security
Computer Science Club
 
Ebu class edgescan-2017
Eoin Keary
 
Dip Your Toes in the Sea of Security (PHP UK 2016)
James Titcumb
 
Course_Presentation cyber --------------.pptx
ssuser020436
 
DEF CON 27 - DANIEL ROMERO and MARIO RIVAS - why you should fear your mundane...
Felipe Prado
 
Wfuzz para Penetration Testers
Source Conference
 
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
DefconRussia
 
Python Cookbook 1st Edition Alex Martelli
dechiaraisp
 
Ch 10: Attacking Back-End Components
Sam Bowne
 
Ch 13: Attacking Other Users: Other Techniques (Part 1)
Sam Bowne
 
Interpolique
Dan Kaminsky
 
Making Web Development "Secure By Default"
Duo Security
 

Recently uploaded (20)

PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Software Development Methodologies in 2025
KodekX
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 

Data normalization weaknesses