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

Fixed false positive of mitm on CRiOS Chrome on iOS #1448

Closed
wants to merge 2 commits into from

Conversation

tobya
Copy link
Collaborator

@tobya tobya commented Feb 17, 2017

Issue discussed in #1430 with Chrome on iOS, which seems to use a Cipher that Chrome doesnt.

Created a new test for CRiOS (Chrome on iOS) that checks as for Chrome but with one less Cipher TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384

Tested on Chrome on Windows and Chrome on iOS.

Chrome on iOS versions
Chrome verison:56.0.2924.79
iOS 10.0.2

@mholt The Client Hello is

Parsed ClientHello: {cipherSuites:[255 49196 49195 49188 49187 49162 49161 49160 49200 49199 49192 49191 49172 49171 491
70 157 156 61 60 53 47 10] extensions:[0 10 11 13 13172 16 5 18 23] compressionMethods:[0] curves:[23 24 25] points:[0]}

Full Headers : https://gist.github.com/tobya/8ec9e4b6553264b6e2022b228a58f631#file-clienthello-log

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Toby! Can you provide the raw ClientHello (the hex-encoded bytes) and add a test case in mitm_test.go?

@@ -51,6 +51,9 @@ func (h *tlsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
strings.Contains(ua, "Trident") {
checked = true
mitm = !info.looksLikeEdge()
} else if strings.Contains(ua, "CRiOS") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual User-Agent string uses "CriOS" not "CRiOS"

@@ -360,6 +363,58 @@ func (info rawHelloInfo) looksLikeFirefox() bool {
return assertPresenceAndOrdering(expectedCipherSuiteOrder, info.cipherSuites, false)
}

// looksLikeChromeOniOS returns true if info looks like a handshake
// from a modern version of Chrome on iOS.
func (info rawHelloInfo) looksLikeChromeOniOS() bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we just called looksLikeChrome and then if false, checked for the one difference between the two which is the existence of that one cipher suite? Rather than duplicating almost the whole function.

@tobya tobya added the in progress 🏃‍♂️ Being actively worked on label Feb 17, 2017
@tobya
Copy link
Collaborator Author

tobya commented Feb 19, 2017

hmmmm I was far too hasty earlier and I have investigated this a bit further and not sure how to proceed @mholt

This is getting quite confusing and I'm wondering if its just me. To recap this issue only seem to happen on Chrome for iOS and only when fetching the favicon.ico file which is a special type of file retrieved. I have been working with the code and tried implementing as suggested above to use a single function etc.

In part of my testing I found the Raw Client Hello for the first request to a new site requesting list.php and the second request requesting favicon.ico are completely different and offer completely different lists of ciphers etc.

Gist with details

2017/02/19 17:28:26 RAW HELLO: 010000e9030358a9d5ba1a8e5355b6a56b490148fe605ef4d63f8bd0cca432e79ffe858d2e3100002c00ffc02cc02bc024c023c00ac009c008c030c02fc028c027c014c013c012009d009c003d003c0035002f000a010000940000001f001d00001a6173697465392e6263732e636f6f6b696e67697366756e2e6965000a00080006001700180019000b00020100000d00120010040102010501060104030203050306033374000000100030002e0268320568322d31360568322d31350568322d313408737064792f332e3106737064792f3308687474702f312e310005000501000000000012000000170000
2017/02/19 17:28:27 *******
URI: /list.php
2017/02/19 17:28:27 User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.79 Mobile/14A456 Safari/602.1
2017/02/19 17:28:27 Headers: map[Accept-Language:[en-ie] Accept-Encoding:[gzip, deflate] Cookie:[_ga=GA1.2.1285204035.1421831904; __utma=71723596.1285204035.1421831904.1478764756.1478864814.78; __utmz=71723596.1478705289.76.15.utmcsr=jobsforcooks.com|utmccn=(referral)|utmcmd=referral|utmcct=/employers/] Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8] User-Agent:[Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.79 Mobile/14A456 Safari/602.1]]
2017/02/19 17:28:27 Parsed ClientHello: {cipherSuites:[255 49196 49195 49188 49187 49162 49161 49160 49200 49199 49192 49191 49172 49171 49170 157 156 61 60 53 47 10] extensions:[0 10 11 13 13172 16 5 18 23] compressionMethods:[0] curves:[23 24 25] points:[0]}

