AS24-U2-000470 - Cookies exchanged between the Apache web server and client, such as session cookies, must have security settings that disallow cookie access outside the originating Apache web server and hosted application - Javascript setCookie

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

Cookies are used to exchange data between the web server and the client. Cookies, such as a session cookie, may contain session information and user credentials used to maintain a persistent connection between the user and the hosted application since HTTP/HTTPS is a stateless protocol.

When the cookie parameters are not set properly (i.e., domain and path parameters), cookies can be shared within hosted applications residing on the same web server or to applications hosted on different web servers residing on the same domain.

NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance.

Solution

Determine the location of the 'HTTPD_ROOT' directory and the 'httpd.conf' file:

# httpd -V | egrep -i 'httpd_root|server_config_file'
-D HTTPD_ROOT='/etc/httpd'
-D SERVER_CONFIG_FILE='conf/httpd.conf'

Add or configure the following line:

'Header always edit Set-Cookie ^(.*)$ $1;HttpOnly;secure'

Add the 'secure' attribute to the JavaScript set cookie in any application code:

function setCookie() { document.cookie = 'ALEPH_SESSION_ID = $SESS; path = /; secure'; }

HttpOnly cannot be used since by definition this is a cookie set by JavaScript.

Restart www_server and Apache.

See Also

https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_Apache_Server_2-4_UNIX_Y22M01_STIG.zip

Item Details

References: CAT|II, CCI|CCI-001664, Rule-ID|SV-214288r612241_rule, STIG-ID|AS24-U2-000470, STIG-Legacy|SV-102883, STIG-Legacy|V-92795, Vuln-ID|V-214288

Plugin: Unix

Control ID: 8a5fe95a1b07cec4ca349442a4a2384c2167f546f3f6ba56efff480014860557