7.5
CWE
94 416
Advisory Published
CVE Published
Updated

CVE-2014-4043: Code Injection

First published: Fri Jun 13 2014(Updated: )

posix_spawn_file_actions_addopen in glibc fails to copy the path argument. Per the specification (<a href="http://pubs.opengroup.org/onlinepubs/000095399/functions/posix_spawn_file_actions_addclose.html">http://pubs.opengroup.org/onlinepubs/000095399/functions/posix_spawn_file_actions_addclose.html</a>) it is supposed to. The result of not copying is that programs can easily trigger use-after-free bugs, or other situations where the path is mutated. The following program demonstrates this issue: #include &lt;string.h&gt; #include &lt;assert.h&gt; #include &lt;fcntl.h&gt; #include &lt;unistd.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/wait.h&gt; #include &lt;stdlib.h&gt; #include &lt;spawn.h&gt; #include &lt;stdio.h&gt; extern char *const *environ; int main() { int res; posix_spawn_file_actions_t fa; posix_spawn_file_actions_init(&amp;fa); char *orig_path = "/tmp/afddsa"; char *path = malloc(strlen(orig_path) + 1); strcpy(path, orig_path); path[strlen(orig_path)] = '\0'; res = posix_spawn_file_actions_addopen( &amp;fa, 1, path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); assert(res == 0); memset(path, 0, strlen(orig_path)); free(path); char *argv[] = {"/bin/echo", NULL}; pid_t pid; res = posix_spawn( &amp;pid, "/bin/echo", &amp;fa, NULL, argv, environ ); assert(res == 0); int status; wait4(pid, &amp;status, 0, NULL); printf("%d\n", WEXITSTATUS(status)); } This bug was jointly discovered by David Reid, Alex Gaynor, and Glyph Lefkowitz. Issue is fixed in glibc 2.20: <a href="https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=89e435f3559c53084498e9baad22172b64429362">https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=89e435f3559c53084498e9baad22172b64429362</a> Recommended additional commit for backporting: <a href="https://sourceware.org/git/?p=glibc.git;a=commit;h=35a5e3e338ae17f3d42c6">https://sourceware.org/git/?p=glibc.git;a=commit;h=35a5e3e338ae17f3d42c6</a> External references: <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=17048">https://sourceware.org/bugzilla/show_bug.cgi?id=17048</a>

Credit: cve@mitre.org

Affected SoftwareAffected VersionHow to fix
redhat/glibc<2.20
2.20
GNU C Library (glibc)<=2.19
openSUSE=13.1

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Reference Links

Frequently Asked Questions

  • What is the severity of CVE-2014-4043?

    CVE-2014-4043 is classified as a medium severity vulnerability.

  • What systems are affected by CVE-2014-4043?

    CVE-2014-4043 affects glibc versions up to 2.19 and specifically glibc 2.20 on Red Hat.

  • How do I fix CVE-2014-4043?

    To fix CVE-2014-4043, update glibc to version 2.20 or later.

  • Can CVE-2014-4043 lead to arbitrary code execution?

    CVE-2014-4043 can potentially lead to issues with file action manipulation, which may impact application security.

  • Is there a workaround for CVE-2014-4043?

    There are no known effective workarounds for CVE-2014-4043; upgrading glibc is recommended.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2025 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203