剑庭安
首页
黑客安全首页全部安全栏目 黑客技术黑客技术、渗透测试、漏洞利用工具与教程 安全软件安全工具、扫描器、检测与审计软件 病毒分析恶意软件分析、样本、逆向与沙箱 CTF思路CTF 题目、writeup、解题思路与工具 防护思路防御技术、加固、检测响应与蓝队 红蓝攻防红队攻击模拟、蓝队对抗、攻防演练 漏洞知识库漏洞、CVE、PoC、EXP 与安全研究
逆向|反编译
PHP源码PHP 网站源码、程序、系统 APP源码安卓/iOS APP 源码 ASP源码ASP 网站源码与程序 NET源码.NET 网站源码与系统 小程序源码微信/支付宝小程序源码 Dedecms风格模板Dedecms 织梦风格模板 Empirecms风格模板EmpireCMS 帝国风格模板 Discuz商业模板/插件Discuz 商业模板与插件 WordPress主题/插件WordPress 主题与插件 其它源码、模板其它各类源码与模板 游戏源码游戏源码与引擎项目 加密货币源码加密货币、区块链、钱包、USDT/比特币相关源码与工具 手游源码手机游戏源码、服务端、客户端与引擎项目 传奇源码热血传奇、传奇世界、复古传奇等客户端/服务端/引擎源码 页游源码网页游戏、H5 游戏、浏览器游戏源码 端游源码电脑单机游戏、PC 网游客户端/服务端源码
最新万能免驱动支持所有型号打印机下载程序 日历天气老黄历 · 每天同步真实日期与天气
站长工具站长工具 自助开通会员浏览该分类 其他资源qtziy SEO工具SEO工具 站群源码站群源码 泛程序泛程序 蜘蛛模板蜘蛛模板 蜘蛛池蜘蛛池 外链工具外链工具
搜索 自助开通会员🔓 破甲 API
登录 注册
首页 分类列表 黑客技术 phpggc - PHPGGC is a library…
phpggc - PHPGGC is a library of PHP unserialize() payloads 黑客技术 点击放大
作者:admin 发布:2026-10-05

phpggc - PHPGGC is a library of PHP unserialize() payloads

项目说明PHPGGC: PHP Generic Gadget Chains*PHPGGC is a library of unserialize() payloads along with a 工具 to generate them, from command line or programmati…
资源可下载 免费下载 0 条讨论
会员资源
开通会员后即可下载全部资源。
登录后开通会员
会员方案
438浏览量
0讨论
2下载链接
可下载资源状态
内容可验证
更新 2026-10-05
人工审核发布
评论区答疑

phpggc - PHPGGC is a library of PHP unserialize() payloads

项目说明

PHPGGC: PHP Generic Gadget Chains

*PHPGGC is a library of unserialize() payloads along with a 工具 to generate them, from command line or programmatically*.
When encountering an unserialize on a website you don't have the 代码 of, or simply when trying to build an exploit, this 工具 allows you to generate the payload without having to go through the tedious steps of finding gadgets and combining them. It can be seen as the equi of frohoff's ysoserial, but for PHP.
Currently, the 工具 supports gadget chains such as: CodeIgniter4, Doctrine, Drupal7, Guzzle, Laravel, Magento, Monolog, Phalcon, Podio, Slim, SwiftMailer, Symfony, Wordpress, Yii and ZendFramework.

Requirements

PHP >= 5.6 is required to run PHPGGC.

Usage

Run ./phpggc -l to obtain a list of gadget chains:

Filter gadget chains:

Every gadget chain has:

  • Name: Name of the framework/library

  • : of the 框架/library for which gadgets are for

  • Type: Type of exploitation: RCE, File Write, File Read, Include...

  • : the to trigger the chain after the unserialize (__destruct(), __toString(), offsetGet(), ...)

  • Informations: Other informations about the chain
  • Use -i to get detailed information about a chain:

    For RCE gadgets, the executed command can have 3 formatting types depending on how the gadget works:

  • RCE (Command): ./phpggc Symfony/RCE1 id

  • RCE (PHP code): ./phpggc Symfony/RCE2 'phpinfo();'

  • RCE (Function call): ./phpggc Symfony/RCE4 system id
  • Once you ha a chain, run ./phpggc <gadget-chain> [parameters] to obtain the payload.
    For instance, to obtain a payload for Monolog, you'd do:

    For a file write using SwiftMailer, you'd do:

    Wrapper

    The --wrapper (-w) option allows you to define a PHP file containing the following functions:

  • process_parameters(array $parameters): Called right before generate(), allows to change parameters

  • process_object(object $object): Called right before serialize(), allows to change the object

  • process_serialized(string $serialized): Called right after serialize(), allows to change the serialized string
  • For instance, if the 代码 looks like this:

    You could use a __toString() chain, wrapping it like so:

    And you'd call phpggc like so:

    PHAR(GGC)

    History

    At BlackHat US 2018, released PHARGGC, a fork of PHPGGC which instead of building a serialized payload, builds a whole PHAR file. This PHAR file contains serialized data and as such can be used for exploitation techniques (file_exists, fopen, etc.). The paper is here.

    Implementation

    PHAR archives come in three different formats: PHAR, TAR, and ZIP. The three of them are supported by PHPGGC.
    Polyglot files can be generated using --phar-jpeg (-pj). Other options are a (use -h).

    Examples

    Encoders

    Arguments allow to modify the way the payload is output. For instance, -u will URL encode it, and -b will convert it to base64.
    Payloads often contain NULL bytes and cannot be copy/pasted as-is. Use -s for a soft URL encode, which keeps the payload readable.

    The encoders can be chained, and as such the order is important. For instance, ./phpggc -b -u -u slim/rce1 system id will base64 the payload, then URLencode it twice.

    Ad: Enhancements

    Fast destruct

    PHPGGC implements a --fast-destruct (-f) flag, that will make sure your serialized object will be destroyed right after the unserialize() call, and not at the end of the script. I'd recommend using it for every __destruct , as it impro. For instance, if PHP script raises an exception after the call, the __destruct method of your object might not be called. As it is processed at the same time as encoders, it needs to be set first.

    ASCII Strings

    Uses the S serialization format instead of the standard s. This replaces every non-ASCII char to an hexadecimal representation:
    s:5:"A<null_byte>B<cr><lf>";̀ -> S:5:"A\00B\09\0D";
    This can be useful when for some reason non-ascii characters are not allowed (NULL BYTE for instance). Since payloads generally contain them, this makes sure that the payload consists only of ASCII .
    *Note: this is experimental and it might not work in some cases.*

    Armor Strings

    Uses the S serialization format instead of the standard s. This replaces every char to an hexadecimal representation:
    s:5:"A<null_byte>B<cr><lf>";̀ -> S:5:"\41\00\42\09\0D";
    This comes handy when a firewall or PHP 代码 blocks strings.
    *Note: this is experimental and it might not work in some cases.*
    *Note: this makes each string in the payload grow by a factor of 3.*

    Plus Numbers

    Sometimes, PHP scripts that the gi payload does not contain objects by using a regex such as /O:[0-9]+:. This is easily bypassed using O:+123:... instead of O:123:. One can use --plus-numbers <types>, or -n <types>, to automatically add these + signs in front of symbols.
    For instance, to obfuscate objects and strings, one can use: --n Os. Please note that since PHP 7.2, only i and d (float) types can have a +.

    Public Properties

    Attempts to convert references to protected or private properties within the serialized payload to public.
    This can be useful because when PHP serializes a non-public property of an object it prepends the property name with an asterisk (for protected) or the class name (for private) surrounded by null bytes, which are easy to lose if the payload is transmitted or stored as plain text without encoding. If that happens, the payload will fail to unserialize because the string length of the property name (and the name itself) will be incorrect.
    As an added bonus, payloads are slightly smaller without the prefixes. Con properties to public tends to work in more recent PHP but can cause problems in older (before PHP 7.2).
    This functionality may not work properly if a chain includes one or more objects that have a custom serialize / unserialize implementation.

    Testing your chain

    To test if the gadget chain you want to use works in the targeted en, jump to your en's folder and run the chain argument-free, with the --test-payload option.

    For instance, to test if Monolog/RCE2 works on Symfony 4.x:

    The exit code will be 0 if the payload triggered, 1 otherwise.

    Testing your chain against every of a package

    If you wish to know which of a package a gadget chain works against, you can use test-gc-compatibility.py.

    You can specify the you want to test by using the following syntaxe.

    API

    Instead of using PHPGGC as a command line 工具, you can program PHP scripts:

    This allows you to tweak the parameters or write exploits more easily.
    *Note: This is pretty experimental at the moment, so please, report bugs*.

    Contributing

    Pull requests are more than welcome. Please follow these simple guidelines:

  • __destruct() is always the best

  • Specify at least the of the library you' the payload on

  • Do not include unused parameters in the gadget definition if they keep their default . It just makes the payload bigger.

  • Respect 代码 style: for instance, opening brackets { are on a new line, and arrays should be written as [1, 2, 3] instead of the old, array(1, 2, 3), notation.
  • Codewise, the directory structure is fairly straightforward: gadgets in _gadgets.php_, description + logic in _chain.php_.
    You can define pre- and post- processing methods, if parameters need to be modified.
    Hopefully, the already implemented gadgets should be enough for you to build yours.
    Otherwise, I'd be glad to answer your questions.

    Please test as many as you can. The nomenclature for is as such: [-]<lower-> <= <higher->[+]. The - and + signs indicate that your payload may work on respectively lower and higher . For instance, if your gadget chain works from 2.0.0 to 4.4.1, which is the last at the time, use 2.0.0 <= 4.4.1+.

    The --new <framework> <type> command-line option can be used to create the directory and file structure for a new gadget chain.
    For instance, use ./phpggc -n Drupal RCE would create a new Drupal RCE gadgetchain.

    Docker

    If you don't want to install PHP, you can build a docker image using:

    You can then used the dockerized phpggc.

    To generate a gadget chain

    To test a chain

    Jump to your en's folder and run the chain argument-free, with the --test-payload option:

    To generate phar / polyglot files

    > Note: The command must be executed in the directory where the input image is located.

    To run test-gc-compatibility.py

    License

    Apache License 2.0

    项目信息

    开发语言:PHP

    Star 数:3893

    技术要点

    该项目属于黑客技术方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕PHPGGC is a library of PHP unserialize() payloads along with a 工具 to generate them, from command line or programmatically. 展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。

    从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。

    使用与学习建议

    1. 下载源码压缩包,解压到本地环境。

    2. 根据项目类型准备对应的运行环境与依赖。

    3. 按照 README 中的步骤完成配置与部署。

    4. 在隔离的测试环境中运行验证,避免影响生产系统。

    免责声明

    本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。

    资源标题phpggc - PHPGGC is a library of PHP unserialize() payloads
    所属分类黑客技术
    发布作者admin
    发布时间2026-10-05 22:11:23
    下载权限 免费下载
    附件数量2 个下载链接
    浏览次数438
    讨论数量0
    主题状态正常讨论中

    本资源免费,登录后即可在本页「下载链接」区域获取全部附件。

    请在评论区留言说明具体链接,或联系作者补档。楼主更新后本页会同步最新的下载地址。

    请先阅读正文中的授权说明;未注明的默认仅限站内学习交流,禁止直接搬运到其他站点二次售卖。
    还没有讨论,快来抢沙发~
    登录 后才能参与讨论
    下载链接
    会员才能下载
    登录后开通会员
    同分类推荐
    暂无同类资源
    免费登录即可下载
    查看会员
    放大预览

    © 2026 剑庭安 - 网站开发定制 SEO 优化蜘蛛池代做 在线看手相算命. 保留所有权利。

    Powered by 酷像SEOv3.0

    网站地图 Sitemap.xml
    首页 全部分类 黑客安全 逆向|反编译 精品源码 站长工具自助开通会员其他资源SEO工具站群源码泛程序蜘蛛模板蜘蛛池外链工具创意乐园 搜索 会员服务 登录 注册