FTP安全审计php |
FTP服务提供了对文件的远程访问功能,一般用于对Web服务器的维护及相似的目的。FTP服务主要使用以下两个端口:TCP21端口,入站服务器控制端口,用于接收和处理来自客户端的FTP命令,TCP20端口,出站数据端口,用于从服务器向客户端发送数据。要进行数据传输,须要两个端口共同做用:控制端口21,用于发布PORT等命令对数据传输进行初始化;数据端口20,用于进行具体的数据传输。RFC959捕获并归纳了FTP及其不一样的模式与命令。html |
FTP服务容易受到以下几类攻击:安全 |
|
若是经过老版本的防火墙与代理服务器来访问FTP服务,那么也能够对其进行滥用,这是经过发送定制的PORT命令(提供对目标服务器上其它端口的访问)来实现的。工具 |
FTP服务标志获取与枚举测试 |
发现一台服务器上运行FTP以后,链接到该服务器以后发现的第一条信息是FTP服务器标志:ui |
$ ftp 192.168.0.11 Connected to 192.168.0.11 (192.168.0.11) 220 darkside FTP server ready. Name (192.168.0.11:root)
|
这里,所获取的标志代表这是一台Solaris9服务器,而Solaris 8(也称SunOS5.8)及之前版本会略有不一样的标志返回操做系统详细资料,以下所示:spa |
$ ftp 192.168.0.12 Connected to 192.168.0.22 (192.168.0.22) 220 lackie FTP server (SunOS 5.8) ready. Name (192.168.0.12:root):
|
若是管理员对服务标示进行过模糊处理或修改以去除服务版本或操做系统信息,则该服务有时候能够在登陆以后经过分析quotehelp和syst命令的响应信息加以识别,例如: |
$ ftp 192.168.0.250 Connected to 192.168.0.250 (192.168.0.250). 220 ftp.trustmatta.com FTP server ready. Name (ftp.trustmatta.com:root): ftp 331 Guest login ok, send your complete e-mail address as password. Password: hello@world.com 220 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp> quote help 214-The following commands are recongnized (* =>'s unimplemented). USER PORT STOR MSAM* RNTO NLST MKD CDUP PASS PASV APPE MRSQ* ABOR SITE XMKD XCUP ACCT* TYPE MLFL* MRCP* DELE SYST RMD STOU SMNY* STRU MAIL* ALL0 CWD STAT XRMD SIZE REIN* MODE MSND* REST XCWD HELP PWD MDTM QUIT RETR MSOM* RNFR LIST NOOP XPWD 214 Direct coments to ftpadmin@ftp.trustmatta.com ftp> syst 215 UNIX Type: L8 Version: SUNOS
|
|
msf > use auxiliary/scanner/ftp/ftp_ use auxiliary/scanner/ftp/ftp_login use auxiliary/scanner/ftp/ftp_version msf > use auxiliary/scanner/ftp/ftp_version msf auxiliary(ftp_version) > show options Module options (auxiliary/scanner/ftp/ftp_version): Name Current Setting Required Description ---- --------------- -------- ----------- FTPPASS mozilla@example.com no The password for the specified username FTPUSER anonymous no The username to authenticate as RHOSTS yes The target address range or CIDR identifier RPORT 21 yes The target port THREADS 1 yes The number of concurrent threads msf auxiliary(ftp_version) > set RHOSTS 10.1.2.115 RHOSTS => 10.1.2.115 msf auxiliary(ftp_version) > run [*] 10.1.2.115:21 FTP Banner: '220-Wellcome to Home Ftp Server!\x0d\x0a220 FTP server ready.\x0d\x0a' [*] Scanned 1 of 1 hosts (100% complete) [*] Auxiliary module execution completed
|
在这个实例中,所获取的标志没有揭示FTP服务类型和版本信息。然而,经过登陆之后对服务器的查询,能够断定是一个Sun MicrosystemsFTP守护进程。经过对该端口进行IP“指纹识别”,还能够大略断定所运行的Solaris版本。 |
评估FTP访问许可权限 |
在得到FTP服务的访问权限后,你应该准确评估本身具有对可访问的目录结构具备哪一种类型的访问权限。不少FTP攻击方法须要攻击者具备建立文件和目录的权限,以便正确有效的实施攻击计划。 |
FTP口令暴力猜解 |
THCHydra是Unix下一款快速的暴力破解工具,能够对FTP,POP3,IMAP,HTTP,LDAP以及不少其它服务进行暴力破解,Brutus是一款相似的运行在Windows下的工具。这些工具可在以下网址下载: http://www.thc.org/releases.php http://www.hoobie.net/brutus/brutus-download.html |
FTP跳板攻击 |
绑定在较老版本操做平台的FTP服务容易受到跳板攻击,在这种攻击中,端口扫描数据包与畸形数据能够经过FTP发送到任意位置。 |
FTP绕过状态过滤机制 |
FTP是一个用于文件传输的复杂协议,在实现上包含两个通道:控制通道(使用TCP21端口)和数据通道(使用TCP 20端口)。PORT命令与PASV命令经过控制通道发布,用于肯定由哪一个动态的高端口用来传输和接收数据。 |
220-Wellcome to Home Ftp Server! 220 FTP server ready. USER ftp 331 Password required for 123. PASS ftp 230 User 123 logged in. SYST 215 UNIX Type: L8 Internet Component Suite PORT 192,168,1,100,136,234 200 Port command successful. LIST 150 Opening data connection for directory list. 226 File sent ok TYPE I 200 Type set to I. PORT 192,168,1,100,217,133 200 Port command successful. STOR ms08067.py 150 Opening data connection for ms08067.py. 226 File received ok QUIT 221 Goodbye
|
PORT192,168,1,100,217,133 PORT是FTP内置控制命令,用于开启端口, 192,168,1,100表示FTP服务器IP(192.168.1.100) 217,133对应0xd9,0x85即表示端口0xd985,也就是55685. |
FTP进程操纵 |
利用上述的信息,可针对性测试FTP软件的进程与漏洞. |