在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. typescript-学习使用ts-2

    解构赋值 数组解构 let input = [1, 2]; let [first, second] = input; console.log(first); // outputs 1 console. ...

  2. 学习spring第二天

    Spring第二天笔记 1. 使用注解配置Spring入门 1.1. 说在前面 学习基于注解的IoC配置,大家脑海里首先得有一个认知,即注解配置和xml配置要实现的功能都是一样的,都是要降低程序间的耦 ...

  3. You are attempting to install the android sdk inside your android studio installation

    原因 我的android studio文件名为AndroidStudio 我的android studio sdk文件名为AndroidStudioSDK 所以系统把AndroidStudioSDK自 ...

  4. Windows Server 2008 R2 安全加固

    0x00 简介 安全加固是企业安全中及其重要的一环,其主要内容包括账号安全.认证授权.协议安全.审计安全四项,这篇博客简单整理一下Windows Server 2008 R2的安全加固方案. 0x01 ...

  5. [LC] 767. Reorganize String

    Given a string S, check if the letters can be rearranged so that two characters that are adjacent to ...

  6. PAT甲级——1008 Elevator

    PATA1008 Elevator The highest building in our city has only one elevator. A request list is made up ...

  7. CentOS6与CentOS7的网络区别

    回顾:物理层 关注的是接口物理特性,传输介质数据链路层 MAC地址,数据帧,以太网,交换机网络层 IP地址,数据包,IP\ICMP\ARP协议,路由器传输层 TCP.UDP,端口号,数据段应用层 HT ...

  8. built?

    题目描述 There are N towns on a plane. The i-th town is located at the coordinates (xi,yi). There may be ...

  9. 常用的GIT

    # 初始化相关 git init git add . git commit -m "test001" git remote origin https://github.com/fa ...

  10. django框架基础-ORM基础-长期维护

    ###############    ORM介绍  ################ """ ORM简介: ORM 全拼Object-Relation Mapping. ...