rofl0r / rofl0r/proxychains-ng

Add support for macOS connectx? (Used by Objective-C API's in many GUI applications)

Open
#342 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
10.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

The Objective-C API's on macOS don't use the connect function under the hood, instead they use connectx which according to the man page is like a combination of bind and connect.

The parameter socket is a socket. In general, connectx() may be used as a substitute for cases when bind(2) and connect(2) are issued in succession, as well as a mechanism to transmit data at connection establishment time.

Since this function doesn't appear to be hooked, code that uses these API's bypass proxychains completely.

Here's a sample program that demonstrates the issue:

// clang -framework Foundation main.m -o main

#import <Foundation/Foundation.h>
#include <unistd.h>

int done = 0;

int main(int argc, const char * argv[]) {
	@autoreleasepool {
		NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
		[request setHTTPMethod:@"GET"];
		[request setURL:[NSURL URLWithString:@"http://icanhazip.com/"]];
		[
			[
				[NSURLSession sharedSession]
				dataTaskWithRequest:request
				completionHandler:^(
					NSData * _Nullable data,
					NSURLResponse * _Nullable response,
					NSError * _Nullable error
				) {
					NSString *myString = [
						[NSString alloc]
						initWithData:data
						encoding:NSUTF8StringEncoding
					];
					NSLog(@"Data received: %@", myString);
					done = 1;
				}
			]
			resume
		];
	}
	while (!done) {
		usleep(1);
	}
	return 0;
}

Support for connectx would greatly improve compatibility with macOS software.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling and running the Objective-C sample in main.m, then compare its connectx behavior with the repository's existing socket-call hooks and the macOS connectx documentation. Done means connectx-based macOS traffic no longer bypasses proxychains, with the sample providing a reproducible check.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos, objective-c
Domain
networking, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.