idrsdev / agile-board

Bring all your tasks, teams, and tools together in one centralized platform! Open to contributions⭐ Raise a PR⚡! You can view API Docs Here
https://idrsdev.github.io/agile-board/
Apache License 2.0
5 stars 0 forks source link

SECURITY BUG: Host Header Injection in src/password-reset/password-reset.service.ts #1

Open redtrib3 opened 6 days ago

redtrib3 commented 6 days ago

There seems to be a Host header injection vulnerability in line 26 of src/password-reset/password-reset.service.ts

What is Host Header Injection?

When an application trusts the Host header without validation, attackers can manipulate it to poison the cache, conduct open redirect attacks, or bypass security controls, potentially leading to account takeover or unauthorized access. This vulnerability occurs because the app assumes the Host header's value without verification, impacting how it constructs URLs or routes.

In the following code, the backend trusts the host header value and and uses it to construct the password reset link:

    //host header is used to construct the reset link !
    const resetLink = `http://${req.headers.host}/password-reset?userId=${user.id}&token=${token}`;

    const emailOptions = {
      recipient: user.email,
      subject: 'Password Reset',
      content: `Please click on the following link to reset your password: ${resetLink}`,
    };

Proof-of-concept:

Please click on the following link to reset your password: https://attacker-controlled.com/password-reset?userId=<USERID>&token=<TOKENHERE>

Mitigation:



Note: A CVE has been assigned for this vulnerability - CVE-2024-51329
PoC - https://github.com/redtrib3/CVEs/tree/main/CVE-2024-51329%20-%20Host%20Header%20Injection

redtrib3 commented 3 days ago

CVE is published: https://www.cve.org/CVERecord?id=CVE-2024-51329