在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. Ubuntu下安装Docker,及Docker的一些常用命令操作

    1.什么是 Docker         Docker 是一个开源项目,Docker 项目的目标是实现轻量级的操作系统虚拟化解决方案.         Docker 的基础是 Linux 容器(LXC ...

  2. [Algo] 625. Longest subarray contains only 1s

    Given an array of integers that contains only 0s and 1s and a positive integer k, you can flip at mo ...

  3. 第04项目:淘淘商城(SpringMVC+Spring+Mybatis)【第七天】(redis缓存)

    https://pan.baidu.com/s/1bptYGAb#list/path=%2F&parentPath=%2Fsharelink389619878-229862621083040 ...

  4. LeetCode No.154,155,156

    No.154 FindMin 寻找旋转排序数组中的最小值 II 题目 假设按照升序排序的数组在预先未知的某个点上进行了旋转. ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7 ...

  5. Java中使用PrepateStatement并且like模糊查询

    在使用PreparedStatement进行模糊查询的时候废了一番周折,以前一直都没有注意这个问题.一般情况下我们进行精确查询,sql语句类似:select * from table where na ...

  6. idea 项目 版本控制文件

  7. 关于VLC无法播放rtsp的问题分析

    我之前有一篇博客说,怎么通过vlc查日志,方法不知道是不是特别好,传送门:https://www.cnblogs.com/132818Creator/p/11136714.html 虽然在调试窗口上提 ...

  8. python之处理json字符串

    一.如何从文件中读取json字符串 通过json模块可以处理json数据. 1.loads()方法 loads(json_object)将json字符串转换成dict类型. import json # ...

  9. Java发送邮箱

    smtp与pop3 SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议 SMTP 服务器就是遵循 SMTP 协议的发送邮件服务器 POP3是Post Office ...

  10. 成为一名PHP专家其实并不难

    本文作者Bruno Skvorc是一名资深的Web开发者.在这篇文章里主要是讲述成为一名专业的PHP专家所要经历的过程,以及在这个过程里要如何学习掌握技巧和对工具的舍取.(以下为编译内容) 当阅读各种 ...