File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PhpWaf \Filter ;
3+
4+ use PhpWaf \BaseFilter ;
5+
6+ /**
7+ * Class CRLF
8+ *
9+ * @package PhpWaf\Filter
10+ */
11+ class CRLF extends BaseFilter
12+ {
13+ /**
14+ * @var string
15+ */
16+ protected $ payloads_file = "crlf.txt " ;
17+
18+ /**
19+ * Check given string
20+ *
21+ * @param string $value
22+ * @return bool
23+ */
24+ public function safe (string $ value ): bool
25+ {
26+ foreach ($ this ->payloads as $ payload )
27+ {
28+ $ payload = trim ($ payload );
29+
30+ if (empty ($ payload ) || strpos ($ payload , '# ' ) === 0 )
31+ {
32+ continue ;
33+ }
34+
35+ if ($ payload == $ value || stripos ($ value , $ payload ) !== false )
36+ {
37+ return false ;
38+ }
39+ }
40+
41+ return true ;
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ # Add cookie
2+ %0D%0ASet-Cookie:mycookie=myvalue
3+
4+ # CRLF - Add a cookie - XSS Bypass
5+ %0d%0aContent-Length:35%0d%0aX-XSS-Protection:0%0d%0a%0d%0a23%0d%0a<svg%20onload=alert(document.domain)>%0d%0a0%0d%0a/%2f%2e%2e
6+
7+ # CRLF - Write HTML
8+ %0D%0AContent-Length%3A%200%0A%20%0AHTTP/1.1%20200%20OK%0AContent-Type%3A%20text/html%0ALast-Modified%3A%20Mon%2C%2027%20Oct%202060%2014%3A50%3A18%20GMT%0AContent-Length%3A%2034%0A%20%0A%3Chtml%3EYou%20have%20been%20Phished%3C/html%3E
9+
10+ # CRLF - Filter Bypass
11+ %E5%98%8A%E5%98%8Dcontent-type:text/html%E5%98%8A%E5%98%8Dlocation:%E5%98%8A%E5%98%8D%E5%98%8A%E5%98%8D%E5%98%BCsvg/onload=alert%28innerHTML%28%29%E5%98%BE
You can’t perform that action at this time.
0 commit comments