Node.js - Insecure Deserialization : Celestial (HTB)
Last updated
Was this helpful?
Last updated
Was this helpful?
the node express
framework is presented at port 3000
intercepting the request first gave us 404 page, but if we refresh the page again we can see a new value in the cookie ( profile
)
decoding the profile value, and we can see that it's a json
data
Scenario : we will serialize
an object and inject it into the cookie parameter ( profile
) to see if the server desrialize
our object, and if that's the case, then the application is vulnerable to insecure deserialization
Serialization Code:
using the below code, we will serialize an object which just has a function that prints the "the app is vulnerable to insecure deserialization
" message (as described in this article: https://medium.com/@chaudharyaditya/insecure-deserialization-3035c6b5766e)
the serialized object
and we need to append the ()
value at the end of the function, to make the function self-invoking ( Immediately invoked function expression (IIFE) )
encode the object to base64
passing the request , and we can see that the server deserialized our object
we will execute the below command on the server using the serialized object to gain a shell on the server
Serialization Code:
Serialized object :
making the function self-invoking
and we got the shell