Forum Discussion
ChadBigIP_14663
Nimbostratus
Feb 01, 2013"GET http://www.mmadsgadget.com/ - 302 Redirects in Apache Logs
Take a look at the below APACHE LOG:
142.4.127.130 - - [01/Feb/2013:02:22:31 -0500] "GET http://www.mmadsgadget.com/t?id=58f19df1-19aa-85e4-89f0-41dc9ffe2e4d&size=300x250 HTTP/1.0" 302 219 "http...
hoolio
Cirrostratus
Feb 05, 2013It looks like the malicious clients are using an absolute URL in the URI so that's why validating [HTTP::host] isn't working to block the requests. Here's something you can try where you first look for an absolute URL in the URI and then check the Host header value.
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New HTTP [HTTP::method] request to [HTTP::host], [HTTP::uri]"
Check if the URI is absolute and http:// or https://
switch -glob [string tolower [HTTP::uri]] {
"http://" -
"https://" {
Parse the host value from the URI
set host [string tolower [URI::host [HTTP::uri]]]
log local0. "[IP::client_addr]:[TCP::client_port]: Parsed $host from URI [HTTP::uri]"
}
default {
set host [string tolower [HTTP::host]]
}
}
Check if host header has a port
if {$host contains ":"}{
set host [getfield $host ":" 1]
log local0. "[IP::client_addr]:[TCP::client_port]: Parsed \$host:\$port: $host:$port"
}
Check for invalid host values
if {[class match $host equals bad_hosts_dg]}{
Send a block response
HTTP::respond 403 content {blocked!}
Or drop the connection
drop
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
