Skip to content

Executable Stack

Moderate
Lukasa published GHSA-9556-94c5-c3j8 Nov 25, 2019

Package

swift-nio-ssl (Swift Package Manager)

Affected versions

2.0.0<=2.4.0

Patched versions

2.4.1

Description

swift-nio-ssl from 2.0.0 to 2.4.0 inclusive on Linux suffered from a bug where the stack of any program using it would accidentally be mapped both writable and executable. This occurred due to the linker on Linux choosing to make the stack executable if the linked output contained any assembly file that did not contain a GNU-stack section with the appropriate content. This was missed when porting the build over from BoringSSL's upstream build, which passes a linker flag to amend this issue.

This cascades into the rest of the linkage process, causing many other binaries to be mapped rwx as well, in addition to the heap. This drastically weakens the security of the process in the face of buffer overflows or other memory mismanagement.

As SwiftPM does not allow us to pass a linker flag, this is fixed by amending the source files to add this section to the assembled output when it is relevant.

All affected users should update to 2.4.1, which contains a fix. If an update is not possible, one appropriate workaround is to build your SwiftPM project with -Xlinker -z -Xlinker noexecstack as extra flags to swift build. This will correctly flag the stack as non-executable.

Severity

Moderate

CVE ID

CVE-2019-8849

Weaknesses

No CWEs