Webmin 2.670 - Medium 6.5 - Remote - Path prefix - Users batch home ACL /home/a also matches /home/ab
Webmin Users and Groups lets you tell a help-desk account: new homes go under this directory, nowhere else. On 2.670 that fence is real on the Create User form. It is not real on batch create. Give them home=/home/a and they can still mkdir /home/ab, because batch compares the first six characters and never puts the slash on.
This is not anonymous. This is not a shell module. Root already handed them Users and Groups. The leftover is the importer, not the form.
Class: Path prefix bypass Reach: Remote (Users and Groups batch create, home ACL without trailing slash)
Webmin 2.670 (3a2b2b86) - Webmin
| ID | no CVE yet |
| Class | Path prefix bypass |
| Reach | Remote (authenticated Users and Groups batch create; home ACL without a trailing slash) |
| CWE | CWE-22 |
| CVSS | Medium: 6.5 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N |
| Product | Webmin |
| Affected | 2.670 (3a2b2b8671c0669c129f5275b3dd1853106ae02b) |
| Auth | signed-in Webmin user with Users and Groups ucreate + batch, home=/home/a, autohome off |
| License | GNU Affero GPL v3.0 |
| Lab | 127.0.0.1:18460 only |
I pinned public tag 2.670 commit 3a2b2b8671c0669c129f5275b3dd1853106ae02b. The lab clones that tag, builds webmin-lab:2.670, and logs in as limited. Batch create of h31batch with home /home/ab succeeds. The same home on save_user.cgi is denied.
Needs an existing Webmin login that already has the Users and Groups module, batch create (or modify), and a home ACL that does not end in /. Default home=/ is the whole disk and is not this leftover. autohome=1 skips the check on both paths.
| Privilege | Method / sink | Recon / integrity / availability | Lab-proven or inferred |
|---|---|---|---|
| Create an OS user whose home is a prefix neighbor of the ACL | Authenticated POST /useradmin/batch_exec.cgi source=2 batch line create:h31batch:...:/home/ab:... | Integrity (passwd + home dir) | Lab-proven. Body Created user h31batch. /home/ab exists. /etc/passwd has h31batch: |
| mkdir that home as the miniserv user | check_user then create_home_directory (batch_exec.cgi:204, user-lib.pl:2775) | Integrity (directory create) | Lab-proven. Home did not exist before the POST |
| Same prefix on modify + movehome | check_user(\%user, \%olduser) then mv (batch_exec.cgi:499, batch_exec.cgi:517) | Integrity (rename home) | Inferred from source. Lab oracle is create |
/home/a/../ab as a batch home | same substr of length(access home) | Integrity | Inferred from source. is_under_directory rejects ..; check_user does not |
| Same helper in LDAP Users batch | ldap-useradmin/batch_exec.cgi:566 | Integrity | Inferred. Same raw prefix. Not this lab |
| Negative control: Create User form | POST /useradmin/save_user.cgi with home /home/ab | n/a | Lab-proven. Denied. No h31save in passwd. /home/ab still the batch home |
Stays closed on this leftover
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Integrity | Single-user create / save | save_user.cgi:237 calls is_under_directory, which appends a slash |
| Integrity | Trailing-slash ACL home=/home/a/ | Raw prefix then fails for /home/ab. The leftover is the ACL without that slash |
| Integrity | autohome=1 | Both CGIs skip the home-root check. That is the documented grant |
| Recon | Anonymous batch | Needs a sid and the useradmin module |
| Integrity | File Manager search / chooser listing | Fixed in 2.670. Not this CGI |
| Integrity | chooser.cgi chroot prefix | Different leftover. Names and mtimes, not user create |
| Integrity | Custom-command injection | Fixed in 2.670. Not this module |
The ACL home is typed in Webmin Users and Groups ACL as a path. Operators type /home/a, not /home/a/. is_under_directory already knew that. check_user did not.
I sat on useradmin/save_user.cgi after the 2.670 File Manager prefix work. That CGI now calls is_under_directory. batch_exec.cgi still has its own check_user that takes substr($home, 0, length($access{home})). Six characters of /home/ab are /home/a.
Wrong turns: treating default home=/ as the hole (the whole disk is the grant); treating File Manager listing as this CGI; treating chooser.cgi chroot as the same prefix; expecting save_user.cgi to also accept /home/ab (it does not; that is the negative); a reverse shell. Theatre.
python3 webmin-batch-home-prefix-Abraxas-Labs.py
or:
cd lab
./run.sh
Clones webmin/webmin tag 2.670 into lab/src, builds webmin-lab:2.670, binds 127.0.0.1:18460. Docker, git, python3. Loopback only.
IOC limited-acl home=/home/a ucreate=1 batch=1 autohome=0
IOC batch_exec status=200 created=1 denied=0
IOC batch-home /home/ab exists=1
IOC save_user status=200 denied=1 passwd=0
SUCCESS WEBMIN-H31-BATCH-PREFIX batch-prefix-home save_user-denied WEBMIN-H31-BATCH-PREFIX
Call is_under_directory($access{'home'}, $user->{'home'}) from check_user the way save_user.cgi already does. Do not compare a raw substr of length($access{'home'}). Append the slash, or refuse .., or both. Same change in ldap-useradmin/batch_exec.cgi.
Until then, put a trailing slash on every Users and Groups home ACL that is meant to be a directory root.
3a2b2b8671c0669c129f5275b3dd1853106ae02b)useradmin/batch_exec.cgi check_useruseradmin/save_user.cgi is_under_directoryweb-lib-funcs.pl is_under_directoryGNU Affero GPL v3.0. See LICENSE. Loopback lab only. No warranty.
Abraxas Labs [email protected]