Skip to content
XSS Write-up Intermediate

Lazy Load stored XSS

The Lazy Load WordPress plugin used a regular expression to rewrite image tags, which could be tricked into generating extra HTML attributes. A user with post editing rights could inject JavaScript that would run when an administrator viewed the post, potentially leading to privilege escalation and server-side code execution.

klikki Follow

Published on klikki.fi

Lazy Load is a WordPress plugin with over 90,000 active installs. It was developed by Automattic, TechCrunch, and 10up LLC.

klikki, on klikki.fi

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

Likely the regular expression used to rewrite image tags did not properly validate or escape attribute values, allowing injected attributes to become part of the generated HTML.

Impact

An attacker with post editing rights could execute JavaScript in an administrator's browser, potentially leading to server-side code execution via plugin or theme editors; however, the bug required authentication and was not exploitable without it.

What the attacker needed

WordPress site with Lazy Load plugin; Attacker has Contributor or higher role; Victim views the crafted post

How it was found

  1. Create or edit a WordPress post or page containing a specially formatted image tag.
  2. The Lazy Load plugin processes the post content with its regular expression.
  3. The crafted tag causes an onerror attribute to be included in the generated HTML.
  4. When the post is viewed, the injected JavaScript executes in the viewer's browser.

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.

The plugin tried to find image tags in a post and change them so images load later. But its pattern-matching was too loose, so a crafted image tag could sneak in extra code that runs in a visitor's browser. This is called cross-site scripting (XSS): an attacker's code runs as if it came from the trusted site.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by klikki

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.