在exp-db上面看到的漏洞,这是原文链接:https://www.exploit-db.com/exploits/38407/

但是POC给的很简单,这是原来的描述:

"

The application allows users to upgrade their own profile. The user has
the possibility to add a new photo as attachment.

The photo that he uploads will be stored into "GLPI_ROOT/files/_pictures/".

This file, for example named "photo.jpeg", will be directly accessible
through "http://host/GLPI_ROOT/files/_pictures/XXXX.jpeg", where "XXXX"
is an ID automatically generated by the system and visible in the HTML
source code.

Besides, the server does not check the extension of the uploaded file,
but only the first bytes within it, that indicates which kind of file is.

Exploiting this flaw, an attacker may upload a tampered jpeg file that
contains php code placed at the end of the file, so that, just changing
the file extention to ".php", by default the php code will be interpreted!
 
To trigger this vulnerability it is necessary to have an account.

This vulnerability is a combination of two issues:
- predictable uploaded file names and path
- upload of any kind of file, not limited to images

"

大概意思就是说对上传的文件不检查后缀,只检查文件内容的前一个字节,如果判定是合法内容就会上传,利用方式就是在一个正常的图片文件后面加入PHP代码即可,而且路径也好找。

本着要对漏洞形成原因知根知底的态度,还是需要看看源码的,问题是在./inc/user.class.php中

关键代码如下:

 // Move uploaded file
$filename = $this->fields['id'];
$tmp = explode(".", $_FILES['picture']['name']);
$extension = array_pop($tmp); //获取原始文件的后缀
$picture_path = GLPI_PICTURE_DIR."/$filename.".$extension; //直接拼接原来的后缀
self::dropPictureFiles($filename.".".$extension);

也不知道是开发人员忘了处理后缀还是怎么回事,估计也有可能是想对图片内容做二次渲染,所以就算是原来的后缀也可以不尿恶意攻击者,然而开发者忘了?
总之上传洞就这么产生了~~

GLPI 0.85.5 上传漏洞分析的更多相关文章

  1. 【代码审计】JTBC(CMS)_PHP_v3.0 任意文件上传漏洞分析

      0x00 环境准备 JTBC(CMS)官网:http://www.jtbc.cn 网站源码版本:JTBC_CMS_PHP(3.0) 企业版 程序源码下载:http://download.jtbc. ...

  2. PHPCMS v9.6.0 任意文件上传漏洞分析

    引用源:http://paper.seebug.org/273/ 配置了php debug的环境,并且根据这篇文章把流程走了一遍,对phpstorm的debug熟练度+1(跟pycharm一样) 用户 ...

  3. 1.5 webshell文件上传漏洞分析溯源(1~4)

    webshell文件上传漏洞分析溯源(第一题) 我们先来看基础页面: 先上传1.php ---->   ,好吧意料之中 上传1.png  ---->   我们查看页面元素 -----> ...

  4. phpcms v9.6.0任意文件上传漏洞(CVE-2018-14399)

    phpcms v9.6.0任意文件上传漏洞(CVE-2018-14399) 一.漏洞描述 PHPCMS 9.6.0版本中的libs/classes/attachment.class.php文件存在漏洞 ...

  5. 【代码审计】UKCMS_v1.1.0 文件上传漏洞分析

      0x00 环境准备 ukcms官网:https://www.ukcms.com/ 程序源码下载:http://down.ukcms.com/down.php?v=1.1.0 测试网站首页: 0x0 ...

  6. 【代码审计】QYKCMS_v4.3.2 任意文件上传漏洞分析

      0x00 环境准备 QYKCMS官网:http://www.qykcms.com/ 网站源码版本:QYKCMS_v4.3.2(企业站主题) 程序源码下载:http://bbs.qingyunke. ...

  7. 【代码审计】BootCMS v1.1.3 文件上传漏洞分析

      0x00 环境准备 BootCMS官网:http://www.kilofox.net 网站源码版本:BootCMS v1.1.3  发布日期:2016年10月17日 程序源码下载:http://w ...

  8. 【代码审计】CLTPHP_v5.5.3 前台任意文件上传漏洞分析

      0x00 环境准备 CLTPHP官网:http://www.cltphp.com 网站源码版本:CLTPHP内容管理系统5.5.3版本 程序源码下载:https://gitee.com/chich ...

  9. UEditor编辑器两个版本任意文件上传漏洞分析

    0x01 前言 UEditor是由百度WEB前端研发部开发的所见即所得的开源富文本编辑器,具有轻量.可定制.用户体验优秀等特点 ,被广大WEB应用程序所使用:本次爆出的高危漏洞属于.NET版本,其它的 ...

随机推荐

  1. mnist数据集下载

    http://yann.lecun.com/exdb/mnist/ THE MNIST DATABASE of handwritten digitsYann LeCun, Courant Instit ...

  2. Office 2019 for Mac(office办公套件) v16.34中文版

    Microsoft Office 2019 Mac中文版下载​是微软在Mac发行的Office办公软件套件.包含了新版本的Word.Excel.PowerPoint以及现有的OneNote和Outlo ...

  3. 37)智能指针(就是自动delete空间)

    1)问题引入: 在java或者在C++中,一旦你new一个东西,那么必然有一个delete与之对应,比如: int main() { int* p= new int(): *p=: delete p: ...

  4. Nginx_配置文件解读及模板

    Nginx 介绍 # nginx的最大优势在于处理静态文件和代理转发功能,支持7层负载均衡和故障隔离. 动静分离是每个网站发展到一定规模之后必然的结果.静态请求则应当最好将其拆分,并启用独立的域名,既 ...

  5. [LC] 1007. Minimum Domino Rotations For Equal Row

    In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino.  (A domi ...

  6. Python练习四-浅拷贝&深拷贝

    一.数字.字符串不论是浅拷贝.深拷贝都是指向一个地址. a = 1 b = "abc" print (id(a)) print (id(b)) a1 = a b1 = b prin ...

  7. 分布式锁 -- Java常用技术方案

    来自博客园http://www.cnblogs.com/PurpleDream/p/5559352.html , 前言:       由于在平时的工作中,线上服务器是分布式多台部署的,经常会面临解决分 ...

  8. Python的range(n)的用法

    Python的range(n) 方法就是: API定义: If you do need to iterate(迭代) over a sequence(一系列) of numbers, the buil ...

  9. z-index优先级小结

    z-index是深度属性,设置元素在z轴上面的堆叠顺序. 强调:z-index必须和定位元素position:absollute|relative|fixed一起使用,否则无效 1.z-index属性 ...

  10. [LC] 256. Paint House

    There are a row of n houses, each house can be painted with one of the three colors: red, blue or gr ...