Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios ssl pinning: add support for iOS 13 #301

Merged
merged 2 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions agent/src/ios/lib/libobjc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ const nativeExports: any = {
moduleName: "libboringssl.dylib",
retType: "pointer",
},

// iOS 13+ libboringssl methods
SSL_set_custom_verify: {
argTypes: ["pointer", "int", "pointer"],
exportName: "SSL_set_custom_verify",
moduleName: "libboringssl.dylib",
retType: "void",
},
};

const api: any = {
Expand All @@ -89,6 +97,8 @@ const api: any = {

SSL_CTX_set_custom_verify: null,
SSL_get_psk_identity: null,

SSL_set_custom_verify: null,
};

// proxy method resolution
Expand All @@ -97,8 +107,9 @@ export const libObjc = new Proxy(api, {

if (target[key] === null) {

target[key] = new NativeFunction(Module.findExportByName(
nativeExports[key].moduleName, nativeExports[key].exportName),
const f = Module.findExportByName(
nativeExports[key].moduleName, nativeExports[key].exportName) || ptr('0');
target[key] = new NativeFunction(f,
nativeExports[key].retType, nativeExports[key].argTypes);
}

Expand Down
5 changes: 4 additions & 1 deletion agent/src/ios/pinning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,11 @@ export namespace sslpinning {

// SSL_CTX_set_custom_verify
const sSLCtxSetCustomVerify = (ident: string): InvocationListener => {
const setCustomVerify = libObjc.SSL_CTX_set_custom_verify;
const getPskIdentity = libObjc.SSL_get_psk_identity;
var setCustomVerify = libObjc.SSL_set_custom_verify;
if (setCustomVerify.isNull()) {
setCustomVerify = libObjc.SSL_CTX_set_custom_verify;
}

if (setCustomVerify.isNull() || getPskIdentity.isNull()) {
return null;
Expand Down