Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions regex-assembly/941400.ra
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##! Please refer to the documentation at
##! https://coreruleset.org/docs/development/regex_assembly/.

##! Please refer to the documentation at
##! https://coreruleset.org/docs/development/regex_assembly/.
##!
##! Rule 941400: XSS JavaScript function without parentheses
##! Detects attempts to invoke JavaScript functions via tagged template literals
##! without parentheses, using Array/Reflect method chaining.
##! e.g. [].sort.call`${alert}1337`
##! e.g. Reflect.apply.call`${navigation.navigate}${navigation}${[name]}`
##! Reference: https://portswigger.net/research/the-seventh-way-to-call-a-javascript-function-without-parentheses

##!> assemble
\[[^\]]*\][^.]*\.
Reflect[^.]*\.
##!=< array-or-reflect
##!<

##!> assemble
map
sort
apply
##!=< js-methods
##!<

##!> assemble
(
##!=> array-or-reflect
).*
##!=> js-methods
[^.]*\..*call[^`]*`.*`
##!<
7 changes: 6 additions & 1 deletion rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,12 @@ SecRule REQUEST_COOKIES|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|X
# [].map.call`${eval}\\u{61}lert\x281337\x29`
# Reflect.apply.call`${navigation.navigate}${navigation}${[name]}`
#
SecRule REQUEST_COOKIES|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx ((?:\[[^\]]*\][^.]*\.)|Reflect[^.]*\.).*(?:map|sort|apply)[^.]*\..*call[^`]*`.*`" \
# Regular expression generated from regex-assembly/941400.ra.
# To update the regular expression run the following shell script
# (consult https://coreruleset.org/docs/development/regex_assembly/ for details):
# crs-toolchain regex update 941400
#
SecRule REQUEST_COOKIES|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|REQUEST_FILENAME|XML:/* "@rx ((?:\[[^\]]*\]|Reflect)[^\.]*\.).*(?:map|sort|apply)[^\.]*\..*call[^`]*`.*`" \
"id:941400,\
phase:2,\
block,\
Expand Down
Loading