Skip to content
XSS Write-up Advanced

Ocean Protocol

The Ocean Protocol marketplace used a Next.js image optimisation endpoint vulnerable to XSS via SVG, and an attacker could create an NFT whose download link pointed to a malicious provider that redirected to this XSS. This allowed execution of JavaScript in the marketplace origin, which could reuse a stored WalletConnect session to submit malicious transactions to the victim's connected wallet.

mirror.xyz

Published on mirror.xyz

This is a bug which made me to dive deep into Solidity code. It was accepted and I even got paid, but waaay lower than I expected - I honestly considered it as a critical.

The author, on mirror.xyz

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 Next.js image optimisation endpoint failed to properly sanitise SVG content, allowing script execution, and the marketplace allowed arbitrary provider URLs in NFTs without validating the download redirect.

Impact

An attacker could execute JavaScript in the marketplace origin and reuse the victim's WalletConnect session to submit malicious transactions to their connected wallet, though the report was marked out of scope because the vulnerable image endpoint belonged to a SaaS deployment rather than the project's source code.

What the attacker needed

Victim has a WalletConnect session; victim clicks a download link; attacker can create an NFT with a custom provider

The fix

The report does not state a fix; the issue was closed as out of scope because the vulnerable component was part of a SaaS deployment, not the project's code.

How it was found

  1. Create an NFT with a provider URL pointing to an attacker-controlled server.
  2. The attacker server responds to the download API with a redirect to the vulnerable Next.js image endpoint hosting a malicious SVG.
  3. The victim clicks the download button, causing the browser to follow the redirect and execute the SVG's JavaScript in the marketplace origin.
  4. The JavaScript reads the WalletConnect session from localStorage and initiates a malicious signature request.
  5. The script triggers a broken download and navigates back to make the attack less noticeable.

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 marketplace had a feature that displayed images from other servers. A known bug in the image tool let a malicious SVG image run JavaScript in the marketplace's own page. The attacker could also make a fake data provider that redirected the download button to that malicious image, so when a victim clicked download, the attacker's code ran and could use the victim's already-connected crypto wallet to sign transactions.

What is XSS?

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

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.