# CVE-2018-18074: Insufficiently Protected Credentials in Requests

> Attackers can sniff network traffic to steal credentials when the library sends Authorization headers over insecure HTTP redirects.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 9 Oct 2018
- **Updated:** 5 Aug 2024
- **Also known as:** ALBA-2019:3693, DEBIAN-CVE-2018-18074, GHSA-x84v-xcm2-53pg, MGASA-2018-0475, PYSEC-2018-28, RHSA-2019:2035, ROOT-APP-PYPI-CVE-2018-18074, SUSE-SU-2019:1487-1, SUSE-SU-2019:1487-2, SUSE-SU-2019:2027-1, SUSE-SU-2019:2047-1, SUSE-SU-2020:0555-1, SUSE-SU-2022:1448-1, SUSE-SU-2022:1819-1, UBUNTU-CVE-2018-18074, USN-3790-1, openSUSE-SU-2019:1754-1

## What is CVE-2018-18074?

CVE-2018-18074 is a high-severity vulnerability in Canonical Ubuntu Linux, published on 9 Oct 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The Requests package before 2.20.0 for Python sends an HTTP Authorization header to an http URI upon receiving a same-hostname https-to-http redirect, which makes it easier for remote attackers to discover credentials by sniffing the network.

Weakness: CWE-522 (Insufficiently Protected Credentials)

## Which versions are affected by CVE-2018-18074?

3 open source packages ship an affected version, including requests. It affects 6 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `requests` | PyPI | All versions | 2.20.0 |
| `requests` | PyPI | All versions | 2.20.0 |
| `requests` | PyPI | All versions | 2.20.0 |
| `python3-requests` | AlmaLinux:8 | All versions | 2.20.0-2.1.el8_1 |
| `python-requests` | Red Hat:enterprise_linux:7::client | All versions | 0:2.6.0-5.el7 |
| `python-requests` | Red Hat:enterprise_linux:7::computenode | All versions | 0:2.6.0-5.el7 |
| `python-requests` | Red Hat:enterprise_linux:7::server | All versions | 0:2.6.0-5.el7 |
| `python-requests` | Red Hat:enterprise_linux:7::workstation | All versions | 0:2.6.0-5.el7 |
| `python-PyYAML` | SUSE:Enterprise Storage 5 | All versions | 5.1.2-26.9.4 |
| `python-asn1crypto` | SUSE:Enterprise Storage 5 | All versions | 0.24.0-2.5.1 |
| `python-packaging` | SUSE:Enterprise Storage 5 | All versions | 17.1-2.5.1 |
| `python-PyYAML` | SUSE:HPE Helion OpenStack 8 | All versions | 5.1.2-26.9.4 |
| `python-asn1crypto` | SUSE:HPE Helion OpenStack 8 | All versions | 0.24.0-2.5.1 |
| `python-botocore` | SUSE:HPE Helion OpenStack 8 | All versions | 1.12.213-28.12.1 |
| `python-jsonpatch` | SUSE:HPE Helion OpenStack 8 | All versions | 1.1-10.4.1 |
| `python-jsonpointer` | SUSE:HPE Helion OpenStack 8 | All versions | 1.0-10.3.1 |
| `python-packaging` | SUSE:HPE Helion OpenStack 8 | All versions | 17.1-2.5.1 |
| `python-requests` | SUSE:HPE Helion OpenStack 8 | All versions | 2.11.1-6.31.1 |
| `python-PyYAML` | SUSE:Linux Enterprise High Availability Extension 12 SP1 | All versions | 5.1.2-26.9.4 |
| `python-asn1crypto` | SUSE:Linux Enterprise High Availability Extension 12 SP1 | All versions | 0.24.0-2.5.1 |
| `python-packaging` | SUSE:Linux Enterprise High Availability Extension 12 SP1 | All versions | 17.1-2.5.1 |
| `python-pyparsing` | SUSE:Linux Enterprise High Availability Extension 12 SP1 | All versions | 2.2.0-7.6.1 |
| `python-PyYAML` | SUSE:Linux Enterprise High Availability Extension 12 SP2 | All versions | 5.1.2-26.9.4 |
| `python-requests` | SUSE:Linux Enterprise High Availability Extension 12 SP3 | All versions | 2.11.1-6.31.1 |
| `python-requests` | SUSE:Linux Enterprise High Availability Extension 12 SP4 | All versions | 2.11.1-6.31.1 |
| `python-requests` | SUSE:Linux Enterprise High Availability Extension 12 SP5 | All versions | 2.20.1-8.7.7 |
| `python-requests` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 2.18.4-150000.3.3.1 |
| `python-requests` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 2.18.4-150000.3.3.1 |
| `python-PyYAML` | SUSE:Linux Enterprise Module for Advanced Systems Management 12 | All versions | 5.1.2-26.9.4 |
| `python-requests` | SUSE:Linux Enterprise Module for Advanced Systems Management 12 | All versions | 2.11.1-6.31.1 |
| `python-requests` | SUSE:Linux Enterprise Module for Basesystem 15 SP1 | All versions | 2.20.1-6.3.2 |
| `python-PyYAML` | SUSE:Linux Enterprise Module for Containers 12 | All versions | 5.1.2-26.9.4 |
| `python-PyYAML` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 5.1.2-26.9.4 |
| `python-aws-sam-translator` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 1.11.0-2.3.1 |
| `python-boto3` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 1.9.213-14.9.1 |
| `python-botocore` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 1.12.213-28.12.1 |
| `python-cfn-lint` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 0.21.4-2.3.1 |
| `python-docutils` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 0.15.2-3.4.2 |
| `python-functools32` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 3.2.3.2-2.6.1 |
| `python-jsonpatch` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 1.1-10.4.1 |

Products: Canonical Ubuntu Linux, Opensuse Leap, Python Requests, Redhat Enterprise Linux Desktop, Redhat Enterprise Linux Server, Redhat Enterprise Linux Workstation.

## How do I fix CVE-2018-18074?

Upgrade requests to 2.20.0 or later.

## Is CVE-2018-18074 being exploited?

There is no known exploitation of CVE-2018-18074 in the wild and no public exploit code.

Public exploit code:

- AURORA demo target — deliberately vulnerable lockfiles (CVE-2019-10744, CVE-2018-18074, CVE-2020-26160) (github_poc): https://github.com/mlbrilliance/aurora-demo-lockfile

## Other vulnerabilities in Canonical Ubuntu Linux

- [CVE-2020-11651](https://insights.sbomify.com/CVE-2020-11651/): SaltStack Salt Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2020-7247](https://insights.sbomify.com/CVE-2020-7247/): OpenSMTPD Remote Code Execution (critical 9.8, exploited in the wild)
- [CVE-2019-16928](https://insights.sbomify.com/CVE-2019-16928/): Exim Out-of-bounds Write (critical 9.8, exploited in the wild)
- [CVE-2018-6789](https://insights.sbomify.com/CVE-2018-6789/): Exim Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2015-2590](https://insights.sbomify.com/CVE-2015-2590/): Oracle Java SE and Java SE Embedded Remote Code Execution (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2018-18074 and fix it if it is affected.

What it is: CVE-2018-18074 is a high-severity vulnerability in Canonical Ubuntu Linux, published on 9 Oct 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2018-18074 in the wild and no public exploit code.

Affected packages and fixed versions:
- requests (PyPI): affected all versions; fixed in 2.20.0
- requests (PyPI): affected all versions; fixed in 2.20.0
- requests (PyPI): affected all versions; fixed in 2.20.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2018-18074/ (Markdown: https://insights.sbomify.com/CVE-2018-18074/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2018-18074
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2018-18074
- OSV: https://osv.dev/vulnerability/CVE-2018-18074

---
From sbomify Insights: https://insights.sbomify.com/CVE-2018-18074/
Summaries are generated and may contain mistakes; the official description above is the record.