and

2017/02/19 17:28:27 RAW HELLO: 010000cd0303fab3458bce096875ff9c112b9bf7104b2a8c813dd22741d3156985985abc1a29000020fafacca9cca8cc14cc13c02bc02fc02cc030c013c014009c009d002f0035000a010000844a4a0000ff010001000000001f001d00001a6173697465392e6263732e636f6f6b696e67697366756e2e69650017000000230000000d00140012040308040401050308050501080606010201000500050100000000001200000010000e000c02683208687474702f312e31000b00020100000a000a0008baba001d001700188a8a000100
2017/02/19 17:28:27 ---------------
2017/02/19 17:28:27 *******
URI: /favicon.ico
2017/02/19 17:28:27 User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.79 Mobile/14A456 Safari/602.1
2017/02/19 17:28:27 Headers: map[Accept-Encoding:[gzip, deflate, sdch] Accept-Language:[en-US,en;q=0.8] User-Agent:[Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.79 Mobile/14A456 Safari/602.1]]
2017/02/19 17:28:27 Parsed ClientHello: {cipherSuites:[64250 52393 52392 52244 52243 49195 49199 49196 49200 49171 49172 156 157 47 53 10] extensions:[19018 65281 0 23 35 13 5 18 16 11 10 35466] compressionMethods:[0] curves:[47802 29 23 24] points:[0]}

The set of cipherSuites, curves and extensions are all different.

Questions

  • Is this normal?
  • If not could it be anything to do with the security issues around favicon.ico (https://en.wikipedia.org/wiki/Favicon Section Limitations and Criticism) ?
  • Is it an edge case that we should ignore?

I started writing tests and would need to write tests to pass both RAW Hello's? The list.php seems to pass as normal chrome but not the call to favicon.ico

@elcore
Copy link
Collaborator

elcore commented Feb 19, 2017

This is very spooky 👻

I would love to help, but I do not have an iPhone

@tobya
Copy link
Collaborator Author

tobya commented Feb 19, 2017

@elcore I presume I think doesn't happen with a new site on chrome on android?

@elcore
Copy link
Collaborator

elcore commented Feb 19, 2017

@elcore I presume I think doesn't happen with a new site on chrome on android?

Chrome on Android doesn´t request favicon.ico (there is no request to Caddy) -- The ClientHello (Cipher Suites, Curves and Extensions) is always the same

@mholt
Copy link
Member

mholt commented Feb 24, 2017

@tobya This... is strange. Tell ya what, I have a test fixture set up that I've been using for people to help me test this, if you're online at the same time as me, just ping me on Twitter or Gophers Slack and I'll hop on if I'm available! Then we can get to the bottom of this I think.

In the meantime, I hope if you don't mind if I close this PR. No doubt there's probably a bug somewhere in Caddy's code but we need to isolate it surely first.

@mholt mholt closed this Feb 24, 2017
@mholt mholt removed the in progress 🏃‍♂️ Being actively worked on label Feb 24, 2017
@tobya
Copy link
Collaborator Author

tobya commented Feb 24, 2017

@mholt That's fine. Can you give me a vague time (your time of day) that might suit? Otherwise I'll ping you this evening Ireland time

@mholt
Copy link
Member

mholt commented Feb 24, 2017

@tobya Most weekdays I'm good any time between 8-5, with a few exceptions for classes and things, but in general I work within that timeframe.

@mholt
Copy link
Member

mholt commented Feb 24, 2017

Out of band, Toby was able to give me the information I needed to see this issue in a more controlled environment; turns out it has something to do with Chrome on iOS using WKWebView (out of requirement by Apple) for page loads but Chrome's own internals for favicon stuff. Thus, the page load looks exactly like Safari but the favicon looks like Chrome, but both have the same User-Agent. Hrm. I may have to wait until the researchers release their fingerprints before I can fix this properly.

@tobya tobya deleted the mitmCRiosIssue branch February 26, 2017 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants