# CVE-2012-0158: Microsoft MSCOMCTL.OCX Remote Code Execution

> Remote attackers can execute arbitrary code via crafted documents or websites exploiting MSCOMCTL.OCX ActiveX controls in Microsoft Office and related products.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Yes, since 3 Nov 2021 (CISA KEV), used in ransomware
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 10 Apr 2012
- **Updated:** 22 Oct 2025
- **Also known as:** GHSA-xc3w-wqx5-qrf9

## What is CVE-2012-0158?

CVE-2012-0158 is a high-severity code injection vulnerability in Microsoft Office, published on 10 Apr 2012. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

The (1) ListView, (2) ListView2, (3) TreeView, and (4) TreeView2 ActiveX controls in MSCOMCTL.OCX in the Common Controls in Microsoft Office 2003 SP3, 2007 SP2 and SP3, and 2010 Gold and SP1; Office 2003 Web Components SP3; SQL Server 2000 SP4, 2005 SP4, and 2008 SP2, SP3, and R2; BizTalk Server 2002 SP1; Commerce Server 2002 SP4, 2007 SP2, and 2009 Gold and R2; Visual FoxPro 8.0 SP1 and 9.0 SP2; and Visual Basic 6.0 Runtime allow remote attackers to execute arbitrary code via a crafted (a) web site, (b) Office document, or (c) .rtf file that triggers "system state" corruption, as exploited in the wild in April 2012, aka "MSCOMCTL.OCX RCE Vulnerability."

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2012-0158?

It affects 10 products.


Products: Microsoft Biztalk Server, Microsoft Commerce Server, Microsoft Commerce Server 2009, Microsoft Office, Microsoft Office Web Components, Microsoft Sql Server 2000, Microsoft Sql Server 2005, Microsoft Sql Server 2008, Microsoft Visual Basic, Microsoft Visual Foxpro.

## How do I fix CVE-2012-0158?

No fix has been published for CVE-2012-0158 yet. Limit exposure of the affected software until one is available. US federal agencies must fix it by 3 May 2022.

## Is CVE-2012-0158 being exploited?

Yes. Attackers have exploited CVE-2012-0158 in the wild since at least 3 Nov 2021, including in ransomware campaigns.

Public exploit code:

- CVE-2012-0158复现 (github_poc): https://github.com/Sunqiz/CVE-2012-0158-reproduction
- MS12-027 MSCOMCTL ActiveX Buffer Overflow (metasploit)
- Microsoft Windows - MSCOMCTL ActiveX Buffer Overflow (MS12-027) (Metasploit) (exploitdb)
- the name of virus is the detection of microsoft defender, is the tipic antivirus (github_poc): https://github.com/RobertoLeonFR-ES/Exploit-Win32.CVE-2012-0158.F.doc

## Other vulnerabilities in Microsoft Office

- [CVE-2009-2496](https://insights.sbomify.com/CVE-2009-2496/): Memory corruption in n/a (critical 9.3)
- [CVE-2007-1201](https://insights.sbomify.com/CVE-2007-1201/): Memory corruption in n/a (critical 9.3)
- [CVE-2007-0940](https://insights.sbomify.com/CVE-2007-0940/): Code injection in n/a (critical 9.3)
- [CVE-2003-0117](https://insights.sbomify.com/CVE-2003-0117/): Memory corruption in n/a (high 7.5)
- [CVE-2003-0118](https://insights.sbomify.com/CVE-2003-0118/): SQL injection in n/a (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2012-0158 and fix it if it is affected.

What it is: CVE-2012-0158 is a high-severity code injection vulnerability in Microsoft Office, published on 10 Apr 2012. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: Yes. Attackers have exploited CVE-2012-0158 in the wild since at least 3 Nov 2021, including in ransomware campaigns.

Affected product: Microsoft Office. 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-2012-0158/ (Markdown: https://insights.sbomify.com/CVE-2012-0158/index.md)
```

## Sources

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

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