Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmikan committed Jul 15, 2019
1 parent 99a497e commit f5b480f
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion source/language/php/unserialize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ php在反序列化的时候会调用 ``__wakeup`` / ``__sleep`` 等函数,可

::

``unserialize('O:7:"HITCON":1:{s:4:"data";s:15:"malicious value";}');``
unserialize('O:7:"HITCON":1:{s:4:"data";s:15:"malicious value";}');

输出

Expand Down
2 changes: 1 addition & 1 deletion source/vuln/cmdinjection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Java
黑名单绕过
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``a=l;b=s;$a$b``
- base64 `` `echo "bHM=" | base64 -d ` ``
- base64 ``echo "bHM=" | base64 -d``
- ``/?in/?s`` => ``/bin/ls``
- 连接符 ``cat /etc/pass'w'd``
- 未定义的初始化变量 ``cat$x /etc/passwd``
Expand Down
2 changes: 1 addition & 1 deletion source/vuln/sql/cheatsheet/mssql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SQL Server Payload
- Command
- ``EXEC xp_cmdshell 'net user'``
- Ascii
- ``SELECT char(0×41)``
- ``SELECT char(0x41)``
- ``SELECT ascii('A')``
- ``SELECT char(65)+char(66)`` => return ``AB``
- Delay
Expand Down
6 changes: 3 additions & 3 deletions source/vuln/sql/cheatsheet/mysql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ MySQL Payload
- If
- ``SELECT if(1=1,'foo','bar');`` return 'foo'
- Ascii
- ``SELECT char(0×41)``
- ``SELECT char(0x41)``
- ``SELECT ascii('A')``
- ``SELECT 0×414243`` => return ``ABC``
- ``SELECT 0x414243`` => return ``ABC``
- Delay
- ``sleep(1)``
- ``SELECT BENCHMARK(1000000,MD5('A'))``
- Read File
- ``select @@datadir``
- ``select load_file('databasename/tablename.MYD')``
- Blind
- ``ascii(subtring(str,pos,length)) & 32 == 1``
- ``ascii(substring(str,pos,length)) & 32 = 1``
- Error Based
- ``select count(*),(floor(rand(0)*2))x from information_schema.tables group by x;``
- Write File
Expand Down
2 changes: 1 addition & 1 deletion source/vuln/sql/cheatsheet/psql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PostgresSQL Payload
- List Database
- ``SELECT datname FROM pg_database``
- Ascii
- ``SELECT char(0×41)``
- ``SELECT char(0x41)``
- ``SELECT ascii('A')``
- Delay
- ``pg_sleep(1)``
5 changes: 2 additions & 3 deletions source/vuln/sql/dbident.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ MySQL
- benchmark ``BENCHMARK(5000000, MD5('test'))``
- 字符串连接
- ``SELECT 'a' 'b'``
- ``SELECT 'some'+'string'``
- ``SELECT CONCTA('some','string')``
- ``SELECT CONCAT('some','string')``
- version
- ``SELECT @@version``
- ``SELECT version()``
Expand All @@ -21,7 +20,7 @@ Oracle
--------------------------------
- 字符串连接
- ``'a'||'oracle' --``
- ``SELECT CONCTA('some','string')``
- ``SELECT CONCAT('some','string')``
- version
- ``SELECT banner FROM v$version``
- ``SELECT banner FROM v$version WHERE rownum=1``
Expand Down
4 changes: 2 additions & 2 deletions source/vuln/sql/fuzz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
常见的注入点
--------------------------------------
- GET/POST/PUT/DELETE参数
- X-Forward
- X-Forwarded-For
- 文件名

Fuzz注入点
Expand Down Expand Up @@ -39,7 +39,7 @@ Fuzz注入点
报错注入
--------------------------------------
- ``select 1/0``
- ``select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a``
- ``select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a``
- ``extractvalue(1, concat(0x5c,(select user())))``
- ``updatexml(0x3a,concat(1,(select user())),1)``
- ``exp(~(SELECT * from(select user())a))``
Expand Down
2 changes: 1 addition & 1 deletion source/vuln/sql/tricks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SQL注入小技巧

漏洞发生的原因是执行了 ``set character_set_client = 'gbk';`` 之后,mysql就会认为客户端传过来的数据是gbk编码的,从而使用gbk去解码,而mysql_real_escape是在解码前执行的。但是直接用 ``set names 'gbk'`` 的话real_escape是不知道设置的数据的编码的,就会加 ``%5c`` 。此时server拿到数据解码 就认为提交的字符+%5c是gbk的一个字符,这样就产生漏洞了。

解决的办法有三种,第一种是把client的charset设置为binary,就不会做一次解码的操作。第二种是是 ``mysql_set_charset('gbk')`` ,这里就会把编码的信息保存在和数据库的连接里面,就不会出现这个问题了
解决的办法有三种,第一种是把client的charset设置为binary,就不会做一次解码的操作。第二种是是 ``mysql_set_charset('gbk')`` ,这里就会把编码的信息保存在和数据库的连接里面,就不会出现这个问题了
第三种就是用pdo。

还有一些其他的编码技巧,比如latin会弃掉无效的unicode,那么admin%32在代码里面不等于admin,在数据库比较会等于admin。
2 changes: 1 addition & 1 deletion source/vuln/webcache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Web cache攻击类似于RPO相对路径重写攻击,都依赖于浏览器与
漏洞要存在,至少需要满足下面两个条件:

1. web cache功能根据扩展进行保存,并忽略caching header;
2. 当访问如 ``http://www.examplecom/home.php/non-existent.css`` 不存在的页面,会返回 ``home.php`` 的内容。
2. 当访问如 ``http://www.example.com/home.php/non-existent.css`` 不存在的页面,会返回 ``home.php`` 的内容。

漏洞防御
--------------------------------
Expand Down
2 changes: 0 additions & 2 deletions source/vuln/xss/payload.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ Payload
- ``<script>alert('1')</script>``
- ``<script>alert("1")</script>``
- ``<script>alert`1`</script>``
- ``<script>alert(1)</script>``
- ``<script>alert(1)</script>``
- ``<script>(alert)(1)</script>``
- ``<script>a=alert,a(1)</script>``
- ``<script>[1].find(alert)</script>``
Expand Down
4 changes: 2 additions & 2 deletions source/vuln/xss/sop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ CORS是一个W3C标准,全称是"跨域资源共享"(Cross-origin resource s

阻止跨源访问
----------------------------------------
阻止跨域写操作,可以检测请求中的 ``CSRF toke`` ,这个标记被称为Cross-Site Request Forgery (CSRF) 标记。
阻止跨域写操作,可以检测请求中的 ``CSRF token`` ,这个标记被称为Cross-Site Request Forgery (CSRF) 标记。

阻止资源的跨站读取,因为嵌入资源通常会暴露信息,需要保证资源是不可嵌入的。但是多数情况下浏览器都不会遵守 ``Conten-Type`` 消息头。例如如果在HTML文档中指定 ``<script>`` 标记,则浏览器会尝试将HTML解析为JavaScript。
阻止资源的跨站读取,因为嵌入资源通常会暴露信息,需要保证资源是不可嵌入的。但是多数情况下浏览器都不会遵守 ``Content-Type`` 消息头。例如如果在HTML文档中指定 ``<script>`` 标记,则浏览器会尝试将HTML解析为JavaScript。

0 comments on commit f5b480f

Please sign in to comment.