Skip to content

Make the login challenge nonce one-time (CWE-294) - #9334

Merged
Alkarex merged 2 commits into
FreshRSS:edgefrom
gigioneggiando:fix/login-nonce-one-time
Sep 27, 2026
Merged

Alkarex merged 2 commits into
FreshRSS:edgefrom
gigioneggiando:fix/login-nonce-one-time

Conversation

@gigioneggiando

Copy link
Copy Markdown
Contributor

Following up on my private email report — opening the fixes as PRs per your reply.

The per-login challenge nonce (nonceAction → session nonce) was never consumed or cleared, so a captured challenge stayed valid for reuse and survived logout (capture-replay).

The client (p/scripts/extra.js) already requests a fresh nonce for every login attempt, so making it one-time doesn't affect legitimate retries. This:

  • consumes (unsets) the nonce as soon as it is read for verification — in form login, reauth, password change and account self-deletion;
  • clears it in FreshRSS_Auth::removeAccess, so logout invalidates any outstanding challenge.

Per-form binding + short expiry would be a reasonable further hardening; this PR keeps the change minimal and focused on the one-time/replay issue.

The per-login challenge nonce stored in the session was never consumed or
cleared, so a captured challenge stayed replayable and survived logout
(CWE-294). The client (p/scripts/extra.js) already fetches a fresh nonce for
every attempt, so consuming it does not affect legitimate retries.

Consume the nonce (unset it) as soon as it is read for verification in form
login, reauthentication, password change and account self-deletion, and clear
it in FreshRSS_Auth::removeAccess so logout invalidates any outstanding
challenge.
@Alkarex Alkarex added this to the 1.30.1 milestone Sep 19, 2026

@jamalkamaladdin jamalkamaladdin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One measured note below.

Comment thread app/Models/Auth.php Outdated
'lastReauth' => false,
// 'csrf' => false, // Must be refreshed separately
'REMOTE_USER' => false,
'nonce' => false, // Invalidate any outstanding login challenge (e.g. on logout)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreshRSS_Auth::init() runs on every request through FreshRSS.php::initAuth(). For a request with no session and no remember me cookie it reaches removeAccess(), which unsets this key before formLoginAction reads it at line 121.

Measured on this head sha with a SQLite install, auth_type=form, nonce fetched through c=javascript&a=nonce, then a login POST:

with this line, HTTP 403 and Invalid session during login for user=admin, nonce=, password never reached

with this line removed, Password mismatch for user=admin, nonce=31c2d8ec...

Suggested change
'nonce' => false, // Invalidate any outstanding login challenge (e.g. on logout)

removeAccess() runs on every unauthenticated request via FreshRSS_Auth::init()
-- including the login POST itself, before formLoginAction reads the nonce -- so
clearing it there rejected every login with 'Invalid session'. Thanks
@jamalkamaladdin for the measured catch. The one-time guarantee is preserved by
consuming the nonce when it is read for verification (login/reauth/password
change/self-deletion); logout no longer needs a separate clear.
@gigioneggiando

Copy link
Copy Markdown
Contributor Author

Good catch, thank you — you're right: removeAccess() runs on the pre-login request via FreshRSS_Auth::init() and wiped the nonce before formLoginAction read it. Removed that line in bb202d7. The one-time guarantee is preserved by consuming the nonce when it's read for verification (login / reauth / password change / self-deletion), so logout no longer needs a separate clear.

