SQL Smuggling
SQL Smuggling
Avi Douglen
Senior AppSec Consultant
Comsec Global
[email protected]
OWASP Based on
http://www.ComsecGlobal.com/Research/SQL_Smuggling.pdf
Israel 2007
December 3rd
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
OWASP 3
OWASP
SQL Injection Revisited
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
OWASP 5
Prevention Mechanisms
Data validation
Stored Procedures
Parameterized queries
Command / Parameter objects
Strongly typed API
Strongly
Least Privilege
OWASP 6
Data Validation
OWASP 7
Parent Injection – Exploits of a Mom
OWASP 8
Data Validation
OWASP 9
Data Validation
OWASP 10
OWASP
Classic Smuggling
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
OWASP 12
General Smuggling Attacks
OWASP 13
HTTP Request Smuggling
OWASP 14
OWASP
Introducing SQL Smuggling
http://www.ComsecGlobal.com/Research/SQL_Smuggling.pdf
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
OWASP 16
Characteristics
OWASP 17
OWASP 18
OWASP
Common SQL Smuggling
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
OWASP 20
Signature Evasion
OWASP 21
OWASP
Unicode Smuggling
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
OWASP 23
OWASP 24
Character Set Support
OWASP 25
Homoglyphic Transformation
OWASP 26
But Ā is not A!
OWASP 27
Exploit Scenario
OWASP 28
Analysis
Characters created by DB
Quote does NOT exist before
Can bypass filters and get a quote to DB
Same with many other characters
Can’t find a quote if it’s not there
Can’t
Validation CANNOT work!
OWASP 29
OWASP
Applicability
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
OWASP 31
Unicode-based Smuggling
Depends on:
Dynamic SQL concatenation (can be in SP)
Validation based on Blacklists
Unicode forced into local charset
DB support of homoglyphic transformation…
So far:
MS-SQL
MySQL Connect/J (old version)
OWASP 32
On The Other Hand…
OWASP 33
OWASP
Recommendations & Conclusion
Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document
under the terms of the OWASP License.
Context-based validation
Relate to DB attributes
White-list known characters
Avoid any dynamic SQL
Do not translate character sets
See http://www.ComsecGlobal.com/Research/
SQL_Smuggling.pdf for more information
OWASP 35
Conclusion
OWASP 36
Thank you!
http://www.ComsecGlobal.com/
Research/SQL_Smuggling.pdf
Questions?
[email protected]
OWASP 37