You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This vulnerability was reported privately a little over a month ago. I did not receive a response.
Describe the bug
Cubic installs a pkexec policy under /usr/share/polkit-1/actions/cubic.policy that allows many subcomponents of it to be run with root privileges without the user needing to provide a password. Among these components are extract-root (for unpacking an Ubuntu ISO's squashfs file while preserving file permissions), and start-console, which is used by Cubic to provide a true root shell within an unpacked ISO root directory. If the ISO unpacked by Cubic provides a user-writable directory (such as /tmp), a malicious user can place an executable into the user-writable directory from outside Cubic, and leverage Cubic's privileges to change the ownership of the executable to root and set the SUID bit. At this point the malicious user can execute the executable from outside Cubic and run arbitrary code on the host as root.
This vulnerability requires the presence of an ISO that Cubic can extract that provides a user-writable directory in its filesystem tree. If that ISO is present or able to be uploaded to the target machine, the vuln may be exploitable if the user can run the extract-root and start-console scripts, even with terminal-only access. It is definitely exploitable if the user has the ability to launch Cubic graphically. I have not attempted to exploit it with terminal-only access, but have succeeded exploiting it on my local system with graphical access.
To Reproduce
Ensure Cubic is installed on the target machine.
Write a simple C binary with the following code and save it as main.c:
Open and extract an ISO that provides a user-writable directory in its squashfs. The Kubuntu 24.04 ISO is suitable for this. I used a pre-existing project based on Kubuntu for this exploit. The directory we will be using in the ISO is /tmp, which has 1777 permissions.
Enter the virtual environment. You will not be prompted for a password and will be given a root shell confined to the ISO's root directory.
Run umount /tmp in the virtual environment. (By default /tmp will have a tmpfs mounted on it within the virtual environment, whereas we want access to the underlying directory on the host's disk.)
On the host machine, cp a.out /path/to/cubic/project/custom-root/tmp/ (replacing /path/to/cubic/project/ as appropriate - for me it's ~/Cubic/.)
In the virtual environment, run chown root:root /tmp/a.out && chmod u+s /tmp/a.out. This sets the ownership of the executable to root:root and sets the SUID bit on it.
Exit the virtual environment.
On the host, run /path/to/cubic/project/custom-root/tmp/a.out. You will be granted a root shell without a password.
Expected behavior
I should be required to use an account with sudoers rights and should be required to provide my password to do any actions that require root with Cubic, including unpack the ISO and enter the virtual environment. It may be possible for Cubic to take the user's password once upon start, and then use it as necessary to elevate privileges.
Notes
While this vulnerability primarily leverages extract-root and start-console from Cubic, there are several other Cubic components that can be run as root without a password due to their pkexec policy, that look dangerous, such as copy-path, delete, move-path, replace-text, stop-process, test-command, and likely more.
OS Information (please complete the following information):
OS/Distro Name: Kubuntu
OS Version 24.04 LTS
Cubic Information (please complete the following information):
This vulnerability was reported privately a little over a month ago. I did not receive a response.
Describe the bug
Cubic installs a pkexec policy under
/usr/share/polkit-1/actions/cubic.policythat allows many subcomponents of it to be run with root privileges without the user needing to provide a password. Among these components areextract-root(for unpacking an Ubuntu ISO's squashfs file while preserving file permissions), andstart-console, which is used by Cubic to provide a true root shell within an unpacked ISO root directory. If the ISO unpacked by Cubic provides a user-writable directory (such as/tmp), a malicious user can place an executable into the user-writable directory from outside Cubic, and leverage Cubic's privileges to change the ownership of the executable torootand set the SUID bit. At this point the malicious user can execute the executable from outside Cubic and run arbitrary code on the host as root.This vulnerability requires the presence of an ISO that Cubic can extract that provides a user-writable directory in its filesystem tree. If that ISO is present or able to be uploaded to the target machine, the vuln may be exploitable if the user can run the
extract-rootandstart-consolescripts, even with terminal-only access. It is definitely exploitable if the user has the ability to launch Cubic graphically. I have not attempted to exploit it with terminal-only access, but have succeeded exploiting it on my local system with graphical access.To Reproduce
main.c:gcc main.c./tmp, which has1777permissions.umount /tmpin the virtual environment. (By default/tmpwill have a tmpfs mounted on it within the virtual environment, whereas we want access to the underlying directory on the host's disk.)cp a.out /path/to/cubic/project/custom-root/tmp/(replacing/path/to/cubic/project/as appropriate - for me it's~/Cubic/.)chown root:root /tmp/a.out && chmod u+s /tmp/a.out. This sets the ownership of the executable toroot:rootand sets the SUID bit on it./path/to/cubic/project/custom-root/tmp/a.out. You will be granted a root shell without a password.Expected behavior
I should be required to use an account with sudoers rights and should be required to provide my password to do any actions that require root with Cubic, including unpack the ISO and enter the virtual environment. It may be possible for Cubic to take the user's password once upon start, and then use it as necessary to elevate privileges.
Notes
While this vulnerability primarily leverages
extract-rootandstart-consolefrom Cubic, there are several other Cubic components that can be run as root without a password due to their pkexec policy, that look dangerous, such ascopy-path,delete,move-path,replace-text,stop-process,test-command, and likely more.OS Information (please complete the following information):
Cubic Information (please complete the following information):
202402210133ubuntu24.04.1Cubic Log:
N/A
Video
untitled.mp4