Bug 1653855 (CVE-2018-16864)
Summary: | CVE-2018-16864 systemd: stack overflow when calling syslog from a command with long cmdline | ||
---|---|---|---|
Product: | [Other] Security Response | Reporter: | Laura Pardo <lpardo> |
Component: | vulnerability | Assignee: | Red Hat Product Security <security-response-team> |
Status: | CLOSED ERRATA | QA Contact: | |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | unspecified | CC: | abhgupta, bmcclain, chris.snell, crrobins, dbaker, dblechte, dfediuck, eedri, hagberg, igeorgex, jjarvis, jokerman, kent, lnykryn, lpoetter, marek.pawlowski, mgoldboi, michal.skrivanek, msekleta, mvanderw, redhat, rschiron, santony, sardella, sbonazzo, security-response-team, sherold, s, sthangav, systemd-maint-list, systemd-maint, trankin, yturgema, zbyszek, zjedrzej |
Target Milestone: | --- | Keywords: | Security |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: |
An allocation of memory without limits, that could result in the stack clashing with another memory region, was discovered in systemd-journald when a program with long command line arguments calls syslog. A local attacker may use this flaw to crash systemd-journald or escalate privileges.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2019-06-10 10:43:16 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 1657788, 1657789, 1659838, 1662792, 1662793, 1664972, 1664976, 1666015, 1666016, 1724850 | ||
Bug Blocks: | 1653451 |
Description
Laura Pardo
2018-11-27 18:46:17 UTC
This boils down to a large alloca(), making it possible to jump the stack pointer into the heap and corrupt the heap region (a "Stack Clash" attack). Since the alloca()ed region is completely written, this will eventually lead to a crash. The reporters describe achieving code execution by combining the attack with a thread race inside journald, with careful timing they are able to attack the stack of a neighbouring thread which will return to the attacker's pointer before the crash occurs. Some restriction is placed on this attack by get_process_cmdline() substituting ' ' for all non-printable characters; this makes code execution more difficult to achieve. This vulnerability was introduced in systemd v203. Acknowledgments: Name: Qualys Research Labs Function dispatch_message_real() in journal/journald-server.c constructs a record to write to the journal by converting each field to a string with the format "<field-name>=<field-value". Such strings are constructed by using the strjoina() function defined in basic/string-util.h, which allocates the resulting string on the stack with alloca(). If an attacker is able to make the stack clash with another memory region by providing a large attacker-controlled string, it is possible to overwrite the other region's data, causing crashes or possibly gaining code execution. In this particular case, a process may have a big cmdline (as read from /proc/<pid>/cmdline) that could clash the stack and crash systemd-journald or gain code execution from within systemd-journald's context. If systemd is compiled with -fstack-clash-protection flag, like in Fedora 28/29, the flaw is not exploitable because stack clashing is prevented. Small fix to comment 0 (stack buffer overflow vs stack overflow) > A flaw was found in systemd-journald. A stack buffer overflow when passing several MB of arguments to a program calling syslog function. A stack overflow flaw was found in systemd-journald when passing several MB of arguments to a program calling syslog() function. Statement: This issue affects the versions of systemd as shipped with Red Hat Enterprise Linux 7. Red Hat Product Security has rated this issue as having a security impact of Important because it allows a local attacker to crash systemd-journald or escalate his privileges. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/. Created systemd tracking bugs for this issue: Affects: fedora-all [bug 1664972] External References: https://www.qualys.com/2019/01/09/system-down/system-down.txt This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2019:0049 https://access.redhat.com/errata/RHSA-2019:0049 This issue has been addressed in the following products: Red Hat Enterprise Linux 7.5 Extended Update Support Via RHSA-2019:0204 https://access.redhat.com/errata/RHSA-2019:0204 Mitigation: To increase the time an attacker needs to exploit this flaw you could override the `StartLimitInterval=` (called StartLimitIntervalSec in newer systemd versions) and `StartLimitBurst=` settings. In this way the attack may require much longer to be successful. To edit the journald service use `sudo systemctl edit systemd-journald.service` and add: ``` [Service] StartLimitInterval=120 StartLimitBurst=3 ``` This issue has been addressed in the following products: Red Hat Enterprise Linux 7.4 Extended Update Support Via RHSA-2019:0271 https://access.redhat.com/errata/RHSA-2019:0271 This issue has been addressed in the following products: Red Hat Virtualization 4 for Red Hat Enterprise Linux 7 Via RHSA-2019:0342 https://access.redhat.com/errata/RHSA-2019:0342 This issue has been addressed in the following products: Red Hat Virtualization 4 for Red Hat Enterprise Linux 7 Via RHSA-2019:0361 https://access.redhat.com/errata/RHSA-2019:0361 This issue has been addressed in the following products: Red Hat Enterprise Linux 7.3 Advanced Update Support Red Hat Enterprise Linux 7.3 Update Services for SAP Solutions Red Hat Enterprise Linux 7.3 Telco Extended Update Support Via RHSA-2019:2402 https://access.redhat.com/errata/RHSA-2019:2402 |