Skip to content

Commit

Permalink
0.9.5.1 bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
theevilbit committed Feb 9, 2021
1 parent bba0073 commit 13c48e0
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 84 deletions.
20 changes: 13 additions & 7 deletions Extension/ShieldMonitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ -(id)init
self = [super init];
if(self != nil)
{
self.isRunning = NO;
self.monitoredEnvVars = [NSArray arrayWithObjects:@"DYLD_INSERT_LIBRARIES",@"CFNETWORK_LIBRARY_PATH",@"RAWCAMERA_BUNDLE_PATH",@"ELECTRON_RUN_AS_NODE",nil];
/*
ELECTRON_RUN_AS_NODE
https://www.trustedsec.com/blog/macos-injection-via-third-party-frameworks
*/
self.xpc_client = [[XPCAppClient alloc] init];


//for now we don't autostart the es client, and we ensure it's reflected in preferences
self.isRunning = NO;
if (preferences != nil) {
preferences.preferences[@"isRunning"] = @(self.isRunning);
[preferences save];
}

}
return self;
}
Expand Down Expand Up @@ -112,8 +118,8 @@ - (BOOL) monitor
BOOL blocked = NO;
notification[@"type"] = @"";
notification[@"victim_path"] = process.path;
notification[@"attacker_path"] = @"NA";
notification[@"dylib_path"] = @"NA";
notification[@"attacker_path"] = @"-";
notification[@"dylib_path"] = @"-";
notification[@"env"] = @"";//[[process.env valueForKey:@"description"] componentsJoinedByString:@""];
notification[@"arguments"] = [[process.arguments valueForKey:@"description"] componentsJoinedByString:@""];
notification[@"id"] = [NSNumber numberWithUnsignedInt:(u_int)NSDate.date.timeIntervalSince1970];
Expand Down Expand Up @@ -156,10 +162,10 @@ - (BOOL) monitor
if (status == noErr) {
//check code validity
status = SecStaticCodeCheckValidity(staticCode, kSecCSCheckAllArchitectures, requirementRef);
notification[@"type"] = @"dylib";
notification[@"dylib_path"] = path;
notify = YES;
if (status != noErr) {
notification[@"type"] = @"dylib";
notification[@"dylib_path"] = path;
notify = YES;
if([[preferences.preferences objectForKey:@"isBlocking"] boolValue] == NO) {
/*
we notify users about detection, but postpone AUTH decision to later in case
Expand Down
8 changes: 6 additions & 2 deletions Extension/XPCExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//global prefs obj
extern Preferences* preferences;

//global whitelist obj
//global allowlist obj
extern AllowList* allowlist;

//global shield monitor obj
Expand All @@ -32,13 +32,17 @@ @implementation XPCExtension
-(void)startWithReply:(void (^)(es_new_client_result_t))reply
{
es_new_client_result_t started = [shield_monitor start];
preferences.preferences[@"isRunning"] = @(shield_monitor.isRunning);
[preferences save];
reply(started);
}

//stop ES client
-(void)stopWithReply:(void (^)(BOOL))reply
{
BOOL stopped = [shield_monitor stop];
preferences.preferences[@"isRunning"] = @(shield_monitor.isRunning);
[preferences save];
reply(stopped);
}

Expand Down Expand Up @@ -73,7 +77,7 @@ - (void) get_allowlist:(void (^)(NSDictionary *))reply {

-(void)update_allowlist:(NSMutableDictionary *)al reply:(void (^)(BOOL))reply
{
os_log_debug(log_handle, "Updating whitelist");
os_log_debug(log_handle, "Updating allowlist");
allowlist.allowlist_full = al;
reply(YES);
}
Expand Down
136 changes: 78 additions & 58 deletions Shield/Base.lproj/MainMenu.xib

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Shield/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down
22 changes: 14 additions & 8 deletions Shield/NotificationWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<window title="Shield Notification" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="616" height="327"/>
<rect key="contentRect" x="196" y="240" width="812" height="327"/>
<rect key="screenRect" x="0.0" y="0.0" width="1792" height="1095"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="616" height="327"/>
<rect key="frame" x="0.0" y="0.0" width="812" height="327"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EPQ-BZ-vgz">
Expand Down Expand Up @@ -79,7 +79,7 @@
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ANs-jS-eh1">
<rect key="frame" x="548" y="259" width="48" height="48"/>
<rect key="frame" x="744" y="259" width="48" height="48"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="6IO-uJ-gs4"/>
<constraint firstAttribute="width" constant="48" id="AOS-sh-jTk"/>
Expand Down Expand Up @@ -111,17 +111,20 @@
</textFieldCell>
</textField>
<textField identifier="label_arguments" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Pp9-qA-5PE">
<rect key="frame" x="236" y="146" width="35" height="16"/>
<rect key="frame" x="236" y="146" width="514" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="510" id="znK-yQ-kC2"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="OeN-QA-quu">
<font key="font" size="12" name="AvenirNext-Medium"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField identifier="label_env" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="c5e-zl-DEd">
<rect key="frame" x="236" y="123" width="324" height="16"/>
<rect key="frame" x="236" y="123" width="514" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="320" id="vHd-72-1DM"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="510" id="qiP-XH-hN3"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="aah-Gr-ETp">
<font key="font" size="12" name="AvenirNext-Medium"/>
Expand All @@ -130,7 +133,10 @@
</textFieldCell>
</textField>
<textField identifier="label_dylib_path" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KHb-RP-8xv">
<rect key="frame" x="236" y="100" width="35" height="16"/>
<rect key="frame" x="236" y="100" width="514" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="510" id="SQJ-bh-v7h"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="3vg-lb-Jtb">
<font key="font" size="12" name="AvenirNext-Medium"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -195,7 +201,7 @@
<binding destination="e1d-dm-ZGX" name="title" keyPath="values" id="GQ2-LM-zOS"/>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections>
<point key="canvasLocation" x="-260" y="144.5"/>
<point key="canvasLocation" x="-162" y="144.5"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="e1d-dm-ZGX"/>
</objects>
Expand Down
2 changes: 2 additions & 0 deletions ShieldHelper/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSBackgroundOnly</key>
<true/>
<key>LSMinimumSystemVersion</key>
Expand Down
12 changes: 6 additions & 6 deletions ShieldProject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.9.5;
MARKETING_VERSION = 0.9.5.1;
PRODUCT_BUNDLE_IDENTIFIER = com.csaba.fitzl.shield;
PRODUCT_NAME = Shield;
};
Expand All @@ -690,7 +690,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.9.5;
MARKETING_VERSION = 0.9.5.1;
PRODUCT_BUNDLE_IDENTIFIER = com.csaba.fitzl.shield;
PRODUCT_NAME = Shield;
};
Expand All @@ -703,7 +703,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Manual;
CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
CURRENT_PROJECT_VERSION = 48;
CURRENT_PROJECT_VERSION = 50;
DEVELOPMENT_TEAM = 33YRLYRBYV;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Extension/Info.plist;
Expand All @@ -713,7 +713,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.9.5;
MARKETING_VERSION = 0.9.5.1;
PRODUCT_BUNDLE_IDENTIFIER = com.csaba.fitzl.shield.Extension;
PRODUCT_NAME = "$(inherited)";
PROVISIONING_PROFILE_SPECIFIER = mac.shield.extension.dev;
Expand All @@ -728,7 +728,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Manual;
CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
CURRENT_PROJECT_VERSION = 48;
CURRENT_PROJECT_VERSION = 50;
DEVELOPMENT_TEAM = 33YRLYRBYV;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Extension/Info.plist;
Expand All @@ -738,7 +738,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.9.5;
MARKETING_VERSION = 0.9.5.1;
PRODUCT_BUNDLE_IDENTIFIER = com.csaba.fitzl.shield.Extension;
PRODUCT_NAME = "$(inherited)";
PROVISIONING_PROFILE_SPECIFIER = mac.shield.extension.dev;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
<key>Shield System Extension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>Shield.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>0</integer>
</dict>
<key>ShieldHelper.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>2</integer>
</dict>
<key>menuBar.xcscheme_^#shared#^_</key>
<dict>
Expand Down

0 comments on commit 13c48e0

Please sign in to comment.