PVWA - Is it possible to add missing security headers
Question
Penetration tests may show that IIS security headers are missing or have less secure values. Is it possible to add these manually ?
Environment
14.2 Privileged Access Manager (PAM, self-hosted) Password Vault Web Access
Answer
Later versions of the CyberArk product will include the latest headers, however they may be missing from earlier versions.
These can be added manually by following one of the processes below:-
Through IIS Manager
Open IIS Manager on the PVWA(s), select the site level you want to configure the headers for (Default Website is shown in the example below) and find the 'HTTP Response Headers' icon in the main pane:-
Double click on the icon, click on Add on the top right hand side and add the required header as per the example below:-
An existing header can be modified by double clicking on it
Directly in the web.config File
There may be various web.config files in the IIS web site directory structure (C:\inetpub\wwwroot by default). The above process will modify the web.config file at the relevant level or create a new one if one doesn't exist.
The values can be added manually to the web.config using httpProtocol and customHeaders elements within the system.Webserver element like the example below:-
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="Desired Value" />
</customHeaders>
</httpProtocol>
Save the file after editing. This change will automatically initiate an application pool recycle.
Please refer to this document for more details on the customHeader element - https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httpprotocol/customheaders/
PLEASE NOTE: We recommend backing up any affected web.config files before making any changes, and carrying out tests in a test environment before applying to a production environment.