question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Content-Type: ... charset=ibm037 and friends allow for a bypass

See original GitHub issue

_Issue originally created by user dune73 on date 2018-07-08 21:05:08. Link to original issue: https://github.com/SpiderLabs/owasp-modsecurity-crs/issues/1137._

Payload: post_param1=<script>alert(000)</script>&post_param2=<script>alert(111)</script> Encoded: %97%96%A2%A3m%97%81%99%81%94%F1%7EL%A2%83%99%89%97%A3n%81%93%85%99%A3M%F0%F0%F0%5DLa%A2%83%99%89%97%A3nP%97%96%A2%A3m%97%81%99%81%94%F2%7EL%A2%83%99%89%97%A3n%81%93%85%99%A3M%F1%F1%F1%5DLa%A2%83%99%89%97%A3n

Attack:

POST /index.html?a=1 HTTP/1.1
...
Content-Type: application/x-www-form-urlencoded;charset=ibm037
...

%97%96%A2%A3m%97%81%99%81%94%F1%7EL%A2%83%99%89%97%A3n%81%93%85%99%A3M%F0%F0%F0%5DLa%A2%83%99%89%97%A3nP%97%96%A2%A3m%97%81%99%81%94%F2%7EL%A2%83%99%89%97%A3n%81%93%85%99%A3M%F1%F1%F1%5DLa%A2%83%99%89%97%A3n

This brings the following results (CRS 3.0.2 on ModSec 2.9.2)

PL1: 0
PL2: 3
PL3: 16
PL4: 29

Extracted from https://www.slideshare.net/SoroushDalili/waf-bypass-techniques-using-http-standard-and-web-servers-behaviour slide 32.

The presentation also looks into multipart transfer with special encodings. That might be even harder to catch.

I take it, we need to create a whitelist for these encodings. UTF-8 seems like a minimal entry, but what other encodings do we need by default?

Also: This is quite a thing and I think we need to create something for 3.1.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21

github_iconTop GitHub Comments

1reaction
CRS-migration-botcommented, May 13, 2020

User emphazer commented on date 2018-07-20 07:05:18:

dune73 you should definetly add ISO-8859-1 3-5% will need it. especially for older pages

1reaction
CRS-migration-botcommented, May 13, 2020

User dune73 commented on date 2018-07-11 11:44:41:

#1076 / Hybrid Paranoia Mode is ready to be merged without any remaining conflicts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

charset=ibm037 and friends allow for a bypass #1137 - GitHub
I had searched a few days of logs for this header while working on my Content-Type rule, and I only ever saw UTF-8...
Read more >
WAF Bypass Techniques - Using HTTP Standard and Web ...
This talk illustrates a number of creative techniques to smuggle and reshape HTTP requests using the strange behaviour of web servers and ...
Read more >
Coded character set identifiers - IBM
CCSID Encoding Additional information 273 IBM273. IBM‑273. Cp273 Host: Austria, Germany 277 IBM277. IBM‑277. Cp277 Host: Denmark, Norway 278 IBM278. IBM‑278. Cp278 Host: Finland, Sweden
Read more >
WAF Bypass Techniques Using HTTP Standard and Web ...
35 How to Stop Request Encoding? Write a new rule ModSecurity when only “charset=utf-8” is allowed: SecRule REQUEST_HEADERS:Content-Type (? ...
Read more >
Request Encoding to Bypass Web Application Firewalls
This header can be used in request and response messages. The following shows a number of examples: Content-Type: text/html; charset=UTF-8.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found