Skip to content

[New Query - githubsecuritylab/cs/forms-auth-ticket-protection-disabled] - detect forms authentication tickets that are neither encrypted nor validated - #272

Draft
felickz wants to merge 1 commit into
copilot/githubsecuritylabcsforms-auth-ticket-protection-difrom
copilot/githubsecuritylabcsforms-auth-ticket-protection-di-again
Draft

felickz wants to merge 1 commit into
copilot/githubsecuritylabcsforms-auth-ticket-protection-difrom
copilot/githubsecuritylabcsforms-auth-ticket-protection-di-again

Conversation

@felickz

@felickz felickz commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Adds an experimental C# CodeQL query for ASP.NET forms authentication configured with protection="None". In legacy cryptographic mode, this disables ticket encryption and validation, allowing user impersonation.

  • Detection: Reports the exact, case-sensitive protection="None" value on <forms> under <authentication mode="Forms"> in Web.config and Web.<name>.config. An omitted mode defaults to Windows and is not reported. The query declares high precision and is selected by the default C# suite, not the audit or external API suites.

  • Query help: Recommends protection="All" or omitting the attribute to use the default. Example reported configuration:

    <configuration>
      <system.web>
        <authentication mode="Forms">
          <forms protection="None" />
        </authentication>
      </system.web>
    </configuration>
  • Coverage: Four expected alerts cover plain, location-scoped, namespaced, and transform configurations. Negative fixtures cover protected values and defaults, other modes, invalid spellings, misplaced elements, and non-web configuration files.

  • Verification: CodeQL 2.27.5 matched all four expected rows. Formatting, compilation with --warnings=error, help generation, suite selection, and query ID uniqueness passed.

  • Performance: The unit-test database profile took 255 ms. Path splitting (42 ms) and absolute-path resolution (33 ms) were the slowest predicates.

  • Known limitations: Configuration inheritance and transforms are not evaluated. A synthetic Framework45 configuration produced a false positive: that mode encrypts and signs tickets regardless of protection.

Real project true positive

To be added by the maintainer.

Follow-ups

  • Account for effective Framework45 mode and add a negative regression case before merge.
  • Leave pack versioning to the release process.

@felickz
felickz added this pull request to stack #273 November 26, 2026 06:15
@felickz felickz changed the title [WIP] Add experimental query for forms authentication with ticket protection disabled [New Query - githubsecuritylab/cs/forms-auth-ticket-protection-disabled] - detect forms authentication tickets that are neither encrypted nor validated Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C#: add a query for forms authentication with the ticket protection disabled

2 participants