@Alkarex
Alkarex merged commit d5ad610 into FreshRSS:edge Sep 27, 2026
3 checks passed
doonga pushed a commit to greyrock-labs/home-ops that referenced this pull request Oct 6, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [freshrss/freshrss](https://freshrss.org/) ([source](https://github.com/FreshRSS/FreshRSS)) | patch | `1.30.0-alpine` → `1.30.1-alpine` |

---

### Release Notes

<details>
<summary>FreshRSS/FreshRSS (freshrss/freshrss)</summary>

### [`v1.30.1`](https://github.com/FreshRSS/FreshRSS/blob/HEAD/CHANGELOG.md#2026-10-05-FreshRSS-1301)

[Compare Source](FreshRSS/FreshRSS@1.30.0...1.30.1)

- Deployment
  - Reword recommendations and explanations for *edge* (rolling release) vs. *latest* (versioned release) channels [#&#8203;9270](FreshRSS/FreshRSS#9270)
- Security
  - Config + increase default values for search max length and depth [#&#8203;9280](FreshRSS/FreshRSS#9280)
  - Accept a trusted proxy address given without a subnet [#&#8203;9301](FreshRSS/FreshRSS#9301)
  - Warn during session regenerate fail [#&#8203;9311](FreshRSS/FreshRSS#9311), [#&#8203;9376](FreshRSS/FreshRSS#9376)
  - CI/CD add zizmor workflow for action security checks [#&#8203;9228](FreshRSS/FreshRSS#9228), [#&#8203;9331](FreshRSS/FreshRSS#9331)
  - Use PHP `#[\SensitiveParameter]` [#&#8203;9322](FreshRSS/FreshRSS#9322)
  - Reject token access (RSS/OPML export, feed refresh) for disabled accounts [#&#8203;9336](FreshRSS/FreshRSS#9336)
  - Require POST+CSRF for self-update mutations [#&#8203;9335](FreshRSS/FreshRSS#9335)
  - Make the login challenge nonce one-time [#&#8203;9334](FreshRSS/FreshRSS#9334)
  - Bound ZIP import against decompression bombs [#&#8203;9332](FreshRSS/FreshRSS#9332)
  - Rotate session ID on all authenticated transitions [#&#8203;9333](FreshRSS/FreshRSS#9333)
  - Minz: Remove vulnerable and unused code path for displaying errors [#&#8203;9395](FreshRSS/FreshRSS#9395)
  - Fix NAT64 feed fetching on IPv6-only hosts [#&#8203;9372](FreshRSS/FreshRSS#9372)
- Bug fixes
  - Fix domain-wide `Retry-After` [#&#8203;9390](FreshRSS/FreshRSS#9390)
  - Fix muting of feeds gone with HTTP 410 [#&#8203;9391](FreshRSS/FreshRSS#9391)
  - Fix infinite redirect loop due to `SCRIPT_NAME` in `PATH_INFO` [#&#8203;9282](FreshRSS/FreshRSS#9282), [#&#8203;9287](FreshRSS/FreshRSS#9287)
  - Restore the automatic reading view after marking articles as read, while preserving explicit filters [#&#8203;9288](FreshRSS/FreshRSS#9288)
  - Fix adaptive reading state after marking articles read [#&#8203;9290](FreshRSS/FreshRSS#9290)
  - Fix regression sharing links [#&#8203;9303](FreshRSS/FreshRSS#9303)
  - Don’t disable anonymous refresh when anonymous feed access is disabled [#&#8203;9354](FreshRSS/FreshRSS#9354)
  - Fix regression with HTTPS proxies due to wrong TLS SNI resolution [#&#8203;9341](FreshRSS/FreshRSS#9341)
  - Better enforce limits for feeds and categories [#&#8203;9357](FreshRSS/FreshRSS#9357)
  - Fix JavaScript error when opening a label menu in sidebar [#&#8203;9377](FreshRSS/FreshRSS#9377)
  - Fix custom favicon with GReader API [#&#8203;9409](FreshRSS/FreshRSS#9409)
- CLI
  - Add optional feed argument to `actualize-user.php` [#&#8203;9319](FreshRSS/FreshRSS#9319)
- UI
  - Various UI and style improvements [#&#8203;9298](FreshRSS/FreshRSS#9298), [#&#8203;9369](FreshRSS/FreshRSS#9369),
    [#&#8203;9388](FreshRSS/FreshRSS#9388)
- Extensions
  - Call `check_url_before_add` hook when previewing a feed [#&#8203;9343](FreshRSS/FreshRSS#9343)
- I18n
  - Add Belarusian [#&#8203;9351](FreshRSS/FreshRSS#9351)
  - Improve German [#&#8203;9370](FreshRSS/FreshRSS#9370), [#&#8203;9385](FreshRSS/FreshRSS#9385)
  - Improve Italian [#&#8203;9370](FreshRSS/FreshRSS#9370)
  - Improve Japanese [#&#8203;9398](FreshRSS/FreshRSS#9398)
  - Improve Turkish [#&#8203;9349](FreshRSS/FreshRSS#9349)
- Misc.
  - Check SVG optimization in the tests CI workflow with SVGO [#&#8203;9361](FreshRSS/FreshRSS#9361)
  - Move PHPUnit flags to a config file and use strictest failure mode [#&#8203;9374](FreshRSS/FreshRSS#9374)
  - Avoid writing to log files during unit tests [#&#8203;9373](FreshRSS/FreshRSS#9373)
  - Bump Ruby gems automatically with Dependabot for docs [#&#8203;9401](FreshRSS/FreshRSS#9401)
  - Update dev dependencies [#&#8203;9323](FreshRSS/FreshRSS#9323), [#&#8203;9324](FreshRSS/FreshRSS#9324),
    [#&#8203;9325](FreshRSS/FreshRSS#9325), [#&#8203;9326](FreshRSS/FreshRSS#9326), [#&#8203;9327](FreshRSS/FreshRSS#9327),
    [#&#8203;9328](FreshRSS/FreshRSS#9328), [#&#8203;9368](FreshRSS/FreshRSS#9368), [#&#8203;9378](FreshRSS/FreshRSS#9378),
    [#&#8203;9379](FreshRSS/FreshRSS#9379), [#&#8203;9380](FreshRSS/FreshRSS#9380), [#&#8203;9381](FreshRSS/FreshRSS#9381),
    [#&#8203;9402](FreshRSS/FreshRSS#9402), [#&#8203;9403](FreshRSS/FreshRSS#9403), [#&#8203;9404](FreshRSS/FreshRSS#9404),
    [#&#8203;9405](FreshRSS/FreshRSS#9405), [#&#8203;9406](FreshRSS/FreshRSS#9406), [#&#8203;9407](FreshRSS/FreshRSS#9407)

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/New_York)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.greyrock.io/todd/home-ops/pulls/358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants