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

Not working with Facebook #13

Open
JohnCoates opened this issue Mar 18, 2016 · 83 comments
Open

Not working with Facebook #13

JohnCoates opened this issue Mar 18, 2016 · 83 comments
Labels

Comments

@JohnCoates
Copy link

First of all, very cool project!

I was trying out the latest release with the Facebook app and it's not working for me. Tried a reboot. Works fine in Safari. Console notifies of it being loaded. Screenshot from Charles Proxy included. Tried with Burp also, same error. Apple App Store gets intercepted just fine.
screen shot 2016-03-18 at 1 29 50 am

@nabla-c0d3
Copy link
Owner

Hello,
I just tried and can confirm that is not working. There are a few network calls initiated by classes that explicitly check the certificate (GCDAsyncSocket, FBMQTTNativeClient, RCTSRWebSocket). I will need to think of a way to generically disable this type of certificate check, which might be difficult. Will look into it when I have time.

@Grazfather
Copy link

Hm, I actually can't reproduce. I'm using facebook 52.0 with mitmproxy and my script is successfully pulling out the email and password from my login attempts.

@Grazfather
Copy link

Seems that it's certain APIs. graph.facebook.com and api.facebook.com fail, but I could register an account through b-api.facebook.com/ without issue.

@nabla-c0d3
Copy link
Owner

Yes, it is specific APIs.

@isayeter
Copy link

It is not working on my phone too, any update ?

@kopiro
Copy link

kopiro commented Jun 17, 2016

Any update?

@alfondotnet
Copy link

alfondotnet commented Jul 30, 2016

@nabla-c0d3 , I assume it's similar for Facebook's messenger app, tried a bunch of things with no luck, I wish I knew more in this domain to be able to help.

@kopiro
Copy link

kopiro commented Jul 31, 2016

@nabla-c0d3
Copy link
Owner

nabla-c0d3 commented Aug 6, 2016

