Feat/security markdown audit#2
Open
louis14448 wants to merge 7 commits into
Open
Conversation
…LE — gnolang/gno#5714) Adds 4 shell scripts under tests/samourai-crew/security-markdown/ that each deploy a minimal Gno realm, inject a malicious markdown payload, and verify that Render() returns the content unsanitised (exit 1 = KNOWN VULNERABLE on current master, regression tests for when gnolang/gno#5714 lands). Vectors: title leak into body, raw HTML injection, link URL hijacking, blockquote context confusion.
…ection (interrealm #5669 compat)
… MsgCall compat (#5669)
…fix title injection - Add audit_md_anchor_hijack.sh: fragment ID hijacking via duplicate heading - Add audit_md_image_tracking.sh: external tracking pixel injection - Translate all scripts and realm code from French to English - Fix audit_md_title_leak.sh: use printf to pass real newlines to gnokey args (shell double-quotes kept \n literal, causing false positive detection) - All scripts target gnolang/gno#5714
…acking requires gnoweb, not testable at VM level
… bump funding to 150M
a56ff8b to
2672023
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR — Security audit: markdown injection in Render()
Context
Following the discussion around gnolang/gno#5714:
the
moul/mdhelpers do not sanitize user input. An attacker can inject arbitrary markdowninto any user-controlled field stored by a realm, and that content is returned verbatim by
Render()— which gnoweb renders as HTML in the browser.These scripts document 5 attack vectors, all KNOWN VULNERABLE on current master.
They are intended as regression tests: once the upstream fix from #5714 is merged, all scripts
should exit 0 without modification.
Branch
Directory
Not a standalone contributor — no Makefile/Dockerfile. Scripts are called from
run_tests.shinside
samourai-crew, reusing existing wallets and funding.Vectors
Vector 1 — Title leak into body (
audit_md_title_leak.sh)Scenario: A DAO proposal realm stores a user-controlled title and prepends
#inRender().An attacker injects newlines and a new heading into the title — voters see a fake page structure.
Detection:
Render()contains# INJECTEDas a separate heading →VULNERABLEFix note: Uses
printfto pass real newlines tognokey -args— shell double-quotes keep\nliteral, which would produce a false positive without this.Vector 2 — Raw HTML injection (
audit_md_html_inject.sh)Scenario: A forum realm returns user post content directly from
Render(). An attackerinserts raw HTML tags that may be rendered by the browser.
Detection:
Render()contains<b>ADMINunescaped →VULNERABLENote: gnoweb currently escapes raw HTML tags (renders
<b>), but the vulnerabilityexists at the VM level — any client that does not escape will be affected.
Vector 3 — Link URL hijacking (
audit_md_link_hijack.sh)Scenario: A realm stores a user message containing a markdown link. The display text
mimics an official gno.land URL while the
hrefpoints to a phishing site.Detection:
Render()containsphishing.example.com→VULNERABLEVector 4 — Blockquote context confusion (
audit_md_blockquote.sh)Scenario: A comment realm renders user posts inline in
Render(). An attacker formatsa comment as a blockquote to visually impersonate an official core-team endorsement.
Detection:
Render()contains@core-teaminside a blockquote →VULNERABLEVector 5 — External image tracking pixel (
audit_md_image_tracking.sh)Scenario: An attacker embeds an external image URL in a realm. Every gnoweb visitor's
browser loads the external resource, deanonymizing viewers via IP logging. If gnoweb ever
fetches images server-side, this also becomes an SSRF vector.
Detection:
Render()containsattacker.example.com→VULNERABLEDetection pattern
All scripts follow the same structure:
Detection is VM-only (
vm/qeval). Gnoweb rendering is not asserted — the vulnerabilitylives at the realm level regardless of the consumer.