Forum Discussion
Yozzer
Nimbostratus
Mar 07, 2012XSS checks in irule
Hi
Can an irule check for special chars in a switch statement?
switch -glob [URI::decode [URI::query "?[HTTP::payload]" Param1]] {
"*<" {
set variable "xss"
}
"*>" {
set variable "xss"
}
"*)" {
set variable "xss"
}
"*%" {
set variable "xss"
}
And can i check another parameter using a switch statement after the first one (I only need to check 2)?
when HTTP_REQUEST_DATA {
switch -glob [URI::decode [URI::query "?[HTTP::payload]" Param1]] {
"<" {
set variable "xss"
}
">" {
set variable "xss"
}
")" {
set variable "xss"
}
"%" {
set variable "xss"
}
}
switch -glob [URI::decode [URI::query "?[HTTP::payload]" Param2]] {
"<" {
set variable "xss"
}
">" {
set variable "xss"
}
")" {
set variable "xss"
}
"%" {
set variable "xss"
}
}
Thanks
8 Replies
Sort By
- hoolio
Cirrostratus
Hi Yozzer, - Yozzer
Nimbostratus
So "*%*" for each would pick it up anywhere it appears? - Yozzer
Nimbostratus
I have noticed that it wont trigger if i check for % or : - Yozzer
Nimbostratus
Hi - Yozzer
Nimbostratus
This seemed to solve the null byte issue and simplified my irule checks: - Yozzer
Nimbostratus
Hi - hoolio
Cirrostratus
Jason pointed out a nice trick for this. You can get a count of the number of instances of a character using split and llength: - Yozzer
Nimbostratus
Thanks Aaron, this worked
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