Skip to content

Escape reflected XSS image src input at level 1 - #223

Open
r1kka6 wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
r1kka6:fix/xss-img-attr-level-1
Open

r1kka6 wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
r1kka6:fix/xss-img-attr-level-1

Conversation

@r1kka6

@r1kka6 r1kka6 commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • quote the Level 1 src attribute before rendering attacker-controlled input
  • HTML-escape reflected image paths so quote characters cannot break out into event handler attributes
  • keep benign image paths rendering unchanged

Verification

  • ./gradlew compileJava test spotlessJavaCheck bootJar --no-daemon passed in an eclipse-temurin:17-jdk container
  • vulnerable baseline returns <img src=x onerror=alert(1) width="400" height="300"/> for src=x onerror=alert(1)
  • patched runtime returns <img src="x onerror=alert(1)" width="400" height="300"/> and escapes quote breakout payloads as &quot;

Signed-off-by: snow <snow@snows-MacBook-Pro-2.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant