bugJailkit - Bugs: bug #58213, Problem with jailhome definition

 
 

bug #58213: Problem with jailhome definition

Submitter:  Cyprien Pouzenc <cypouz>
Submitted:  Mon 20 Apr 2020 03:13:05 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 24 Jul 2020 08:58:51 PM UTC, comment #1: 

thanks, fixed in revision: 1.40

Olivier Sessink <oli4>
Group administrator
Mon 20 Apr 2020 03:13:05 PM UTC, original submission:  

In `jk_jailuser` file, there is a problem with the definition of the `jailhome` variable. I think the problem is in the bloc of the `addusertojail()` function definition:


        if (dirinjail(pw[5], jail)):
                if (pw[5][0:len(jail)+3] == jail+'/./'):
                        jailhome = pw[5][len(jail)+2:]
                else:
                        jailhome = pw[5][len(jail):]
        else:
                jailhome = pw[5]


If my jail directory is `/home/jail` and my user to jail is `alice`, so `(dirinjail(pw[5], jail))` is false because /home/jail is not equal to /home/alic (without the `e` because of `len(jail)` in `dirinjail()` function). In this case, jailhome = /home/alice. It's OK.

If my jail directory is `/home/jail` and my user to jail is `jailalice`, so `(dirinjail(pw[5], jail))` is true because /home/jail is equal to /home/jail (in fact /home/jailalice truncated, due to `len(jail)` in `dirinjail()` function). In this case, jailhome = alice. Not `/home/jailalice`. It's a problem because, in `/home/jail/etc/passwd`, the home directory of jailalice user will be `alice`, not `/home/jailalice`.

In short, the user to jail must not begin with the same word as the jail directory. This case is not tested in `jk_jailuser` file. Or the `jailhome` definition must to be changed.

Cyprien Pouzenc <cypouz>

 

(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 oli4 (Posted a comment)
  • -email is unavailable- added by cypouz (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-24 oli4 StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code