File Inclusion
下表显示了哪些函数可以执行文件以及哪些函数只能读取文件内容:
功能 | 阅读内容 | 执行 | 远程 URL |
---|---|---|---|
PHP | |||
include() /include_once() |
✅ | ✅ | ✅ |
require() /require_once() |
✅ | ✅ | ❌ |
file_get_contents() |
✅ | ❌ | ✅ |
fopen() /file() |
✅ | ❌ | ❌ |
NodeJS | |||
fs.readFile() |
✅ | ❌ | ❌ |
fs.sendFile() |
✅ | ❌ | ❌ |
res.render() |
✅ | ✅ | ❌ |
Java | |||
include |
✅ | ❌ | ❌ |
import |
✅ | ✅ | ✅ |
.NET | |||
@Html.Partial() |
✅ | ❌ | ❌ |
@Html.RemotePartial() |
✅ | ❌ | ✅ |
Response.WriteFile() |
✅ | ❌ | ❌ |
include |
✅ | ✅ | ✅ |
常见可读文件C:\Windows\boot.ini
和 /etc/passwd
,结合FUZZ技术测试。
Baisc bypass
双写
针对 LFI 的最基本过滤器之一是搜索和替换过滤器,它只是删除 ( ../
) 的子字符串以避免路径遍历(非递归)。
1 | $point = str_replace('../', '', $_GET['point']); |
1 | ....// |