mirror of
https://github.com/nmap/nmap.git
synced 2026-02-05 21:16:33 +00:00
Fix path traversal. Dots are escaped by % in Lua, not by \.
This commit is contained in:
@@ -315,8 +315,8 @@ first_char = resource:sub(0, 1)
|
||||
--(Windows drive names are not welcome too.)
|
||||
drive = resource:match("^([a-zA-Z]):")
|
||||
if first_char == "." or first_char == "/" or first_char == "\\" or drive
|
||||
or resource:find("/\\.\\./?") or resource:find("\\\\.\\.\\?")
|
||||
or resource:find("/?\\.\\./") or resource:find("\\?\\.\\.\\") then
|
||||
or resource:find("/%.%./?") or resource:find("\\%.%.\\?")
|
||||
or resource:find("/?%.%./") or resource:find("\\?%.%.\\") then
|
||||
do_403() --no hidden Unix files or simple directory traversal, sorry!
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user