From fd4de0717e8767c86b676d07845cadc99309919e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Zaj=C4=85c?= Date: Mon, 18 Mar 2024 10:32:48 +0100 Subject: [PATCH 1/3] Detecting https to http redirect --- .../https-to-http-redirect.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 http/misconfiguration/https-to-http-redirect.yaml diff --git a/http/misconfiguration/https-to-http-redirect.yaml b/http/misconfiguration/https-to-http-redirect.yaml new file mode 100644 index 00000000000..9fd2d242eaf --- /dev/null +++ b/http/misconfiguration/https-to-http-redirect.yaml @@ -0,0 +1,21 @@ +id: https-to-http-redirect + +info: + name: HTTPS to HTTP redirect + author: kazet + severity: info + description: | + This check detects whether there is a redirect from https:// to http:// + metadata: + max-request: 1 + tags: misconfig + +http: + - method: GET + path: + - "{{BaseURL}}" + + matchers: + - type: dsl + dsl: + - 'startswith(tolower(location), "http://") && startswith(tostring(BaseURL), "https://") && (status_code == 301 || status_code == 302 || status_code == 307)' From e1664ddd235461fee923e20bfb0b83b22cdf297c Mon Sep 17 00:00:00 2001 From: Ritik Chaddha <44563978+ritikchaddha@users.noreply.github.com> Date: Wed, 27 Mar 2024 23:11:38 +0530 Subject: [PATCH 2/3] Update https-to-http-redirect.yaml --- http/misconfiguration/https-to-http-redirect.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/http/misconfiguration/https-to-http-redirect.yaml b/http/misconfiguration/https-to-http-redirect.yaml index 9fd2d242eaf..c70a2d6c92c 100644 --- a/http/misconfiguration/https-to-http-redirect.yaml +++ b/http/misconfiguration/https-to-http-redirect.yaml @@ -1,14 +1,14 @@ id: https-to-http-redirect info: - name: HTTPS to HTTP redirect + name: HTTPS to HTTP redirect Misconfiguration author: kazet severity: info description: | This check detects whether there is a redirect from https:// to http:// metadata: max-request: 1 - tags: misconfig + tags: misconfig,HTTP,https http: - method: GET @@ -18,4 +18,7 @@ http: matchers: - type: dsl dsl: - - 'startswith(tolower(location), "http://") && startswith(tostring(BaseURL), "https://") && (status_code == 301 || status_code == 302 || status_code == 307)' + - 'startswith(tolower(location), "http://")' + - 'startswith(tostring(BaseURL), "https://")' + - '(status_code == 301 || status_code == 302 || status_code == 307)' + condition: and From 81324c7b3305adebfc6edf0a1950746c7860c8a6 Mon Sep 17 00:00:00 2001 From: Dhiyaneshwaran Date: Thu, 28 Mar 2024 11:39:15 +0530 Subject: [PATCH 3/3] add verified tag --- http/misconfiguration/https-to-http-redirect.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/http/misconfiguration/https-to-http-redirect.yaml b/http/misconfiguration/https-to-http-redirect.yaml index c70a2d6c92c..3b6853315b1 100644 --- a/http/misconfiguration/https-to-http-redirect.yaml +++ b/http/misconfiguration/https-to-http-redirect.yaml @@ -5,10 +5,11 @@ info: author: kazet severity: info description: | - This check detects whether there is a redirect from https:// to http:// + Detects whether there is a redirect from https:// to http:// metadata: max-request: 1 - tags: misconfig,HTTP,https + verified: true + tags: misconfig,http,https http: - method: GET