# CVE-2021-41278: Broken encryption in EdgeX Foundry

> Attackers can decrypt messages if the optional AES transform is used in EdgeX Foundry processing pipelines due to broken encryption implementation.

- **Severity:** Medium 5.4 (`CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 18 Nov 2021
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-6c7m-qwxj-mvhp

## What is CVE-2021-41278?

CVE-2021-41278 is a medium-severity vulnerability in edgexfoundry app-functions-sdk-go, published on 18 Nov 2021. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

Functions SDK for EdgeX is meant to provide all the plumbing necessary for developers to get started in processing/transforming/exporting data out of the EdgeX IoT platform. In affected versions broken encryption in app-functions-sdk “AES” transform in EdgeX Foundry releases prior to Jakarta allows attackers to decrypt messages via unspecified vectors. The app-functions-sdk exports an “aes” transform that user scripts can optionally call to encrypt data in the processing pipeline. No decrypt function is provided. Encryption is not enabled by default, but if used, the level of protection may be less than the user may expects due to a broken implementation. Version v2.1.0 (EdgeX Foundry Jakarta release and later) of app-functions-sdk-go/v2 deprecates the “aes” transform and provides an improved “aes256” transform in its place. The broken implementation will remain in a deprecated state until it is removed in the next EdgeX major release to avoid breakage of existing software that depends on the broken implementation. As the broken transform is a library function that is not invoked by default, users who do not use the AES transform in their processing pipelines are unaffected. Those that are affected are urged to upgrade to the Jakarta EdgeX release and modify processing pipelines to use the new "aes256" transform.

Weakness: CWE-327 (Use of a Broken or Risky Cryptographic Algorithm)

## Which versions are affected by CVE-2021-41278?

6 open source packages ship an affected version, including github.com/edgexfoundry/app-functions-sdk-go, github.com/edgexfoundry/app-functions-sdk-go/v2 and github.com/edgexfoundry/app-service-configurable. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/edgexfoundry/app-functions-sdk-go` | Go | All versions | None |
| `github.com/edgexfoundry/app-functions-sdk-go` | Go | All versions | None |
| `github.com/edgexfoundry/app-functions-sdk-go/v2` | Go | All versions | 2.1.0 |
| `github.com/edgexfoundry/app-functions-sdk-go/v2` | Go | All versions | 2.1.0 |
| `github.com/edgexfoundry/app-service-configurable` | Go | All versions | 2.1.0 |
| `github.com/edgexfoundry/app-service-configurable` | Go | All versions | 2.1.0 |

Products: Edgexfoundry App Service Configurable, Edgexfoundry Application Functions Software Development Kit, Edgexfoundry Edgex Foundry.

## How do I fix CVE-2021-41278?

Upgrade to a fixed version.

## Is CVE-2021-41278 being exploited?

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

Public exploit code:

- Metabase任意文件读取漏洞批量扫描工具 (github_poc): https://github.com/FDlucifer/CVE-2021-41278

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-41278 and fix it if it is affected.

What it is: CVE-2021-41278 is a medium-severity vulnerability in edgexfoundry app-functions-sdk-go, published on 18 Nov 2021. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2021-41278 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/edgexfoundry/app-functions-sdk-go (Go): affected all versions; no fix listed
- github.com/edgexfoundry/app-functions-sdk-go (Go): affected all versions; no fix listed
- github.com/edgexfoundry/app-functions-sdk-go/v2 (Go): affected all versions; fixed in 2.1.0
- github.com/edgexfoundry/app-functions-sdk-go/v2 (Go): affected all versions; fixed in 2.1.0
- github.com/edgexfoundry/app-service-configurable (Go): affected all versions; fixed in 2.1.0
- github.com/edgexfoundry/app-service-configurable (Go): affected all versions; fixed in 2.1.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-2021-41278/ (Markdown: https://insights.sbomify.com/CVE-2021-41278/index.md)
```

## Sources

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

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