CTF知识点总结(一)

​ 此题所用知识为超全局变量,只需要将传入的参数设置为$GLOBALS即可。

1 |1 PHP 全局变量 - 超全局变量

PHP 中的许多预定义变量都是"超全局的",这意味着它们在一个脚本的全部作用域中都可用。在函数或方法中无需执行 global $variable; 就可以访问它们。

这些超全局变量是:

  • $GLOBALS
  • $_SERVER
  • $_REQUEST
  • $_POST
  • $_GET
  • $_FILES
  • $_ENV
  • $_COOKIE
  • $_SESSION

2 |0 2.php的弱类型比较问题

​ 详见https://www.cnblogs.com/Mrsm1th/p/6745532.html

3 |0 3.php断言(assert)

​ 详见https://www.cnblogs.com/nixi8/p/7147122.html

4 |0 4.php读取目录下文件的方法

​ scandir():读取文件和目录,以数组形式存储

​ print_r():输出

复制代码

<?php dir = "/images/"; // Sort in ascending order - this is default a = scandir(dir); // Sort in descending order b = scandir(dir,1); print_r(a); print_r($b); ?>

结果:

复制代码

Array ( 0 => . 1 => .. 2 => cat.gif 3 => dog.gif 4 => horse.gif 5 => myimages ) Array ( 0 => myimages 1 => horse.gif 2 => dog.gif 3 => cat.gif 4 => .. 5 => . )

5 |0 5.preg_match绕过

​ preg_match用于执行正则匹配。详情见https://www.codercto.com/courses/d/852.html。返回 pattern 的匹配次数。 它的值将是 0 次(不匹配)或 1 次,因为 preg_match() 在第一次匹配后 将会停止搜索。preg_match_all() 不同于此,它会一直搜索subject 直到到达结尾。 如果发生错误preg_match()返回 FALSE。

5 |1 另外有正则表达式语法:

6 |0 6.PHP中sha1()函数和md5()函数的绕过

复制代码

sha1(_GET\['name'\]) === sha1(_GET'password')

这两个函数比较时,由于无法处理数组,两边都会返回false,则相等,所以playload为?name\[\]=1&password\[\]=2。

相关推荐
mmsx2 分钟前
Android 手簿 ADB 无线调试全攻略:USB 转 WiFi 一键连接
android·前端
律宏阔34 分钟前
Android WebRTC + H.265 适配记录
android
mmsx41 分钟前
MapLibre 实战 08|GPS 点漂了几百米才被发现:GCJ-02 纠偏原理与"转两次"陷阱
android·前端
春夏与冬41 分钟前
Android : apktool
android
YF021142 分钟前
如何验证App预置为特权App功能正常?
android
律宏阔1 小时前
两台 Android 开发板的硬件序列号完全相同,如何使用 ADB 连接其中的一台?
android
律宏阔1 小时前
用 KSP + Hilt 自动注入 Android ViewBinding
android
AI2中文网2 小时前
Ai2 Starter 新版上线:Android 15、Hyper-V 与更快的模拟器体验
android
挂科边缘2 小时前
Android Studio 保姆级安装教程,Windows 电脑上安装 Android Studio
android·windows·android studio
Danny_姜3 小时前
Android Studio Quail 4 稳定版发布:本地 Gemma 4 + Android Skills
android·ide·android studio