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。

相关推荐
_阿南_8 小时前
Android文件读写和分享总结
android
通玄16 小时前
Jetpack Compose 入门系列(六):Navigation 3 页面导航
android
rocpp19 小时前
Android 多语言切换实战:从 Context 到 Android 13 应用语言适配
android·kotlin
释然小师弟20 小时前
Android开发十年:反思与回顾
android·后端·嵌入式
黄林晴1 天前
用了这么久 Koin Scope,原来一直都用错了?
android·kotlin
爱勇宝1 天前
我做了一个只用来搜歌词的小 App
android·前端·后端
众少成多积小致巨2 天前
JNI (Java Native Interface) 技术手册中文参考指南
android·java·c++
Coffeeee2 天前
如何使用Glide和Coil加载WebP动图
android·kotlin·glide
Kapaseker2 天前
5 分钟搞懂 Kotlin DSL
android·kotlin
恋猫de小郭2 天前
AI Agent 开发究竟是啥?如何用 AI 开发 Agent ?深入浅出给你一套概念
android·前端·ai编程