DOM Order Manipulation Hijacks ChatGPT Entity Extraction
To exploit "lazy" LLM retrieval patterns, I test conflicting variables by altering their DOM hierarchy, reveals Ted Kubaitis.
I defined x=4 within standard HTML content, followed immediately by a JavaScript block setting the same variable to x=3.
When prompted, ChatGPT extracted the content value (4).
By reversing the structural sequence—injecting the JavaScript block above the HTML content—I forced the model to switch its output to the script's value (3).
This structural loophole proves generative models default to the first encountered entity in the source code, terminating their search upon finding an initial viable match.
To weaponize this vulnerability for AI Overviews, one could inject JSON-LD schema containing targeted or contrary facts high in the <head>, forcing the LLM parser to prioritize the hidden script payload over the visible on-page content below it.