ipfs / community

Discussion and documentation on community practices
https://docs.ipfs.tech/community/
MIT License
417 stars 226 forks source link

IPFS allows malicious SVG file upload #782

Closed K0RSHAK closed 2 months ago

K0RSHAK commented 2 months ago

Description

During testing [REDACTED] dApp that uses IPFS for storing NFT files it was possible to upload an SVG file with JavaScript inside and perform the XSS attack. Moreover I was able to rewrite uploaded file with the HTML file, including JavaScript code inside.

CVSS: 4.6 Medium AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N Env: Ghostnet

Impact

Uploading and hosting an SVG file containing malicious code could lead to various attacks, including:

Evidence

image Link to check the PoC: https://ipfs.io/ipfs/QmVFs5oNkZVe4EaXkCL8xZn29ziicYnu9KbNdojT8RU59W Payload: SVG+XML

<svg xmlns="http://www.w3.org/2000/svg" onload="<WHAT_EVER_FUNCTION_HERE>">
  <text x="10" y="50" font-size="30">XSS PoC</text>
</svg>

HTML

<script>alert('PWND')</script>

Suggestions

lidel commented 2 months ago

@K0RSHAK i'm closing this, hopefully the above will point you in the right place to discuss further. in the future or if you still want to report a security issue, please follow https://github.com/ipfs/community/blob/master/SECURITY.md with responsible disclosure sensibility (not posting on public forums).