Coverage area · Partly checked automatically

Code flaws that make phishing work

Phishing targets people, but it leans on flaws in software: a trusted domain that redirects anywhere, an account email that changes without confirmation, a notification email users can fill with their own content. This page covers what to look for in your code; open redirects are checked automatically.

what to look for · Phishing resistance
[ ] Redirect target from the request?
[ ] Email or MFA changes re-verified?
[ ] Can users set the sender or body?
fix: allow-list local redirect paths
$ 

A manual checklist for this area. The example below isn't flagged by a stock rule; see what is checked today.

What OpenRouting checks today

Partly checked automatically

Semgrep's default ruleset flags open redirects built from request input in Flask, Django, Express, Rails, Spring, NestJS and Symfony; there is no specialist agent, so the general reviewer gives the verdict. Not checked: email, phone and MFA change flows, user-controlled email content, and SPF/DKIM/DMARC records. OpenRouting never contacts or tests people.

Why this area matters

Phishing and credential theft remain among the most common initial access vectors in breach reports. A phishing link that starts on your real domain, then bounces to an attacker's page through an open redirect (CWE-601), is far more convincing than a look-alike domain. Account-recovery and email-change flows without re-verification turn a stolen session into a permanently taken-over account.

These are logic issues scanners only partly see. Semgrep can flag a redirect built from a query parameter; deciding whether it is restricted to local paths, or whether an email change is confirmed, needs someone to read the flow.

What goes wrong in real applications

  • Open redirects

    Redirecting to a URL taken from the request lets phishing links start on your trusted domain and land on someone else's.

  • Unverified account changes

    Changing email, phone or MFA settings without re-authentication or confirmation to the old address lets a briefly stolen session become a permanent takeover.

  • User-controlled email content

    Letting users set the sender name, reply-to or HTML of invitation and notification emails turns your mail system into a phishing relay with your reputation.

  • Spoofable sender domains

    Mail DNS records defined in IaC without SPF, DKIM and an enforcing DMARC policy make it easy to send mail that appears to come from you.

Sample: the risky pattern and the fix

Riskyauth/views.py
@app.get("/login/continue")
def continue_after_login():
    return redirect(request.args.get("next", "/"))

@app.post("/account/email")
@login_required
def change_email():
    current_user.email = request.form["email"]
    db.save(current_user)
    return redirect("/account")
Saferauth/views.py
@app.get("/login/continue")
def continue_after_login():
    target = request.args.get("next", "/")
    if not target.startswith("/") or target.startswith("//"):
        target = "/"                  # local paths only
    return redirect(target)

@app.post("/account/email")
@login_required
@require_recent_password
def change_email():
    send_change_confirmation(current_user, request.form["email"])
    notify_previous_address(current_user)
    return redirect("/account?email_pending=1")

The redirect sends users to any URL in the next parameter, so a link on your domain can end on a phishing page; the email change takes effect immediately with no re-authentication. The fix only allows local paths, requires a recent password, confirms the new address and alerts the old one before anything changes.

Illustrative code, simplified for clarity — not taken from a customer repository.

What to look for in your code

  • Redirects and links built from request parameters
  • Email, phone, password-reset and MFA flows: re-authentication, confirmation, notification to the old contact
  • Transactional email templates that include user-controlled sender names, reply-to or HTML
  • SPF, DKIM and DMARC records defined in Terraform or other IaC

Scope and limits

  • It doesn't run phishing simulations, train staff or contact anyone — it reviews the code and config attackers would lean on.
  • Live DNS records and mail-provider settings outside the repository aren't checked; only records defined in your IaC are.
  • Open-redirect findings are reviewed by the general reviewer; there is no dedicated agent for this area, and account flows are a manual check.

The checklist above is broader than what runs automatically; see what OpenRouting checks today. Where a scanner does run, it surfaces candidates and a review agent decides whether each one is real — it doesn't promise to find every issue.

Common questions

Does OpenRouting test my employees?

No. It never targets people. It covers the software side of phishing: the flaws in your product that make a phishing attempt more convincing or more damaging.

Is every redirect with a parameter a finding?

No. When Semgrep flags one, redirects restricted to local paths or an allow-list of hosts are marked as likely false positives, with the reason.