Skip to content

integrity/brand-impersonation: control ranking reads the raw destination, so a backslash or tab-split link skips the long read #1495

Closed

Description

@nc9

Found in a security review of released code (since v0.0.148). In the control scan, shortlist() decides whether a link goes to the page's own site after normalising the URL (tabs, newlines and leading control characters removed, a backslash read as a slash), but rank() reads the raw href. A destination written with a backslash or split by a tab is ranked as local, so the control gets no long read of its label and is not counted in controlsUnread when its label is cut.

Shape (synthetic hosts)

A link to /\other.example/x (or / + a tab + /other.example/x) whose label has a sign-in phrase after 300 nodes is not read and controlsUnread stays 0; the same markup with https://other.example/x reads the label.

Acceptance Criteria

  • rank() decides local or off-site from the normalised destination (the same one shortlist() uses), and treats a backslash as a slash
  • The shape above gets the long read of its label, or is counted in controlsUnread when the read is cut
  • Tests cover the backslash form, the tab form and a leading-space form, and fail without the change

Activity

  1. added
    size: XS
    rules
    security
    on Nov 1, 2026
  2. added theissue type on Nov 1, 2026
  3. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Checked against v0.0.156. Ticked: criteria 1 (rank() and shortlist() read the same normalised destination, a backslash read as a slash) and 2 (the shape gets the long read, or is counted in controlsUnread when the read is cut). Open: criterion 3, the tests cover the backslash and tab forms but there is no committed leading-space case in integrity-budget-1495.test.ts. Leaving this open for that one test.

    nik

  4. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.157 and checked against it: the leading-space cases are in integrity-budget-1495.test.ts (a sign-in path with leading spaces in the shortlist test; /sign-in, \u0001/sign-in and //host/x ranking as sign-in or off-site, /plain as local), alongside the backslash and tab cases. Every acceptance criterion is met. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.157

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    rulessecuritysize: XS

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions