# CVE-2018-8897: Race condition in n/a

> A race condition in OS kernels mishandling deferred debug exceptions allows attackers to escalate privileges or crash the system.

- **Severity:** High 7.8 (`CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 8 May 2018
- **Updated:** 5 Aug 2024
- **Also known as:** ALPINE-CVE-2018-8897, DEBIAN-CVE-2018-8897, GHSA-j2cv-h77g-5p95, RHSA-2018:1349, RHSA-2018:1350, RHSA-2018:1351, RHSA-2018:1352, RHSA-2018:1353, UBUNTU-CVE-2018-8897

## What is CVE-2018-8897?

CVE-2018-8897 is a high-severity vulnerability in Apple Mac Os X, published on 8 May 2018. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

A statement in the System Programming Guide of the Intel 64 and IA-32 Architectures Software Developer's Manual (SDM) was mishandled in the development of some or all operating-system kernels, resulting in unexpected behavior for #DB exceptions that are deferred by MOV SS or POP SS, as demonstrated by (for example) privilege escalation in Windows, macOS, some Xen configurations, or FreeBSD, or a Linux kernel crash. The MOV to SS and POP SS instructions inhibit interrupts (including NMIs), data breakpoints, and single step trap exceptions until the instruction boundary following the next instruction (SDM Vol. 3A; section 6.8.3). (The inhibited data breakpoints are those on memory accessed by the MOV to SS or POP to SS instruction itself.) Note that debug exceptions are not inhibited by the interrupt enable (EFLAGS.IF) system flag (SDM Vol. 3A; section 2.3). If the instruction following the MOV to SS or POP to SS instruction is an instruction like SYSCALL, SYSENTER, INT 3, etc. that transfers control to the operating system at CPL < 3, the debug exception is delivered after the transfer to CPL < 3 is complete. OS kernels may not expect this order of events and may therefore experience unexpected behavior when it occurs.

Weakness: CWE-362 (Concurrent Execution using Shared Resource with Improper Synchronization)

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

It affects 11 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `kernel` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-PAE` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-PAE-debuginfo` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-PAE-devel` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-debug` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-debug-debuginfo` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-debug-devel` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-debuginfo` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-debuginfo-common` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-devel` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-doc` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-headers` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-xen` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-xen-debuginfo` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel-xen-devel` | Red Hat:rhel_aus:5.9 | All versions | 0:2.6.18-348.39.2.el5 |
| `kernel` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-debug` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-debug-debuginfo` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-debug-devel` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-debuginfo` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-debuginfo-common-x86_64` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-devel` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-doc` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-firmware` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel-headers` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `perf` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `perf-debuginfo` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `python-perf` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `python-perf-debuginfo` | Red Hat:rhel_aus:6.4::server | All versions | 0:2.6.32-358.88.2.el6 |
| `kernel` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-abi-whitelists` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-debug` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-debug-debuginfo` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-debug-devel` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-debuginfo` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-debuginfo-common-x86_64` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-devel` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-doc` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-firmware` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |
| `kernel-headers` | Red Hat:rhel_aus:6.5::server | All versions | 0:2.6.32-431.89.2.el6 |

Products: Apple Mac Os X, Canonical Ubuntu Linux, Citrix Xenserver, Debian Debian Linux, Freebsd Freebsd, Redhat Enterprise Linux Server, Redhat Enterprise Linux Workstation, Redhat Enterprise Virtualization Manager, Synology Diskstation Manager, Synology Skynas, Xen Xen.

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

Apply the vendor's patch.

## Is CVE-2018-8897 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2018-8897 exists.

Public exploit code:

- Arbitrary code execution with kernel privileges using CVE-2018-8897. (github_poc): https://github.com/can1357/CVE-2018-8897
- Implements the POP/MOV SS (CVE-2018-8897) vulnerability by leveraging SYSCALL to perform a local privilege escalation (LPE). (github_poc): https://github.com/nmulasmajic/syscall_exploit_CVE-2018-8897
- Implements the POP/MOV SS (CVE-2018-8897) vulnerability by bugchecking the machine (local DoS).  (github_poc): https://github.com/nmulasmajic/CVE-2018-8897
- The exploitation for CVE-2018-8897 (github_poc): https://github.com/jiazhang0/pop-mov-ss-exploit
- Microsoft Windows POP/MOV SS Local Privilege Elevation Vulnerability (metasploit)
- Microsoft Windows - 'POP/MOV SS' Privilege Escalation (exploitdb)

## Other vulnerabilities in Apple Mac Os X

- [CVE-2014-7169](https://insights.sbomify.com/CVE-2014-7169/): GNU Bourne-Again Shell (Bash) Arbitrary Code Execution (critical 9.8, exploited in the wild)
- [CVE-2014-6271](https://insights.sbomify.com/CVE-2014-6271/): GNU Bourne-Again Shell (Bash) Arbitrary Code Execution (critical 9.8, exploited in the wild)
- [CVE-2012-1823](https://insights.sbomify.com/CVE-2012-1823/): PHP-CGI Query String Parameter (critical 9.8, exploited in the wild)
- [CVE-2021-30713](https://insights.sbomify.com/CVE-2021-30713/): Apple macOS Unspecified (high 7.8, exploited in the wild)
- [CVE-2019-8526](https://insights.sbomify.com/CVE-2019-8526/): Apple macOS Use-After-Free (high 7.8, exploited in the wild)

## Fix prompt for AI coding agents

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

What it is: CVE-2018-8897 is a high-severity vulnerability in Apple Mac Os X, published on 8 May 2018. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2018-8897 exists.

Affected product: Apple Mac Os X. No package-level version data is available, so check the vendor advisory linked from the reference page.

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-8897/ (Markdown: https://insights.sbomify.com/CVE-2018-8897/index.md)
```

## Sources

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

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