-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of TunnelVision exploit detection
- Loading branch information
1 parent
f9fbb59
commit 34599ae
Showing
6 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
LocalPackages/NetworkProtectionMac/Sources/VPNGuardian/VPNGuardian.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// VPNGuardian.m | ||
// NetworkProtectionMac | ||
// | ||
// Created by ddg on 10/15/24. | ||
// | ||
|
||
#import "VPNGuardian.h" | ||
#import "SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h" | ||
|
||
@implementation VPNGuardian | ||
|
||
- (NSData *)getDHCPOption121 { | ||
SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("DHCPOptionDetector"), NULL, NULL); | ||
if (!store) return nil; | ||
|
||
// Create a key pattern to match the relevant network service entity for IPv4 DHCP | ||
CFStringRef dhcpPattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, | ||
kSCDynamicStoreDomainState, // domain = "State:" | ||
kSCCompAnyRegex, // serviceID = "[^/]+" (1 or more non-slash chars) | ||
kSCEntNetDHCP // entity = "DHCP" | ||
); | ||
|
||
CFDictionaryRef dhcpInfo = SCDynamicStoreCopyDHCPInfo(store, NULL); | ||
if (!dhcpInfo) { | ||
CFRelease(dhcpPattern); | ||
CFRelease(store); | ||
return nil; | ||
} | ||
|
||
CFDataRef optionData = DHCPInfoGetOptionData(dhcpInfo, 121); | ||
NSData *result = nil; | ||
|
||
if (optionData) { | ||
CFRetain(optionData); | ||
result = CFBridgingRelease(optionData); | ||
} | ||
|
||
CFRelease(dhcpInfo); | ||
CFRelease(dhcpPattern); | ||
CFRelease(store); | ||
|
||
return result; | ||
} | ||
|
||
@end |
16 changes: 16 additions & 0 deletions
16
LocalPackages/NetworkProtectionMac/Sources/VPNGuardian/include/VPNGuardian.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// DHCPOptionDetector.h | ||
// NetworkProtectionMac | ||
// | ||
// Created by ddg on 10/15/24. | ||
// | ||
|
||
|
||
#import <Foundation/Foundation.h> | ||
#import <SystemConfiguration/SystemConfiguration.h> | ||
|
||
@interface VPNGuardian : NSObject | ||
|
||
- (nullable NSData *)getDHCPOption121; | ||
|
||
@end |
4 changes: 4 additions & 0 deletions
4
LocalPackages/NetworkProtectionMac/Sources/VPNGuardian/include/module.private.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module VPNGuardian { | ||
header "VPNGuardian.h" // or any other public header you want to expose | ||
export * | ||
} |