HTB_Cat(思路)

admin 2025年2月7日02:46:18评论12 views字数 1429阅读4分45秒阅读模式

HTB_cat

linux(Med)

总结

user.txt:

代码审计(xss反弹cookie->sql盲注)

root.txt:

端口转发->敏感文件内容泄露->gitea-xss

由于session容易失效,且sqlmap爆破有点慢,所以最好弄个python脚本自动化完成这部分(xss->文件上传->sqlmap)

后台的py是这样的,尝试提取邮件文件中的url,并访问

...
deflogin_and_navigate_urls():
    driver.delete_all_cookies()
    wait = WebDriverWait(driver, 10)
    login_url = "http://localhost:3000/user/login"
    url_pattern = r'(https?://[^s]+)'
    urls = []

try:
withopen('/var/mail/jobert''r'as mail_file:
for line in mail_file:
                found_urls = re.findall(url_pattern, line)
                urls.extend(found_urls)
print(found_urls)
except FileNotFoundError:
pass

   ...
for url in urls:
try:
            driver.get(url)
            wait.until(EC.presence_of_element_located((By.TAG_NAME, "body")))
            sleep(5)
            wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, ".repo-description > a"))).click()
            sleep(5)
except Exception as e:
print(e)

参考

wp: Ne_O师傅

https://github.com/arthaud/git-dumper

pip install git-dumper

https://www.exploit-db.com/exploits/52077

## Steps to Reproduce
1. Log in to the application.
2. Create a new repository or modify an existing repository by clicking the Settings button from the `$username/$repo_name/settings` endpoint.
3. In the Description field, input the following payload:

    <a href=javascript:alert()>XSS test</a>

4. Save the changes.
5. Upon clicking the repository description, the payload was successfully injected in the Description field. By clicking on the message, an alert box will appear, indicating the execution of the injected script.

原文始发于微信公众号(羽泪云小栈):HTB_Cat(思路)

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年2月7日02:46:18
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HTB_Cat(思路)http://cn-sec.com/archives/3706953.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息