FreeRDP winpr-makecert writes private keys with weak permissions
Key facts
- Attack vector
- Local
- Privileges required
- Low
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Security bypass
- Confidentiality · integrity · availability
- High · High · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-2jfv-j3wx-5cg4. Fix status from GitHub. Impact type from CWE-798.
Summary
FreeRDP from 2.0.0 through 3.31.1 includes winpr-makecert, which on Unix writes unencrypted private keys without enforcing owner-only permissions (CWE-732). A local user with low privileges can read the key when the output directory is traversable and the umask is permissive, and the PFX export falls back to the fixed password password when none is supplied.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
On Unix, FreeRDP 3.31.1's `winpr-makecert` creates unencrypted private keys using `winpr_fopen(fullpath, "w+")` and never enforces an owner-only mode. A new file therefore receives `0666 & ~umask`. Under the common `0022` umask, `<name>.key` is mode 0644. Any unprivileged local account that can traverse the output directory receives read access to the private key. The key is serialized without encryption in `winpr/tools/makecert/makecert.c`: ```c fp = winpr_fopen(fullpath, "w+"); if (!fp) goto out_fail; if (!PEM_write_bio_PrivateKey(bio, context->pkey, nullptr, nullptr, 0, nullptr, nullptr)) goto out_fail; ``` PFX output uses the same file creation mode. If the caller omits `-p`, the tool substitutes the fixed public password `password` and passes it to `PKCS12_create`: ```c if (!context->password) { context->password = _strdup("password"); printf("Using default export password \"password\"\n"); } context->pkcs12 = PKCS12_create(context->password, context->default_name, context->pkey, context->x509, nullptr, 0, 0, 0, 0, 0); ``` The included checksum-pinned 3.31.1 reproduction observes a 0644 key under umask `0022`. The same operation under umask `0077` yields 0600, confirming that privacy depends entirely on ambient process state. The default-generated PFX is also 0644; OpenSSL opens it with `password` and rejects a different password. Direct source inspection verifies both behaviors in stable releases 2.0.0, 3.0.0, and 3.31.1. They remain in current development source. No exact public advisory or fixed release was identified. This is not remotely triggerable over RDP. Direct local disclosure requires a multi-user host, a permissive umask, and an output directory the attacker can traverse. A private directory or restrictive umask mitigates direct access but does not make the tool's file creation safe. Supplying a strong explicit `-p` avoids the fixed-password PFX subcase but does not correct file permissions. ### Remediation Create private-key and PFX outputs atomically with explicit owner-only permissions, independent of umask, and refuse unsafe existing destinations. Require an explicit PFX password or obtain one through a secure interactive prompt; do not provide a fixed fallback. Add regression tests under umask `0022` and `0077` and verify that omission of a PFX password fails safely. ### Proof of concept The runner requires a POSIX shell, curl, SHA-256 utilities, tar, CMake, a C compiler, pkg-config, OpenSSL, and OpenSSL development files. It downloads and verifies FreeRDP 3.31.1, builds unmodified `winpr-makecert`, and runs positive and negative controls. ```sh cd poc ./run.sh ``` Observed output: ```text verified FreeRDP 3.31.1 archive sha256=254de9fe176758e9787347469fb310523782f03c61130508b51b266e374eb6c1 permissive_umask_key_mode=644 restrictive_umask_key_mode=600 makecert_default_password_message=Using default export password "password" permissive_umask_pfx_mode=644 pfx_command_status=0 default_password_status=0 wrong_password_status=1 all positive and negative controls behaved as expected ``` <!-- BEGIN FILE: poc/run.sh --> ```sh #!/bin/sh set -eu VERSION=3.31.1 ARCHIVE_SHA256=254de9fe176758e9787347469fb310523782f03c61130508b51b266e374eb6c1 ARCHIVE_URL="https://github.com/FreeRDP/FreeRDP/archive/refs/tags/${VERSION}.tar.gz" SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) WORK_DIR="${SCRIPT_DIR}/.work" ARCHIVE="${WORK_DIR}/freerdp-${VERSION}.tar.gz" SOURCE_DIR="${WORK_DIR}/FreeRDP-${VERSION}" BUILD_DIR="${WORK_DIR}/build" MAKECERT="${BUILD_DIR}/winpr/tools/makecert-cli/winpr-makecert" cleanup() { rm -rf "${WORK_DIR}" } trap cleanup EXIT HUP INT TERM for command in curl sha256sum tar cmake cc pkg-config stat openssl; do if ! command -v "${command}" >/dev/null 2>&1; then echo "missing required command: ${command}" >&2 exit 2 fi done if ! pkg-config --exists openssl; then echo "missing OpenSSL development files (pkg-config module: openssl)" >&2 exit 2 fi rm -rf "${WORK_DIR}" mkdir -p "${WORK_DIR}" if [ -n "${FREERDP_ARCHIVE:-}" ]; then cp "${FREERDP_ARCHIVE}" "${ARCHIVE}" else curl --fail --location --retry 3 --output "${ARCHIVE}" "${ARCHIVE_URL}" fi printf '%s %s\n' "${ARCHIVE_SHA256}" "${ARCHIVE}" | sha256sum --check --status echo "verified FreeRDP ${VERSION} archive sha256=${ARCHIVE_SHA256}" tar -xzf "${ARCHIVE}" -C "${WORK_DIR}" if ! cmake -S "${SOURCE_DIR}" -B "${BUILD_DIR}" \ -DCMAKE_BUILD_TYPE=Release \ -DWITH_CLIENT_COMMON=OFF -DWITH_CLIENT=OFF -DWITH_SERVER=OFF -DWITH_CHANNELS=OFF \ -DWITH_SHADOW=OFF -DWITH_PROXY=OFF -DWITH_SAMPLE=OFF \ -DWITH_OPENSSL=ON -DWITH_MBEDTLS=OFF -DWITH_PCSC=OFF \ -DWITH_CUPS=OFF -DWITH_FFMPEG=OFF -DWITH_SWSCALE=OFF -DWITH_OPUS=OFF \ -DWITH_GSSAPI=OFF -DWITH_KRB5=OFF -DWITH_X11=OFF -DWITH_WAYLAND=OFF \ -DWITH_MANPAGES=OFF -DBUILD_TESTING=OFF >"${WORK_DIR}/configure.log" 2>&1; then cat "${WORK_DIR}/configure.log" >&2 exit 1 fi if ! cmake --build "${BUILD_DIR}" --target winpr-makecert --parallel "${JOBS:-2}" \ >"${WORK_DIR}/build.log" 2>&1; then tail -n 200 "${WORK_DIR}/build.log" >&2 exit 1 fi mkdir -p "${WORK_DIR}/permissive" "${WORK_DIR}/restrictive" "${WORK_DIR}/pfx" ( umask 0022 "${MAKECERT}" -path "${WORK_DIR}/permissive" alice >/dev/null ) permissive_mode=$(stat -c '%a' "${WORK_DIR}/permissive/alice.key") echo "permissive_umask_key_mode=${permissive_mode}" if [ "${permissive_mode}" != 644 ]; then echo "expected mode 0644 under umask 0022" >&2 exit 1 fi ( umask 0077 "${MAKECERT}" -path "${WORK_DIR}/restrictive" alice >/dev/null ) restrictive_mode=$(stat -c '%a' "${WORK_DIR}/restrictive/alice.key") echo "restrictive_umask_key_mode=${restrictive_mode}" if [ "${restrictive_mode}" != 600 ]; then echo "expected mode 0600 under umask 0077" >&2 exit 1 fi set +e ( umask 0022 "${MAKECERT}" -format pfx -path "${WORK_DIR}/pfx" alice ) >"${WORK_DIR}/pfx.stdout" 2>"${WORK_DIR}/pfx.stderr" pfx_command_status=$? set -e if grep -Fq 'Using default export password "password"' "${WORK_DIR}/pfx.stdout"; then echo 'makecert_default_password_message=Using default export password "password"' else cat "${WORK_DIR}/pfx.stdout" >&2 cat "${WORK_DIR}/pfx.stderr" >&2 echo "makecert did not announce the expected default PFX password" >&2 exit 1 fi test -s "${WORK_DIR}/pfx/alice.pfx" pfx_mode=$(stat -c '%a' "${WORK_DIR}/pfx/alice.pfx") echo "permissive_umask_pfx_mode=${pfx_mode}" echo "pfx_command_status=${pfx_command_status}" if [ "${pfx_mode}" != 644 ]; then echo "expected PFX mode 0644 under umask 0022" >&2 exit 1 fi openssl pkcs12 -in "${WORK_DIR}/pfx/alice.pfx" -passin pass:password -noout echo "default_password_status=0" set +e openssl pkcs12 -in "${WORK_DIR}/pfx/alice.pfx" -passin pass:not-the-password -noout \ >"${WORK_DIR}/wrong-password.stdout" 2>"${WORK_DIR}/wrong-password.stderr" wrong_password_status=$? set -e echo "wrong_password_status=${wrong_password_status}" if [ "${wrong_password_status}" -eq 0 ]; then echo "unexpectedly opened PFX with the negative-control password" >&2 exit 1 fi echo "all positive and negative controls behaved as expected" ``` <!-- END FILE: poc/run.sh -->
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | FreeRDP (c) | >= 2.0.0, <= 3.31.1 | 3.32.0 | Patch available | GHSA-2jfv-j3wx-5cg4 |
- FreeRDP (c) Vendor— Affected >= 2.0.0, <= 3.31.1 Fixed in 3.32.0 Patch available GHSA-2jfv-j3wx-5cg4
Remediation
Upgrade FreeRDP to 3.32.0, which fixes this issue. The sources list no other fixed version for FreeRDP.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-2jfv-j3wx-5cg4 FreeRDP (c) Fixed in 3.32.0 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-2jfv-j3wx-5cg4
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences