Skip to content

4.19.1.2. -> Unable to login with non 2FA users. Error: "JSESSIONID from cookie is invalid." #9848

Closed

Description

@dataCobra
ISSUE TYPE
  • Bug Report
COMPONENT NAME
LOGIN, MANAGEMENT
CLOUDSTACK VERSION
4.19.1.2
SUMMARY

After the update to version 4.19.1.2. Users that don't have 2FA enabled are unable to login and get a 401 UNAUTHORIZED answer from the system. In the logs I can see that an error JSESSIONID from cookie is invalid. gets logged multiple times.

We have no special login methods (like OAuth, SAML) enabled and 2FA is also not mandatory but enabled.

This was tested with different clients with and without cache. All clients produced the same error.

STEPS TO REPRODUCE
1. Update to version 4.19.1.2
2. Try to login with a non 2FA user
3. Get 401 UNAUTHORIZED error

4. Downgrade to 4.19.1.1
5. Try to login with a non 2FA user
6. Login works fine
EXPECTED RESULTS
Login with non 2FA users does work.
ACTUAL RESULTS
Login with non 2FA users doesn't work. (401 UNAUTHORIZED)

We've downgraded to version 4.19.1.1 for now.

Activity

  1. weizhouapache commented on Oct 24, 2024

    @weizhouapache
    Member

    @dataCobra
    do you use the cloudstack GUI, or build your own dashboard ?

  2. dataCobra commented on Oct 24, 2024

    @dataCobra
    Author

    We are using the default GUI.

  3. weizhouapache commented on Oct 24, 2024

    @weizhouapache
    Member

    @dataCobra
    what is the exact error message, "JSESSIONID from cookie is invalid." ?

  4. dataCobra commented on Oct 24, 2024

    @dataCobra
    Author

    Oh sorry, yes this is the error. Will update the main message.

  5. changed the title [-]4.19.1.2. -> Unable to login with non 2FA users. Error: "JSESSIONID is invalid."[/-] [+]4.19.1.2. -> Unable to login with non 2FA users. Error: "JSESSIONID from cookie is invalid."[/+] on Oct 24, 2024
  6. weizhouapache commented on Oct 24, 2024

    @weizhouapache
    Member

    @dataCobra
    no problem.

    For users who use the default GUI, it should work. we have made some changes on the cloudstack GUI to pass jsessionid to each API, it has been tested by multiple users. If it does not work, please clean the browser cache and retry.

    For users who build their own dashboard, they need to modify their codebase and pass the jsessionid which can be found in the response of login API. As a workaround, they can set the global setting api.sessionkey.check.locations from default CookieAndParameter to CookieOrParameter. Please note, it is insecure. Users should fix their codebase asap.

  7. dataCobra commented on Oct 24, 2024

    @dataCobra
    Author

    Thank you for the quick answer.

    We will test this and I come back to you after that.

  8. weizhouapache commented on Oct 24, 2024

    @weizhouapache
    Member

    Thank you for the quick answer.

    We will test this and I come back to you after that.

    If it still does not work, can you share

    • OS and version
    • browser and version

    please also try with different values of global setting api.sessionkey.cookie.samesite.
    it has 4 valid values: Lax (default), Strict, NoneAndSecure and Null

  9. BartJM commented on Oct 24, 2024

    @BartJM
    Contributor

    We have the same issue with 4.18.2.4 using the default GUI (no 2fa enabled).

    Setting api.sessionkey.check.locations to CookieOrParameter did not resolve the issue.

    With api.sessionkey.check.locations still set to CookieOrParameter changing api.sessionkey.cookie.samesite to any of the values did not change the result either.

    Setting enable.secure.session.cookie to false made login work for us.

  10. weizhouapache commented on Oct 24, 2024

    @weizhouapache
    Member

    @BartJM
    thanks for sharing

    @dataCobra
    do you have the same setting enable.secure.session.cookie=true ?

  11. weizhouapache commented on Oct 24, 2024

    @weizhouapache
    Member

    @BartJM @dataCobra
    Is your cloudstack set up with https or http ?

  12. dataCobra commented on Oct 24, 2024

    @dataCobra
    Author

    Ours is setup with HTTPs.

    The other question I can answer you on monday.

  13. weizhouapache commented on Oct 25, 2024

    @weizhouapache
    Member

    I am able to reproduce the issue when 'enable.secure.session.cookie' is 'true'.
    Tested with both http and https websites.

    this is a regression of security fix for CSRF in 4.18.2.4 and 4.19.1.2.

    workaround:

    update configuration set value='false' where name='enable.secure.session.cookie';
    

    then restart cloudstack-management

    I will create a fix
    cc @rohityadavcloud @DaanHoogland @GutoVeronezi @JoaoJandre

  14. DaanHoogland commented on Nov 8, 2024

    @DaanHoogland
    Contributor

    fixed in 9856

  15. added this to the 4.19.2.0 milestone on Nov 8, 2024
  16. JoaoJandre commented on Nov 8, 2024

    @JoaoJandre
    Contributor

    @DaanHoogland can we close this?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions