Skip to main content

Password reset poisoning

Description

The application generates password reset links improperly, allowing an attacker to manipulate the request by changing the domain to one under his control.

Impact

Compromising user accounts.

Recommendation

Ensure that password change URLs are not disposed in client-side requests.

Threat

Attacker without authentication from the Internet.

Expected Remediation Time

⌚ 1440 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: N
  • Attack complexity: L
  • Privileges required: N
  • User interaction: R
  • Scope: C
  • Confidentiality: L
  • Integrity: L
  • Availability: L

Temporal

  • Exploit code madurity: H
  • Remediation level: U
  • Report confidence: C

Result

  • Vector string: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L/E:H/RL:U/RC:C
  • Score:
    • Base: 7.1
    • Temporal: 7.1
  • Severity:
    • Base: High
    • Temporal: High

Code Examples

Compliant code

def send_email_password_reset(request: HTTP) -> bool:
domain_app = env.production.domain_app
user = DB.find_user(request.session.user)

if(user):
token = generate_token(user.id)
url = f"{domain_app}/reset-password?token={token}"
Mailer.send_email(
from_email="[email protected]",
to_email=user.email,
message=f"To reset your account password, please click on the following link: {url}"
)
return True

return False

Non compliant code

def send_email_password_reset(request: HTTP) -> bool:
domain_app = request.body.redirect_url
user = DB.find_user(request.session.user)

if(user):
token = generate_token(user.id)
url = f"{domain_app}/reset-password?token={token}"
Mailer.send_email(
from_email="[email protected]",
to_email=user.email,
message=f"To reset your account password, please click on the following link: {url}"
)
return True

return False

Requirements