Skip to content

HTML Injection vulnerability in check-code pages using dangerouslySetInnerHTML #23294

@lyzno1

Description

@lyzno1

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

main

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Navigate to any check-code page with malicious email parameter:
    http://localhost:3000/signin/[email protected]<script>alert('XSS')</script>
    
  2. Observe the page rendering behavior

Expected Behavior

The email address should be displayed as plain text with HTML tags visible as literal characters:

We send a verification code to [email protected]<script>alert('XSS')</script>

✔️ Expected Behavior

The email address should be displayed as plain text with HTML tags visible as literal characters:

We send a verification code to [email protected]<script>alert('XSS')</script>

❌ Actual Behavior

Code-level vulnerability exists: The application uses dangerouslySetInnerHTML with unvalidated user input from URL parameters:

<span dangerouslySetInnerHTML={{ __html: t('login.checkCode.tips', { email }) as string }}></span>

Where email comes directly from:

const email = decodeURIComponent(searchParams.get('email') as string)

Metadata

Metadata

Assignees

Labels

🐞 bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions