When Helpful Becomes Harmful: The Security Flaw in Lenovo’s Cha
Lenovo's GPT-4 support chatbot, Lena, could be prompted to include raw HTML with an event handler in its reply, and the support agent console rendered that reply without escaping it. An attacker could therefore store script in a chat history that ran in an agent's browser and sent the agent's session cookies to the attacker.
Published on medium.com
AI is steadily creeping into every corner of customer support. Companies see it as a way to cut costs, resolve issues faster and reduce the pressure on human agents.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The support console rendered the chatbot's output as HTML without sanitising or escaping it, and no restrictive Content Security Policy limited the injected script.
Impact
Stolen cookies could let an attacker act as a support agent, reach customer and device data, and use agent tools that reset accounts or issue refunds, potentially pivoting further into Lenovo's systems.
What the attacker needed
Attacker can send a support chat prompt; model follows HTML formatting instructions; agent opens the stored chat history
The fix
The chatbot's output should be escaped or sanitised before rendering, treated as untrusted input, and backed by a strict Content Security Policy; the text says Lenovo rolled out mitigations after the report.
How it was found
- The attacker sends a support prompt that mixes a normal question with instructions to answer in HTML containing an image tag with an error handler.
- The model follows the formatting instructions and returns raw HTML in its reply.
- The reply is saved as part of the support conversation in Lenovo's system.
- A support agent opens the chat history in a browser.
- The console renders the stored HTML without escaping it, so the browser runs the attacker's script.
- The script sends the agent's session cookies to the attacker's server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A chatbot reply is just text, but if a web page drops that text into the page without cleaning it first, the browser treats any HTML or script inside it as real page code. Here the support console did exactly that, so a crafted chat message could run code in a support worker's browser and steal their login session. The lesson is that anything a user or a model produces must be treated as untrusted before it is shown.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.