Repository navigation
Rotate session ID on all authenticated transitions (CWE-384) - #9333
Conversation
|
What about the CSRF token, is it rotated sufficiently or not? (after the #9171 changes) |
| if (self::accessControl()) { | ||
| // Rotate the PHP session ID on the unauthenticated->authenticated | ||
| // transition (remember-me cookie restore, HTTP auth, HTTP auto-register) | ||
| // to prevent session fixation, mirroring the explicit form-login path. |
There was a problem hiding this comment.
mirroring the explicit form-login path.
It's not an important detail here, since that's what should be being done anyway.
|
I'm having the |
…ation) The PHP session ID was regenerated on explicit form login, reauth, logout and password change, but NOT when access is (re)established from a remember-me cookie, via HTTP authentication, or on self-registration auto-login (CWE-384), so a fixed session ID could become authenticated. Regenerate the session ID at those transitions too: in FreshRSS_Auth::init when accessControl() first grants access (covers remember-me restore and HTTP auth; skipped for auth_type 'none', which has no authentication boundary), and in the self-registration auto-login path, mirroring the existing form-login idiom. Also enable session.use_strict_mode before session_start as defence in depth so an uninitialised, attacker-supplied session ID is not adopted.
80396b8 to
5baf803
Compare
|
Addressed the requested changes in 5baf803. During session regeneration, an already queued FreshRSS session cookie is now replaced while preserving other Set-Cookie headers (including FreshRSS_login), so remember-me auto-login emits exactly one FreshRSS cookie. I reproduced the flow locally over HTTP and confirmed one FreshRSS plus one FreshRSS_login header. Regarding CSRF: the token is rotated on each newly covered authenticated transition. Remember-me and HTTP auth clear csrf in accessControl(), and self-registration clears it when installing the authenticated session parameters; the next csrfToken() call generates a fresh value, consistent with #9171. I also removed the unnecessary comparison wording from the inline comment. Focused SessionTest, full PHPCS, and full PHPStan pass. |
Inverle
left a comment
There was a problem hiding this comment.
LGTM
For a future PR, a good idea would be to also rotate the long-term cookie token (FreshRSS_login) with a simple rename() and setcookie() call.
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 [#​9270](FreshRSS/FreshRSS#9270) - Security - Config + increase default values for search max length and depth [#​9280](FreshRSS/FreshRSS#9280) - Accept a trusted proxy address given without a subnet [#​9301](FreshRSS/FreshRSS#9301) - Warn during session regenerate fail [#​9311](FreshRSS/FreshRSS#9311), [#​9376](FreshRSS/FreshRSS#9376) - CI/CD add zizmor workflow for action security checks [#​9228](FreshRSS/FreshRSS#9228), [#​9331](FreshRSS/FreshRSS#9331) - Use PHP `#[\SensitiveParameter]` [#​9322](FreshRSS/FreshRSS#9322) - Reject token access (RSS/OPML export, feed refresh) for disabled accounts [#​9336](FreshRSS/FreshRSS#9336) - Require POST+CSRF for self-update mutations [#​9335](FreshRSS/FreshRSS#9335) - Make the login challenge nonce one-time [#​9334](FreshRSS/FreshRSS#9334) - Bound ZIP import against decompression bombs [#​9332](FreshRSS/FreshRSS#9332) - Rotate session ID on all authenticated transitions [#​9333](FreshRSS/FreshRSS#9333) - Minz: Remove vulnerable and unused code path for displaying errors [#​9395](FreshRSS/FreshRSS#9395) - Fix NAT64 feed fetching on IPv6-only hosts [#​9372](FreshRSS/FreshRSS#9372) - Bug fixes - Fix domain-wide `Retry-After` [#​9390](FreshRSS/FreshRSS#9390) - Fix muting of feeds gone with HTTP 410 [#​9391](FreshRSS/FreshRSS#9391) - Fix infinite redirect loop due to `SCRIPT_NAME` in `PATH_INFO` [#​9282](FreshRSS/FreshRSS#9282), [#​9287](FreshRSS/FreshRSS#9287) - Restore the automatic reading view after marking articles as read, while preserving explicit filters [#​9288](FreshRSS/FreshRSS#9288) - Fix adaptive reading state after marking articles read [#​9290](FreshRSS/FreshRSS#9290) - Fix regression sharing links [#​9303](FreshRSS/FreshRSS#9303) - Don’t disable anonymous refresh when anonymous feed access is disabled [#​9354](FreshRSS/FreshRSS#9354) - Fix regression with HTTPS proxies due to wrong TLS SNI resolution [#​9341](FreshRSS/FreshRSS#9341) - Better enforce limits for feeds and categories [#​9357](FreshRSS/FreshRSS#9357) - Fix JavaScript error when opening a label menu in sidebar [#​9377](FreshRSS/FreshRSS#9377) - Fix custom favicon with GReader API [#​9409](FreshRSS/FreshRSS#9409) - CLI - Add optional feed argument to `actualize-user.php` [#​9319](FreshRSS/FreshRSS#9319) - UI - Various UI and style improvements [#​9298](FreshRSS/FreshRSS#9298), [#​9369](FreshRSS/FreshRSS#9369), [#​9388](FreshRSS/FreshRSS#9388) - Extensions - Call `check_url_before_add` hook when previewing a feed [#​9343](FreshRSS/FreshRSS#9343) - I18n - Add Belarusian [#​9351](FreshRSS/FreshRSS#9351) - Improve German [#​9370](FreshRSS/FreshRSS#9370), [#​9385](FreshRSS/FreshRSS#9385) - Improve Italian [#​9370](FreshRSS/FreshRSS#9370) - Improve Japanese [#​9398](FreshRSS/FreshRSS#9398) - Improve Turkish [#​9349](FreshRSS/FreshRSS#9349) - Misc. - Check SVG optimization in the tests CI workflow with SVGO [#​9361](FreshRSS/FreshRSS#9361) - Move PHPUnit flags to a config file and use strictest failure mode [#​9374](FreshRSS/FreshRSS#9374) - Avoid writing to log files during unit tests [#​9373](FreshRSS/FreshRSS#9373) - Bump Ruby gems automatically with Dependabot for docs [#​9401](FreshRSS/FreshRSS#9401) - Update dev dependencies [#​9323](FreshRSS/FreshRSS#9323), [#​9324](FreshRSS/FreshRSS#9324), [#​9325](FreshRSS/FreshRSS#9325), [#​9326](FreshRSS/FreshRSS#9326), [#​9327](FreshRSS/FreshRSS#9327), [#​9328](FreshRSS/FreshRSS#9328), [#​9368](FreshRSS/FreshRSS#9368), [#​9378](FreshRSS/FreshRSS#9378), [#​9379](FreshRSS/FreshRSS#9379), [#​9380](FreshRSS/FreshRSS#9380), [#​9381](FreshRSS/FreshRSS#9381), [#​9402](FreshRSS/FreshRSS#9402), [#​9403](FreshRSS/FreshRSS#9403), [#​9404](FreshRSS/FreshRSS#9404), [#​9405](FreshRSS/FreshRSS#9405), [#​9406](FreshRSS/FreshRSS#9406), [#​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
Following up on my private email report — opening the fixes as PRs per your reply.
The session ID is regenerated on explicit form login, reauth, logout and password change, but not when access is (re)established from a remember-me cookie, via HTTP authentication, or on self-registration auto-login. A fixed/attacker-known session ID can therefore become authenticated (session fixation).
This rotates the session ID at those transitions too, mirroring the existing form-login idiom:
FreshRSS_Auth::init()— whenaccessControl()first grants access (covers remember-me restore and HTTP auth; skipped forauth_type = none, which has no authentication boundary);userController.It also enables
session.use_strict_modebeforesession_start()as defence in depth, so an uninitialised (attacker-supplied) session ID is not adopted.