Skip to content

:hybrid deserialisation flagged as unsafe by brakeman #1710

Answered by presidentbeef
ArisBee asked this question in Q&A
Discussion options

You must be logged in to vote

@ArisBee Yes, that's the reason Rails moved from Marshal to JSON for session cookies. :hybrid just means "if the session cookie is JSON, accept it. If it's Marshalled, accept it too and convert to JSON."

Crafting a malicious session cookie does require the attacker to know the secret key, though, in order to sign and (depending on Rails version) encrypt the session cookie. Accessing the secret key typically requires another vulnerability... or in the case of open source sometimes people don't change the default secret key grabbed from GitHub.

In any case, it is best not to accept any user-provided input in the Marshal format.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ArisBee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants