Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session Cookie without HttpOnly flag set

I have joust built a website with a login system. After I've just got ready I have scanned it with Acunetix, but I got the following message:

Session Cookie without HttpOnly flag set Session Cookie without Secure flag set (i guess this is only if I have SSL connection)

So my question would be, that how can I set HttpOnly flag for all my Session data? I'm just using sessions when I log in the users. I'm giving them a session with their userID number and than I'm getting data using that userID.

Is there any simple way that I can set ALL of the session HTTPOnly and secure them, so noone can touch them?

like image 803
user1406071 Avatar asked Feb 19 '23 17:02

user1406071


2 Answers

You can either change settings in php.ini, or via ini_set() calls to change session.cookie_secure and session.cookie_httponly values to true.

Alternately, you can use session_set_cookie_params() before starting your session to get the effect you are looking for.

http://us3.php.net/manual/en/function.session-set-cookie-params.php

like image 153
Mike Brant Avatar answered Feb 21 '23 06:02

Mike Brant


You should check out this excellent site for this question. It comes down to setting it in the sessions-section of your php.ini (or via the appropriate runtime function):

session.cookie_httponly = True
like image 26
Lars Avatar answered Feb 21 '23 07:02

Lars