Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-550

Randomize default remember me cipher

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.4
    • Fix Version/s: 1.2.5
    • Component/s: RememberMe
    • Labels:
      None

      Description

      The way shiro is set up by default exposes a web application to deserialization attacks. This is dangerous anyway, but particularly in light of the recent exploits using commons-collections (see http://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/ for more info).

      By default, shiro uses the CookieRememberMeManager. This serializes, encrypts and encodes the users identity for later retrieval. Therefore, when it receives a request from an unauthenticated user, it looks for their remembered identity by doing the following:

      • Retrieve the value of the rememberMe cookie
      • Base 64 decode
      • Decrypt using AES
      • Deserialize using java serialization (ObjectInputStream).

      However, the default encryption key is hardcoded, meaning anyone with access to the source code knows what the default encryption key is. So, an attacker can create a malicious object, serialize it, encode it, then send it as a cookie. Shiro will then decode and deserialize, meaning that your malicious object is now live on the server. With careful construction of the objects, they can be made to run some malicious code (see link above for more detail).

      Note this is not theoretical; I have a working exploit using the ysoserial commons-collections4 exploit and http client. I can provide my test code if required.

      I understand that this requires your shiro to be set up using the default remember me settings, but in my case my application doesn't even make use of the remember me functionality (there’s no way for the user to ask to be remembered), so I didn't even consider that I needed to secure this part. Yet, my application still has this vulnerability.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tstibbs Tim Stibbs
              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: