# CVE-2018-6831: Command injection in n/a

> Remote authenticated attackers can execute arbitrary commands on Foscam IP cameras via the ntpServer argument due to improper input sanitization.

- **Severity:** High 7.2 (`CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 9 Jul 2018
- **Updated:** 5 Aug 2024
- **Also known as:** GHSA-299g-mw53-xpxq

## What is CVE-2018-6831?

CVE-2018-6831 is a high-severity command injection vulnerability in n/a, published on 9 Jul 2018. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

The setSystemTime function in Foscam Cameras C1 Lite V3, and C1 V3 with firmware 2.82.2.33 and earlier, FI9800P V3, FI9803P V4, FI9851P V3, and FI9853EP V2 2.84.2.33 and earlier, FI9816P V3, FI9821EP V2, FI9821P V3, FI9826P V3, and FI9831P V3 2.81.2.33 and earlier, C1, C1 V2, C1 Lite, and C1 Lite V2 2.52.2.47 and earlier, FI9800P, FI9800P V2, FI9803P V2, FI9803P V3, and FI9851P V2 2.54.2.47 and earlier, FI9815P, FI9815P V2, FI9816P, and FI9816P V2, 2.51.2.47 and earlier, R2 and R4 2.71.1.59 and earlier, C2 and FI9961EP 2.72.1.59 and earlier, FI9900EP, FI9900P, and FI9901EP 2.74.1.59 and earlier, FI9928P 2.74.1.58 and earlier, FI9803EP and FI9853EP 2.22.2.31 and earlier, FI9803P and FI9851P 2.24.2.31 and earlier, FI9821P V2, FI9826P V2, FI9831P V2, and FI9821EP 2.21.2.31 and earlier, FI9821W V2, FI9831W, FI9826W, FI9821P, FI9831P, and FI9826P 2.11.1.120 and earlier, FI9818W V2 2.13.2.120 and earlier, FI9805W, FI9804W, FI9804P, FI9805E, and FI9805P 2.14.1.120 and earlier, FI9828P, and FI9828W 2.13.1.120 and earlier, and FI9828P V2 2.11.1.133 and earlier allows remote authenticated users to execute arbitrary commands via a ';' in the ntpServer argument.  NOTE: this issue exists because of an incomplete fix for CVE-2017-2849.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

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

It affects 32 products.


Products: Foscam C1 Firmware, Foscam C1 Lite Firmware, Foscam C2 Firmware, Foscam Fi9800p Firmware, Foscam Fi9803ep Firmware, Foscam Fi9803p Firmware, Foscam Fi9804p Firmware, Foscam Fi9804w Firmware, Foscam Fi9805e Firmware, Foscam Fi9805p Firmware, Foscam Fi9805w Firmware, Foscam Fi9815p Firmware, Foscam Fi9816p Firmware, Foscam Fi9818w Firmware, Foscam Fi9821ep Firmware, Foscam Fi9821p Firmware, Foscam Fi9821w Firmware, Foscam Fi9826p Firmware, Foscam Fi9826w Firmware, Foscam Fi9828p Firmware and 12 more.

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

No fix has been published for CVE-2018-6831 yet. Limit exposure of the affected software until one is available.

## Is CVE-2018-6831 being exploited?

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

## Other vulnerabilities in n/a

- [CVE-2017-2872](https://insights.sbomify.com/CVE-2017-2872/): Auth bypass in Foscam Indoor IP Camera C1 Series (critical 9.9)
- [CVE-2017-2877](https://insights.sbomify.com/CVE-2017-2877/): Missing authorization in Foscam C1 Indoor HD Camera (critical 9.8)
- [CVE-2017-2871](https://insights.sbomify.com/CVE-2017-2871/): Auth bypass in Foscam (critical 9.6)
- [CVE-2017-2873](https://insights.sbomify.com/CVE-2017-2873/): Command injection in Foscam C1 Indoor HD Camera (high 8.8)
- [CVE-2017-2875](https://insights.sbomify.com/CVE-2017-2875/): Memory corruption in Foscam C1 Indoor HD Camera (high 8.8)

## Fix prompt for AI coding agents

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

What it is: CVE-2018-6831 is a high-severity command injection vulnerability in n/a, published on 9 Jul 2018. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2018-6831 in the wild and no public exploit code.

Affected product: n/a. 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-6831/ (Markdown: https://insights.sbomify.com/CVE-2018-6831/index.md)
```

## Sources

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

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