This script can make authenticated Bearer requests against a Web Service to check interesting headers in the responses, you can make a GET request to a URL or URI API to get authenticated responses.
- requests==2.26.0
Usage:
python ./SecurityHeaders.py URL {-jwt eyJraWQiOi...}
Security Headers checks if a recommended security header is missing from responses.
Use -h or --help flag to get help
Example
./SecurityHeaders.py https://www.google.com/
OR
./SecurityHeaders.py https://api.localhost.com/offers/get -jwt eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...
Make sure of specify the communication schema, HTTP or HTTPS
The script bases its functionality from SecurityHeaders project.
-
Content-Security-Policy: Content Security Policy is an effective measure to protect your site from XSS attacks. By whitelisting sources of approved content, you can prevent the browser from loading malicious assets.
-
X-Frame-Options: X-Frame-Options tells the browser whether you want to allow your site to be framed or not. By preventing a browser from framing your site you can defend against attacks like clickjacking. Recommended value "X-Frame-Options: SAMEORIGIN".
-
X-Content-Type-Options: X-Content-Type-Options stops a browser from trying to MIME-sniff the content type and forces it to stick with the declared content-type. The only valid value for this header is "X-Content-Type-Options: nosniff".
-
Referrer-Policy: Referrer Policy is a new header that allows a site to control how much information the browser includes with navigations away from a document and should be set by all sites.
-
Permissions-Policy: Permissions Policy is a new header that allows a site to control which features and APIs can be used in the browser.