GCDAsyncSocket actually does SSL pinning with the usual SecureTransportAPI that's already taken care of by SSL Kill Switch ( https://github.com/robbiehanson/CocoaAsyncSocket/blob/master/Source/GCD/GCDAsyncSocket.m#L6794 )
The remaining classes to patch are FBMQTTNativeClientand RCTSRWebSocket (most likely this https://github.com/facebook/react-native/blob/master/Libraries/WebSocket/RCTSRWebSocket.h#L114 ) which I will look at whenever I have time.

@AdrienMangoo
Copy link

Any new clues about facebook ?

Thanks

@ghost
Copy link

ghost commented Sep 8, 2016

Simple fix for that is to hook RCTSRWebSocket function called _checkHandshake

@nabla-c0d3
Copy link
Owner

I tried disabling pinning in FBMQTTNativeClientand, RCTSRWebSocket and FBSSLPinningVerifier but it still wasn't enough. I'll look into again when I have time.

@liuxuan30
Copy link

@nabla-c0d3 what you mean by 'still wasn't enough'? It work partially or not work at all?

@liuxuan30
Copy link

@karek314 can you jus tell me how to bypass Facebook app SSL pining for now as a work around? I am ok to inject tweaks? I tried to let _checkHandshake return YES, however, no luck

@liuxuan30
Copy link

From what I found is FBNetworkerRequest class is handling the requests and reponses like graph.facebook.com, however, not finding a way to bypass SSL pinning.

@AdrienMangoo
Copy link

I did some research, and didn't find yet a solution. @liuxuan30 did you get more results on your side ?

@liuxuan30
Copy link

as I said, I just found that the API requests are sending out by FBNetworkerRequest. I don't find how FBNetworkerRequest enforce SSL pinning.

@ch3repatz
Copy link

ch3repatz commented Sep 29, 2016

https://twitter.com/CodeDigging/status/781468522815819776

@alfondotnet
Copy link

@ch3repatz Impatiently awaiting for details 👍

@ch3repatz
Copy link

@alfonsoperez hope the author will share his research, not just the screenshot

@nabla-c0d3
Copy link
Owner

This is still on my TODO list, I just haven't had time to look at this again.

@liuxuan30
Copy link

@ch3repatz can't wait.. why just a screenshot

@ch3repatz
Copy link

@liuxuan30 I don't know, ask the author of research please. I just found the tweet and copied here.

@liuxuan30
Copy link

liuxuan30 commented Sep 30, 2016

Just asked and get a reply:"Do you mind sharing?"; "No, it's a non-public research for my customer."
So we are still on our own LOL

@ch3repatz
Copy link

@liuxuan30 sad :(
Ok, let's wait for update from @nabla-c0d3

@liuxuan30
Copy link

liuxuan30 commented Sep 30, 2016

actually can we have synergy here not just depending on @nabla-c0d3 ? I was able to track down to FBNetworkerRequest it get the response data, but can't find where it do the ssl pining

@xuanliu-aa
Copy link

@nabla-c0d3 I found that I hooked GCDAsyncSocket ssl related functions, but no one get called. Seems it's not using GCDAsyncSocket at all? Can anyone double check?

@nabla-c0d3
Copy link
Owner

nabla-c0d3 commented Oct 12, 2016

It's not used in the flows that I have seen. Same with FBMQTTNativeClientand, RCTSRWebSocket and FBSSLPinningVerifier. Overall it's unclear to me where the pinning validation logic is happening during the login flow, but I haven't had time to look at it that much.

@liuxuan30
Copy link

@nabla-c0d3 np, I just looked into it and want to save your time when you sit down and working on this. What I find is that the upper FBNetworkerRequest is sending the FB api requests, and doing the ssl pining somewhere in the process.
it not uses FBSSLPinningVerifier in its api network e.g. graph.facebook.com

@bruno-rocha-movile
Copy link

It also doesn't work with World of Warcraft Armory, It works correctly until you login, then it doesn't catch anything besides the regular google analytics calls

@ghost
Copy link

ghost commented Aug 17, 2018

@mdbrelo look for string "openssl", usually it has embedded path, if that fails for some reason you can try locate some openssl specific strings.
https://github.com/openssl/openssl/tree/OpenSSL_1_1_0-stable

@mdbrelo
Copy link

mdbrelo commented Aug 17, 2018

great. I'm trying to learn how to use ida and asm language but it's really hard

@liuxuan30
Copy link

@karek314 any ETA you would file a PR for this? Very interested.

@ghost
Copy link

ghost commented Aug 20, 2018

@liuxuan30 I will when I'll have more time, right now you can just use https://github.com/karek314/hexbytescanner and patch binaries manually before deploying them.

@dedfft
Copy link

dedfft commented Sep 11, 2018

Could please anybody share the final ipa for Facebook with patched ssl pinning? Unfortunately i dont have any framework for patching it myself(

@asad0x01
Copy link

asad0x01 commented Sep 11, 2018 via email

@dedfft
Copy link

dedfft commented Sep 11, 2018

U have the facebook patched ipa? Could you please share it?
It is my passion to study https of facebook and that kills me that i am unable to patch it myself to see(((

@asad0x01
Copy link

@dedfft you can use this guide by @phwd https://www.facebook.com/113702895386410/videos/1466262083463811/ .Let me know if you need IPA :)

@dedfft
Copy link

dedfft commented Sep 11, 2018

Hello Asad, thank you for the video hint! I have already watched it this year several times, unfortunately i was unable to replicate the procedure several times and was disappointed in myself..

I am curios not in the process of debugging of an ipa, but more in looking at how facebook works inside..
If you could share already patched ipa with me, it would be amazing!

Could you? If that is not too much to ask. Please

@asad0x01
Copy link

asad0x01 commented Sep 12, 2018 via email

@liuxuan30
Copy link

@asad0x01 I would also want to have one thank you. email is [email protected]

@kewtvvw
Copy link

kewtvvw commented Sep 14, 2018

@dedfft you can use this guide by @phwd https://www.facebook.com/113702895386410/videos/1466262083463811/ .Let me know if you need IPA :)

@asad0x01 can you share .ipa file with me as well? email: [email protected].
Many thanks!

@asad0x01
Copy link

Hey sorry guys.The latest Facebook app is crashing.Still I'm able to intercept https request of other apps.(Moments,Facebook Page Manager). Let me know if you need any of them.I've the base IPA of Facebook app.Not the modified one.

@asad0x01
Copy link

For android you can try https://github.com/pouyadarabi/Facebook_SSL_Pinning (Facebook for android Version 175).Also make sure that your android version is Lollipop or above.

@asad0x01
Copy link

Here is the Stock IPA of Facebook APP:https://mega.nz/#!lmpBHIAI!yEMBmTSVHmHNzmXB-Jq8_TMzTOvV5fbZ-awJUGxvsxs

Here is the Modified Facebook Pages IPA:https://mega.nz/#!omhlQY6A!95c5LW34bcpFyP1u_G8s32kKrYL1Wlf0oEI49AxZuHA

Here is the Modified Moments IPA:https://mega.nz/#!RngjwArB!AjD66ZXnjNVOvPLs_nfIAEkplI-xgOnUc4q5KU8-LPw

You can install those IPA's using Cydia Impactor.Note that you can only intercept request of those TWO IPA(Facebook Page Manager and Moments).
Thanks to @phwd

@dedfft
Copy link

dedfft commented Sep 14, 2018

Thank you asad, that is fantastic!!
But what about main favebook patched app? Ipa

@asad0x01
Copy link

It's crashing unfortunately :( But when I tried it a months ago it was working perfectly.However I'll wait for the next update :)

@Eastkap
Copy link

Eastkap commented Sep 19, 2018

I'm trying to do this with Instagram, should this process work ? How could I disable it's SSL pinning?

@dedfft
Copy link

dedfft commented Sep 24, 2018

Maybe any luck with disabled ssl pinning on previous Facebook app versions? I really need at least anything((

@portseif
Copy link

@asad0x01 can you do other apps as well? Please email me: [email protected]

@S00164379
Copy link

Hi,

I have been doing some research and it appears that these days many applications are conducting ssl pinning by OpenSSL library, usually with stripped symbols.

Thus i have wrote simple patcher for this and similar old school hooking with set of hooks/tasks.
https://github.com/karek314/hexbytescanner - binary patcher with json hooks
https://github.com/karek314/hexbytescanner-hooks - hooks itself

Right now i have found that popular library is OpenSSL 1.0.2, if binary does have symbols, ssl pinning can be easily disabled by hooking ssl_verify_cert_chain. However, often it's not possible because of missing symbols.

It can be solved with .json hook and patcher i've made. Hook below is OpenSSL 1.0.2 hook on aarch64

[
  {
    "pattern": "94????0034E80340F9FF0218EB??FCFF54E00313AAE10314AA",
    "patchBytes": "1F2003D5",
    "patchDistance": "0x1"
  }
]

In case someone needs it, here is simple shell script assisting in repacking ipa https://github.com/karek314/HandyIPAPatcher

Additionally, those hooks can be also implemented in ssl-kill-switch2 by utilising vm_read and vm_write with more traditional dynamic byte pattern scanning and patching. If i will find some more free time i will prepare pr, however maybe it will interest you @nabla-c0d3.

If anyone finds some other hooks and feels like sharing them, feel free to pr those in https://github.com/karek314/hexbytescanner-hooks

Is it possible to do this without a mac using frida?

@ghost
Copy link

ghost commented Sep 28, 2018

@S00164379 Nope. hexbytescanner is written in Objective C++, shouldn't be that hard to rewrite to C++ though.

@asad0x01
Copy link

asad0x01 commented Nov 9, 2018

@asad0x01 can you do other apps as well? Please email me: [email protected]

ah!NO!Sorry :(

@liuxuan30
Copy link

@asad0x01 any luck with latest Facebook app?

@asad0x01
Copy link

asad0x01 commented Feb 4, 2019

Hi,

I have been doing some research and it appears that these days many applications are conducting ssl pinning by OpenSSL library, usually with stripped symbols.

Thus i have wrote simple patcher for this and similar old school hooking with set of hooks/tasks.
https://github.com/karek314/hexbytescanner - binary patcher with json hooks
https://github.com/karek314/hexbytescanner-hooks - hooks itself

Right now i have found that popular library is OpenSSL 1.0.2, if binary does have symbols, ssl pinning can be easily disabled by hooking ssl_verify_cert_chain. However, often it's not possible because of missing symbols.

It can be solved with .json hook and patcher i've made. Hook below is OpenSSL 1.0.2 hook on aarch64

[
  {
    "pattern": "94????0034E80340F9FF0218EB??FCFF54E00313AAE10314AA",
    "patchBytes": "1F2003D5",
    "patchDistance": "0x1"
  }
]

In case someone needs it, here is simple shell script assisting in repacking ipa https://github.com/karek314/HandyIPAPatcher

Additionally, those hooks can be also implemented in ssl-kill-switch2 by utilising vm_read and vm_write with more traditional dynamic byte pattern scanning and patching. If i will find some more free time i will prepare pr, however maybe it will interest you @nabla-c0d3.

If anyone finds some other hooks and feels like sharing them, feel free to pr those in https://github.com/karek314/hexbytescanner-hooks

@nabla-c0d3 do you have any plan to implement this in ssl kill switch 2?Thanks in advance :)

@ghost
Copy link

ghost commented Feb 7, 2019

@asad0x01 Doesn't work anymore. It for sure does work with OpenSSL 1.1.0 and 1.0.2 ARM64(which still does work with many apps). Current answer lays in https://github.com/facebookincubator/fizz it does pinning now, it's open source, shouldn't be hard but I haven't had time to play around. In past it relied with pinning on OpenSSL. If anyone finds stable pattern to hook pinning function, feel free to share patch here https://github.com/karek314/hexbytescanner-hooks :)

@ghost
Copy link

ghost commented Nov 25, 2020

The only way to bypass facebook SSL pinning for now is by using frida and objection.

@russian-developer
Copy link

The only way to bypass facebook SSL pinning for now is using frida and objection.

a very complicated way. :( okay…

@ghost
Copy link

ghost commented Apr 23, 2021

The only way to bypass facebook SSL pinning for now is using frida and objection.

a very complicated way. :( okay…

https://github.com/tsarpaul/FBUnpinner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests