Attack vector breaking 80/443 port listener on the server

What is the name of the domain?

app.xibo.tax

What is the error number?

NA

What is the error message?

NA

What is the issue you’re encountering

Every morning, some attack traffic bypasses the custom rules and cloudflare WAF security and injects some code making the VM inaccessible via URL

What steps have you taken to resolve the issue?

I have added more custom rules but it doesn’t seem to have an effect

What are the steps to reproduce the issue?

here are the nginx logs I see. The server is running django 3. How do I block this attack vector? I tried the attached rule but it doesn’t seem to work

193.68.89.10 - - [13/Feb/2025:23:06:10 +0000] “GET / HTTP/1.1” 404 187 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46”
34.140.186.203 - - [13/Feb/2025:23:13:17 +0000] “GET / HTTP/1.1” 302 0 “-” “python-requests/2.32.3”
35.203.211.96 - - [13/Feb/2025:23:26:11 +0000] “\x00\x00\x001\xFFSMBr\x00\x00\x00\x00\x18Eh\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xB5}\x00\x00\x01\x00\x00\x0E\x00\x02NT LM 0.12\x00\x02\x00” 400 157 “-” “-”
35.203.211.96 - - [13/Feb/2025:23:26:11 +0000] “\x00\x00\x00f\xFESMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001234567890123456$\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x001234567890123456\x00\x00\x00\x00\x00\x00\x00\x00\x02\x02” 400 157 “-” “-”
35.203.211.96 - - [13/Feb/2025:23:26:12 +0000] “\x00\x00\x00f\xFESMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001234567890123456$\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x001234567890123456\x00\x00\x00\x00\x00\x00\x00\x00\x10\x02” 400 157 “-” “-”
35.203.211.96 - - [13/Feb/2025:23:26:12 +0000] “\x00\x00\x00f\xFESMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001234567890123456$\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x001234567890123456\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03” 400 157 “-” “-”
35.203.211.96 - - [13/Feb/2025:23:26:13 +0000] “\x00\x00\x00f\xFESMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001234567890123456$\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x001234567890123456\x00\x00\x00\x00\x00\x00\x00\x00\x02\x03” 400 157 “-” “-”
35.203.211.96 - - [13/Feb/2025:23:26:13 +0000] “\x00\x00\x00\xAC\xFESMB@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001234567890123456$\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x001234567890123456h\x00\x00\x00\x02\x00\x00\x00\x11\x03\x00\x00\x02\x00\x06\x00\x00\x00\x00\x00\x02\x00\x02\x00\x01\x00\x00\x00\x01\x00,\x00\x00\x00\x00\x00\x02\x00\x02\x00\x01\x00\x01\x00 \x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00” 400 157 “-” “-”
45.148.10.90 - - [13/Feb/2025:23:37:52 +0000] “GET / HTTP/1.1” 400 157 “-” “-”
45.148.10.90 - - [13/Feb/2025:23:37:57 +0000] “GET / HTTP/1.1” 302 0 “-” “l9tcpid/v1.1.0”
45.148.10.90 - - [13/Feb/2025:23:38:06 +0000] “GET /logs/archived/.git/config HTTP/1.1” 302 0 “-” “l9explore/1.2.2”

Screenshot of the error

Are you restoring visitor IPs on your server? If not, those requests have been made directly to your origin IP address and not via Cloudflare otherwise you would see them as visits from Cloudflare IP addresses.

Make sure you only allow Cloudflare IP addresses to connect to your origin and then restore visitor IPs so your nginx logs show the original client IP…

3 Likes

ah, so something like this?

Allow only Cloudflare IPs

allow 173.245.48.0/20;
allow 103.21.244.0/22;
allow 103.22.200.0/22;
allow 103.31.4.0/22;
allow 141.101.64.0/18;
allow 108.162.192.0/18;
allow 190.93.240.0/20;
allow 188.114.96.0/20;
allow 197.234.240.0/22;
allow 198.41.128.0/17;
allow 162.158.0.0/15;
allow 104.16.0.0/12;
allow 172.64.0.0/13;
allow 131.0.72.0/22;
allow 2400:cb00::/32;
allow 2606:4700::/32;
allow 2803:f800::/32;
allow 2405:b500::/32;
allow 2405:8100::/32;
allow 2a06:98c0::/29;
allow 2c0f:f248::/32;

Block all other IPs

deny all;

It’s better done at your firewall in my opinion (rejects the TCP connection so less load and junk in the log), but you can do it at the web server if you don’t have that option or just prefer it.

1 Like

Thank you for the advice. Will do it at the google cloud firewall

I did it at the google cloud firewall but again it went through. Seems like Cloudflare is not able to catch it at all

I’ve tried some of the URIs in your rule and they work ok. From your previous post, I assume it is the requests containing encoded mainly null characters that aren’t matching the (starts_with(http.request.url, "\\x00")).

I’m not sure how the the ruleset engine matches encoded characters, someone else may or I’ll take a look later. In the meantime you can try matching the “SMB@” instead that appears in the same requests.

Thank you. I will try this. I also have the cloudflare managed rule set enabled.