This question has been flagged
2 Replies
14968 Views

I've been able to login my credentials by just using this kind of address in the browser "h t t p s://localhost:8080/web/webclient/login?db=MyDB&login=myusername&key=mypassword&session_id=994f75a93ac949489423368d0e528109" in which the value for the session_id is a result from connecting via JSON-RPC in C#.

However, I think no cookie is set because when I try to browse just the localhost:8080 from a different tab I am redirected to the login page and not the opened home page of the account though I have not yet logout.

I want to ask if it is possible to assign my own value for session0|sessionid or cookie using JSON-RPC in C#?

Avatar
Discard
Best Answer

The web module looks for the session id in cookies variable sid. If it is not set, it looks for the request variable sid. So sending sid in request URL works just like in cookie.

The session cookie is only set by the request handler only if the response already has set_cookie which happens at login. Since you are already logged-in for this session by the JSON-RPC client, the session cookie will not be set.

Check the method Root.dispatch() in the web module.

Avatar
Discard
Author

Is there a way so that i can set a cookie using the request URL?

You can create module or wsgi middle-ware that adds any cookie. The request dispatcher will always recreate the session cookie when the response has cookies. You may also modify Root.dispatch() to add response.set_cookie('sid', session.sid) in case of sid is read from url parameter.

Best Answer

@Mohammad Alhashash your answer was (You may also modify Root.dispatch() to addresponse.set_cookie('sid', session.sid) in case of sid is read from url parameter.) and this gives the attacker the opportunity to use the session fixation method for hacking the system users by setting sid="WHATEVER_VALID_SESSION_ID" in the url.

Avatar
Discard