# CVE-2009-0689: Memory corruption in n/a

> A heap-based buffer overflow in libc's dtoa implementation allows attackers to cause denial of service or execute arbitrary code via crafted printf arguments.

- **Severity:** Medium 6.8 (`AV:N/AC:M/Au:N/C:P/I:P/A:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 1 Jul 2009
- **Updated:** 7 Aug 2024
- **Also known as:** CVE-2009-1563, DEBIAN-CVE-2009-0689, DLA-1564-1, DLA-376-1, DSA-1998-1, GHSA-99jp-rppc-jgcm, MGASA-2016-0013, RHSA-2009:1601, RHSA-2014:0312

## What is CVE-2009-0689?

CVE-2009-0689 is a medium-severity memory corruption vulnerability in Freebsd Freebsd, published on 1 Jul 2009. 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

Array index error in the (1) dtoa implementation in dtoa.c (aka pdtoa.c) and the (2) gdtoa (aka new dtoa) implementation in gdtoa/misc.c in libc, as used in multiple operating systems and products including in FreeBSD 6.4 and 7.2, NetBSD 5.0, OpenBSD 4.5, Mozilla Firefox 3.0.x before 3.0.15 and 3.5.x before 3.5.4, K-Meleon 1.5.3, SeaMonkey 1.1.8, and other products, allows context-dependent attackers to cause a denial of service (application crash) and possibly execute arbitrary code via a large precision value in the format argument to a printf function, which triggers incorrect memory allocation and a heap-based buffer overflow during conversion to a floating-point number.

Weakness: CWE-119 (Improper Restriction of Operations within the Bounds of a Memory Buffer)

## Which versions are affected by CVE-2009-0689?

It affects 6 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `kdelibs` | Red Hat:enterprise_linux:4::as | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-debuginfo` | Red Hat:enterprise_linux:4::as | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-devel` | Red Hat:enterprise_linux:4::as | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs` | Red Hat:enterprise_linux:4::desktop | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-debuginfo` | Red Hat:enterprise_linux:4::desktop | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-devel` | Red Hat:enterprise_linux:4::desktop | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs` | Red Hat:enterprise_linux:4::es | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-debuginfo` | Red Hat:enterprise_linux:4::es | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-devel` | Red Hat:enterprise_linux:4::es | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs` | Red Hat:enterprise_linux:4::ws | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-debuginfo` | Red Hat:enterprise_linux:4::ws | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs-devel` | Red Hat:enterprise_linux:4::ws | All versions | 6:3.3.1-17.el4_8.1 |
| `kdelibs` | Red Hat:enterprise_linux:5::client | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs-apidocs` | Red Hat:enterprise_linux:5::client | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs-debuginfo` | Red Hat:enterprise_linux:5::client | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs` | Red Hat:enterprise_linux:5::client_workstation | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs-debuginfo` | Red Hat:enterprise_linux:5::client_workstation | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs-devel` | Red Hat:enterprise_linux:5::client_workstation | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs` | Red Hat:enterprise_linux:5::server | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs-apidocs` | Red Hat:enterprise_linux:5::server | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs-debuginfo` | Red Hat:enterprise_linux:5::server | All versions | 6:3.5.4-25.el5_4.1 |
| `kdelibs-devel` | Red Hat:enterprise_linux:5::server | All versions | 6:3.5.4-25.el5_4.1 |
| `php` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-bcmath` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-cli` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-common` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-dba` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-debuginfo` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-devel` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-gd` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-imap` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-ldap` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-mbstring` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-mysql` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-ncurses` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-odbc` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-pdo` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-pgsql` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-snmp` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |
| `php-soap` | Red Hat:rhel_eus:5.9 | All versions | 0:5.1.6-40.el5_9.2 |

Products: Freebsd Freebsd, K-Meleon Project K-Meleon, Mozilla Firefox, Mozilla Seamonkey, Netbsd Netbsd, Openbsd Openbsd.

## How do I fix CVE-2009-0689?

Upgrade to a fixed version.

## Is CVE-2009-0689 being exploited?

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

Public exploit code:

- An implementation of CVE-2009-0689 for the Nintendo Wii. (github_poc): https://github.com/Fullmetal5/str2hax
- BSD (Multiple Distributions) - 'gdtoa/misc.c' Memory Corruption (exploitdb)
- Mozilla Firefox 3.5.3 - Floating Point Conversion Heap Overflow (exploitdb)
- KDE KDELibs 4.3.3 - Remote Array Overrun (exploitdb)
- SeaMonkey 1.1.8 - Remote Array Overrun (exploitdb)
- K-Meleon 1.5.3 - Remote Array Overrun (exploitdb)

## Other vulnerabilities in Freebsd Freebsd

- [CVE-2018-17160](https://insights.sbomify.com/CVE-2018-17160/): Memory corruption in FreeBSD (critical 10.0)
- [CVE-2014-3954](https://insights.sbomify.com/CVE-2014-3954/): Memory corruption in n/a (critical 10.0)
- [CVE-2006-4304](https://insights.sbomify.com/CVE-2006-4304/): Memory corruption in n/a (critical 10.0)
- [CVE-2006-0226](https://insights.sbomify.com/CVE-2006-0226/): Integer overflow in n/a (critical 10.0)
- [CVE-2004-0002](https://insights.sbomify.com/CVE-2004-0002/): Denial of service in n/a (critical 10.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2009-0689 and fix it if it is affected.

What it is: CVE-2009-0689 is a medium-severity memory corruption vulnerability in Freebsd Freebsd, published on 1 Jul 2009. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2009-0689 exists.

Affected product: Freebsd Freebsd. 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-2009-0689/ (Markdown: https://insights.sbomify.com/CVE-2009-0689/index.md)
```

## Sources

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

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