Bug 459470 - kernel: binfmt_misc.c: avoid potential kernel stack overflow [rhel-2.1-ia64]
kernel: binfmt_misc.c: avoid potential kernel stack overflow [rhel-2.1-ia64]
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: kernel (Show other bugs)
2.1
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Don Howard
Martin Jenner
:
: 459473 (view as bug list)
Depends On: 459462
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-19 03:56 EDT by Eugene Teo (Security Response)
Modified: 2008-08-20 12:18 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-08-20 12:18:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eugene Teo (Security Response) 2008-08-19 03:56:17 EDT
+++ This bug was initially created as a clone of Bug #459462 +++

Description of problem:
Register the ":text:E::txt::/root/cat.txt:' rule in binfmt_misc (by root) and try launching the cat.txt file (by anyone) :) The result is - the endless recursion in the load_misc_binary -> open_exec -> load_misc_binary chain and stack overflow.

There's a similar problem with binfmt_script, and there's a sh_bang memner on linux_binprm structure to handle this, but simply raising this in binfmt_misc may break some setups when the interpreter of some misc binaries is a script.

So the proposal is to turn sh_bang into a bit, add a new one (the misc_bang) and raise it in load_misc_binary.  After this, even if we set up the misc -> script -> misc loop for binfmts one of them will step on its own bang and exit.

Note that this can be triggered with root help only.

http://lkml.org/lkml/2008/3/13/245

--- Additional comment from eteo@redhat.com on 2008-08-19 03:17:02 EDT ---

Proposed upstream patch:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3a2e7f47d71e1df86acc1dda6826890b6546a4e1

--- Additional comment from eteo@redhat.com on 2008-08-19 03:17:35 EDT ---

(In reply to comment #1)
> Proposed upstream patch:
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3a2e7f47d71e1df86acc1dda6826890b6546a4e1

Note that there is a regression. See http://lkml.org/lkml/2008/8/18/544. The patch is not in upstream yet AFAIK.
Comment 2 Eugene Teo (Security Response) 2008-08-19 04:22:54 EDT
*** Bug 459473 has been marked as a duplicate of this bug. ***
Comment 3 Don Howard 2008-08-20 12:18:59 EDT
I can confirm that this reproducible on 2.1.

However, it doesn't rise to the level of critical bugfix, given that root-owned files must be mis-configured.

Note You need to log in before you can comment on or make changes to this bug.