Check: AS24-U2-000470
Apache Server 2.4 UNIX Site STIG:
AS24-U2-000470
(in versions v2 r4 through v2 r3)
Title
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. (Cat II impact)
Discussion
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.
Check Content
Determine the location of the "HTTPD_ROOT" directory and the "httpd.conf" file: # apachectl -V | egrep -i 'httpd_root|server_config_file' -D HTTPD_ROOT="/etc/httpd" -D SERVER_CONFIG_FILE="conf/httpd.conf" Note: The apachectl front end is the preferred method for locating the Apache httpd file. For some Linux distributions "apache2ctl -V" or "httpd -V" can also be used. Search for the "Header" directive: # cat /<path_to_file>/httpd.conf | grep -i "Header" If "HttpOnly" "secure" is not configured, this is a finding. "Header always edit Set-Cookie ^(.*)$ $1;HttpOnly;secure" Review the code. If, when creating cookies, the following is not occurring, this is a finding: function setCookie() { document.cookie = "ALEPH_SESSION_ID = $SESS; path = /; secure"; }
Fix Text
Determine the location of the "HTTPD_ROOT" directory and the "httpd.conf" file: # apachectl -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.
Additional Identifiers
Rule ID: SV-214288r881493_rule
Vulnerability ID: V-214288
Group Title: SRG-APP-000223-WSR-000011
Expert Comments
CCIs
Number | Definition |
---|---|
CCI-001664 |
The information system recognizes only session identifiers that are system-generated. |
Controls
Number | Title |
---|---|
SC-23 (3) |
Unique Session Identifiers With Randomization |