Forum Discussion
Dave_Pisarek
Cirrus
May 19, 2021XFF and sleep
Recently I was asked about mitigating the below XFF header: X-Forwarded-For: (select(0)from(select(sleep(5)))v)/*'+(select(0)from(select(sleep(5)))v)+'"+(select(0)from(select(sleep(5)))v)+"*/ ...
JRahm
Admin
May 24, 2021If you don't have ASM/Advanced WAF and would like to do this in an iRule, you could do a check to make sure the value(s) are at least numeric and then act accordingly on finding something else. For example:
% set x (select(0)from(select(sleep(5)))v)/*'+(select(0)from(select(sleep(5)))v)+'"+(select(0)from(select(sleep(5)))v)+"*/
(select(0)from(select(sleep(5)))v)/*'+(select(0)from(select(sleep(5)))v)+'"+(select(0)from(select(sleep(5)))v)+"*/
% foreach ip $x {
if { [string is integer [lindex [split $ip "."] 0]] } {
puts "header ok"
} else { puts "header not ok" }
}
header not ok
% set x 1.2.3.4
1.2.3.4
% foreach ip $x {
if { [string is integer [lindex [split $ip "."] 0]] } {
puts "header ok"
} else { puts "header not ok" }
}
header okNote that this is very rudimentary to show what's possible. If you want to verify actual valid IP addresses in the header, far more logic is required.
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