このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


Sbktech: Inside the Android Play Service's 魔法 OAuth flow

Inside the Android Play Service's 魔法 OAuth flow

I was looking into how the Google Play library 現実に 得るs OAuth 記念品s on に代わって of apps, as the actual nuts and bolts remain undocumented.

Its 実施 申し込む/申し出s some 利益/興味ing insights into how Google 扱うs 問題/発行するs that 刈る up up when using OAuth in an Android app. The 残り/休憩(する) of this 地位,任命する 推定するs you know a bit about Android, OAuth 同様に as how to use the Google Play Services library to 得る 接近 記念品s. Sorry if all this is 負かす/撃墜する in the 少しのd, but that's where the fun bits are!

To get a disclaimer out of the way. These are just my 観察s after poking at さまざまな dex とじ込み/提出するs and 網状組織 traffic and I've undoubtedly 行方不明になるd many things; but I do hope to show you the 幅の広い 輪郭(を描く) of how it 作品.

There are three points of 利益/興味.

  1. 批判的な code runs only within a Google 調印するd app (eg: the com.google.android.gms/.auth.GetToken service.)
  2. This service 認可するs apps 地元で, and 得るs 接近 記念品s using a 地元で 蓄える/店d master 記念品. It 効果的に 取って代わるs the 伝統的な web-based OAuth 是認 flow.
  3. Third-party apps are identified by their 署名 and 一括 指名する, rather than an 使用/適用-重要な/使用/適用-secret.

The green areas run "信用d" code. Your app uses the Google Play Services (弁護士の)依頼人 library; but the library itself doesn't run 批判的な code. It instead 今後s calls to services and activities running within a 分かれて 任命する/導入するd app ("Google Play Services".)

Here are some 利益/興味ing bits of the manifest とじ込み/提出する for com.google.android.gms (the "Google Play services" app) so you get a feel for how it is 始める,決める up.

<manifest
  android:sharedUserId="com.google.uid.株d"
  一括="com.google.android.gms"
  ...>
  <service
    android:指名する=".auth.GetToken"
    android:輸出(する)d="true"
    android:過程="com.google.過程.gapps"/>

  <activity
    android:指名する=".auth.login.LoginActivity"
    android:輸出(する)d="true"
    android:過程="com.google.android.gms.ui"
    .../>

As an app writer, you typically call GoogleAuthUtil.getToken() from your 使用/適用. The Play Services library first 立証するs that the 要求するd Google apps (com.android.vending and com.google.android.gms) are 任命する/導入するd, and also that they have an 許容できる 見解/翻訳/版 and 署名. The 許容できる 見解/翻訳/版 numbers and 署名 are embedded 直接/まっすぐに within the library. Your requested OAuth 範囲 is passed to the service, and now we're running inside the 信用d Play Services app.

Things start to get 利益/興味ing within the get-記念品 service.

This service first retrieves the app 一括 指名する and 署名 of the 報知係. This pair (caller_package_name,caller_signature) is used to identify the 報知係. This 相互の 身元確認,身分証明/立証 by the service and the calling library takes place 権利 at the 手始め; and 推定では makes it more difficult for either the 報知係 or a rogue "Play Service" to spoof their 身元 to the other.

The service 直接/まっすぐに manages app 是認, shows dialogs to the 使用者 as needed, and creates 接近 記念品s for requested 範囲s. In other words, it 成し遂げるs the app-是認 that would さもなければ typically be done by the web-場所/位置.

This approach does have some advantages. By using a 地元で running service in a 信用d Google app, Google can take advantage of some of the 安全 features within Android.

For example, by using the 一括 署名 to identify your 使用/適用, it 除去するs the need to embed 使用/適用 ids and secrets in your apk (which can often be 抽出するd out of a downloaded 使用/適用; 許すing the bad guys to 調印する requests as if they (機の)カム from your app.) 一括 署名s are much harder to spoof - you'll need the 私的な 調印 重要な which is (hopefully!) never 明らかにする/漏らすd; so this is a better way to identify an app.

その上の, all the 接近 是認 UI and 記念品 取得/買収 logic is sandboxed inside the play app rather than 存在 left to the app-writer. 推定では, this 減ずるs the "attack-surface", and also 許すs bugs to be 演説(する)/住所d quickly by updating this 選び出す/独身 app.

You might now be imagining the flip 味方する of such a powerful Android service, and you'd be 権利. This service has to be 安全な・保証する and 正確に 警報 the 使用者 during 是認; for once 準備/条項d, it is 有能な of creating 接近 記念品s on に代わって of any app, and with any 範囲.

The get-記念品 service does all this using what I call a master 記念品 that it 得るs from an undocumented authentication endpoint at https://android.(弁護士の)依頼人s.google.com/auth. Here's how it 作品.

When you first 追加する an account to the 装置 (say during 装置 体制/機構) the service 地位,任命するs your password, which is additionally encrypted with, I believe, a public 重要な whose 私的な 相当するもの is 利用できる to the web endpoint.

POST https://android.(弁護士の)依頼人s.google.com/auth
Parameters
----------
accountType:      HOSTED_OR_GOOGLE
Email:            xxx@gmail.com
has_permission:   1
add_account:      1
EncryptedPasswd:  <some base64 encoding>
service:          ac2dm
source:           android
androidId:        <deviceid>
device_country:   us
operatorCountry:  us
lang:             en
sdk_version:      17

A successful login returns 支援する a bunch of 使用者 (警察などへの)密告,告訴(状) and 記念品s, one per line.

SID=...
LSID=...
Auth=...
services=hist,mail,lh2,talk,oz
Email=...
記念品=1/zMASTERTOKEN
GooglePlusUpgrade=1
PicasaUser=...
RopText= 
RopRevision=1
firstName=...
lastName=...

公式文書,認める the 記念品 field - this is the one master 記念品 to 支配する them all.

The master 記念品 is 蓄える/店d on the 装置 using the AccountManager. You should be aware that in most 装置 configurations, AccountManager 蓄える/店s this 記念品 in an unencrypted sqlite database (accounts.db - usually somewhere under /data/system.) 保護 is まず第一に/本来 through the basic linux とじ込み/提出する-system 接近 支配(する)/統制するs - the directories are accessible only to system 過程s.

My understanding of the Android 安全 Team's position is that anything else is fundamentally 安全 theatre. Encrypting the data or the filesystem is a tricky 支配する and 解答s are often contentious. At any 率; it means rooted 装置s (or 装置s that can be rooted through an OS/driver 証拠不十分) are at 危険 of exposing the master 記念品 - so be aware.

Next, a 始める,決める of 核心 google services request OAuth 記念品s for their 範囲s. This also 明らかにする/漏らすs how the get-記念品 service 生成するs 接近 記念品s using the master 記念品. Here for example, is how it creates a 記念品 for one of the 範囲s requested by the market app.

POST https://android.(弁護士の)依頼人s.google.com/auth

Parameters
----------
accountType:      HOSTED_OR_GOOGLE
Email:            ...
has_permission:   1
記念品:            1/zMASTERTOKEN
service:          sierra
source:           android
androidId:        <deviceid>
app:              com.android.vending
client_sig:       38918a453d07199354f8b19af05ec6562ced5788
device_country:   us
operatorCountry:  us
lang:             en
sdk_version:      17

and sure enough - it gets 支援する:

SID=...
LSID=...
Auth=<auth_token>
issueAdvice=自動車
services=hist,mail,lh2,talk,oz

Indeed, all it takes is to 追加する the has_permission=1 旗 to a request 含む/封じ込めるing the master 記念品, and 負かす/撃墜する comes an 接近 記念品 for the 願望(する)d 範囲. I also believe this 許可 is automatically 追加するd if the service notices that the requestor 署名 is the same as the google app 署名; which is in fact the SHA value you see above.

What happens when you request a 記念品 from your own app 経由で GoogleUtils.getToken() for the userinfo.profile 範囲?

POST https://android.(弁護士の)依頼人s.google.com/auth
Headers
-------
装置:          <deviceid>
app:             <app-一括-指名する>

Parameters
----------
device_country:                us
operatorCountry:               us
lang:                          en_US
sdk_version:                   17
google_play_services_version:  4132532
accountType:                   HOSTED_OR_GOOGLE
Email:                         <email>
source:                        android
androidId:                     <device_id>
app:                           <app-一括-指名する>
client_sig:                    <app-sha-署名>
service:                       oauth2:https://www.googleapis.com/auth/userinfo.profile
記念品:                         1/zMASTERTOKEN

公式文書,認める the absence of the has_permission=1 旗, and that the client_sig is now the 署名 of the calling app.

The 返答 is:

issueAdvice=同意
許可=見解(をとる)+basic+(警察などへの)密告,告訴(状)+about+your+account
ScopeConsentDetails=%0AView+your+指名する%2C+public+profile+URL%2C+and+photo%0AView+your+gender%0AView+your+country%2C+la
nguage%2C+and+timezone%0A
ConsentDataBase64=...

The 使用者-interface is controlled by the issueAdvice 旗 in the 返答. Automatically 認可するd apps get the issueAdvice=自動車 旗 and an 接近 記念品. issueAdvice=同意 原因(となる)s the service to return an 意図 that if 開始する,打ち上げるd, shows a suitable 同意 dialog. (The Play Services (弁護士の)依頼人 library bundles this 意図 into a UserRecoverableAuthException.)

What happens when you 認可する a 同意 dialog? Nothing much - the service 単に 追加するs the has_permission=1 旗 to a 類似の request and gets 支援する an 接近 記念品. It really can create 接近 記念品s for any and all 範囲s.

By the way - this also 示すs how the 立証するd app call 機械装置 likely 作品. If you 明示する a audience:server:client_id 範囲, the 記念品 service passes it as usual with the (caller_package,caller_signature) pair to the server. The server checks if this matches the (警察などへの)密告,告訴(状) you 分かれて 登録(する)d for that app, and returns a JSON Web 記念品 主張するing this fact.

自然に, all this assumes the basic Android system, 同様に as the "信用d" Play Services app can securely identify the calling 一括; and that nobody other than the 信用d app has 接近 to the master 記念品.

Given those 仮定/引き受けることs, it's a nice technique. The Play Services App 含む/封じ込めるs an omnipotent "地元の-oauth-service"; playing the 役割 of the web-based 是認 flow but with an Android flavor. Third-party apps are identified 直接/まっすぐに by their app 署名, 除去するing the need to embed app secrets within the apk とじ込み/提出する.

Most 使用者s need (and should) enter their google password only when setting up their 装置. Apps no longer use the inherently insecure Webview approach to 誘発する/引き起こす the 是認 flow; nor do they need to use the ぎこちない and tedious flow 経由で a browser 意図. The app never sees anything other than the 接近 記念品 itself. 批判的な code runs only in the Play Services app, so bugs can be 直す/買収する,八百長をするd by just updating one app.

Downsides?

Be aware there's a master 記念品 蓄える/店d on your Android 装置 which has the latent ability to 認める 接近 to services you might not even be 接近ing from it. If that 記念品 is ever exposed, you should assume that all data associated with the account is up for 得る,とらえるs. Use the Android 装置 経営者/支配人 to 減ずる the window of 適切な時期 if your 装置 is stolen, or manage this master 記念品 from your 安全 settings. Or, use a low-value account just for your android 装置s; and keep 批判的な 文書s in a separate account.

23 comments:

Thanks a lot.

August 5, 2015 at 3:34 PM  

It is 安全な to say that you are looking for the Largest Android Tablet in 2020? The 訂正する method to buy tablets is through the online 場所/位置s. There are さまざまな 場所/位置s that 含む enormous 手段 of biggest 審査する tablets.

May 11, 2020 at 4:34 AM  

Next time I read a blog, Hopefully it does not fail me just as much as this one. After all, I know it was my choice to read, however I 現実に believed you would probably have something useful to talk about. All I hear is a bunch of complaining about something you could かもしれない 直す/買収する,八百長をする if you weren't too busy searching for attention.pres 支配(する)/統制する san antonio coronavirus

July 18, 2020 at 5:05 AM  

Hi there! This blog 地位,任命する could not be written much better! Going through this 地位,任命する reminds me of my previous roommate! He 絶えず kept preaching about this. I am going to 今後 this article to him. 公正に/かなり 確かな he's going to have a 広大な/多数の/重要な read. Thanks for 株ing!
Gutter 修理

August 3, 2020 at 3:08 AM  

I was more than happy to 暴露する this 広大な/多数の/重要な 場所/位置. I need to to thank you for your time 予定 to this fantastic read!! I definitely enjoyed every bit of it and I have you bookmarked to see new (警察などへの)密告,告訴(状) on your blog.
E-商業 in Lahore

September 23, 2020 at 5:30 AM  

I'd like to thank you for the 成果/努力s you've put in 令状ing this website. I really hope to see the same high-grade blog 地位,任命するs from you later on 同様に. In truth, your creative 令状ing abilities has 動機づけるd me to get my very own 場所/位置 now ;)
I was pretty pleased to 暴露する this web 場所/位置. I 手配中の,お尋ね者 to thank you for ones time 予定 to this fantastic read!! I definitely liked every part of it and i also have you saved as a favorite to check out new things in your web 場所/位置.
Europe Brand

October 5, 2020 at 6:19 AM  

Eco living life team is 熱烈な about making it easier for you to shop online. We care about your time so we try our best to make your shopping experience pleasant, seamless and hassle-解放する/自由な.

October 17, 2020 at 4:01 PM  

Aw, this was a very nice 地位,任命する. Taking the time and actual 成果/努力 to produce a superb article… but what can I say… I procrastinate a whole lot and never manage to get anything done.

At BrokeScholar we work around the clock to update this page with active promo codes, coupons and 割引s for Total ワイン . Our editors 監視する newsletters, social マスコミ 地位,任命するs, 取引,協定 会議s, and third party 販売人s to find the best Total ワイン 取引,協定s. For students, we also 跡をつける totalwine student 割引s for 排除的 貯金. We've done the 研究 so you don't have to. Bookmark this page and never 行方不明になる a Total ワイン 昇進/宣伝 again.

November 10, 2020 at 6:40 AM  

Stretch your dollar even その上の at harbor freight coupons with our 25% off coupons. These coupons will help you save 20% (or more!) on qualifying items throughout the 蓄える/店. We also have 割引s just for members of our Inside 跡をつける Club.

November 19, 2020 at 9:49 AM  

This online 定期刊行物 場所/位置 is really 冷静な/正味の! How was it made !

Kilts for Sale

November 24, 2020 at 10:34 PM  

Goodness, this is truly intriguing perusing. I am happy I discovered this and got the chance to peruse it. Awesome 雇用 on this 実体. I like it.

公共事業(料金)/有用性 Kilts

November 27, 2020 at 9:21 PM  

Goodness, this is truly intriguing perusing. I am happy I discovered this and got the chance to peruse it. Awesome 雇用 on this 実体. I like it.

How To Build Hybrid Kilt - 完全にする Helping Guide

November 29, 2020 at 9:34 PM  

i was 簡単に perusing along and happened upon your online 定期刊行物. 簡単に needed to say 広大な/多数の/重要な website and this article truly helped me.

Smart Automation 解答s

November 30, 2020 at 1:56 AM  

Howdy! Pleasant 地位,任命する! It would be ideal if you let us know when I will see a postliminary!
Graphic designing services in Lahore

December 18, 2020 at 5:46 AM  


Professionelles ?bersetzungsb?ro ✓ ?bersetzungen ✓ Dolmetschen ✓ mehr als 35 Jahre Erfahrung ✓ alle Sprachen ✓ Qualit?tsstandard ISO 17100 ✓ Rechtssichere ?bersetzung ✓ Juristische Fach?bersetzung ✓ ?bersetzungsb?ro ✓ ?bersetzungsdienst ✓?bersetzungsagentur ✓?bersetzungsservice ✓ ?bersetzungen ✓ beglaubigte ✓ ?bersetzung, ?bersetzen ✓individuelle Beratung.✓✓ Alle Sprachen. Alle Fachrichtungen,✓ 35 Jahre Erfahrung ✓ 表明する ?bersetzungsb?ro ✓ juristische und technische ?bersetzung ✓ Profi Fach?bersetzungen ✓ Deutsch Englisch
?bersetzung f?r Versicherung 保険 Franz?sich


January 11, 2021 at 10:42 AM  

On this website, You’ll get over 200+ real working dark web links and If you’re a 正規の/正選手 dark web 使用者 so you can start using these dark web links and If you’re a new 使用者 or If you don’t know anything about the dark web So you can read the content below and you’ll understand everything about the dark web.

February 9, 2021 at 4:43 AM  

I was more than happy to 暴露する this 広大な/多数の/重要な 場所/位置. I need to thank you for your time 予定 to this fantastic read!!
I definitely enjoyed every bit of it and I have you bookmarked to see new (警察などへの)密告,告訴(状) on your blog.
分類するd 広告s WordPress 主題

March 12, 2021 at 4:41 AM  

I was more than happy to 暴露する this 広大な/多数の/重要な 場所/位置. I need to thank you for your time 予定 to this fantastic read!!
I definitely enjoyed every bit of it and I have you bookmarked to see new (警察などへの)密告,告訴(状) on your blog.
Freelance Marketplace WordPress 主題

March 15, 2021 at 4:03 AM  

I was more than happy to 暴露する this 広大な/多数の/重要な 場所/位置. I need to thank you for your time 予定 to this fantastic read!!
I definitely enjoyed every bit of it and I have you bookmarked to see new (警察などへの)密告,告訴(状) on your blog.
Freelance Marketplace WordPress 主題

March 16, 2021 at 3:53 AM  

??? ??? ???
??? ??? ???? – ??? ??? ??????? – ????? 99003870 – ??? ??? ???? – ??? ???? ????? – ??? ??? ???????? – ???? ??? ???? – ??? ??? ??????? – ??? ???

March 28, 2021 at 1:54 PM  

数字表示式の marketing 機関 london
Moving on to the best and most suitable (選挙などの)運動をする(s) for your 商売/仕事 after spotting your position in the market along with your competitors. 創造 of 戦略s 同様に as optimization 過程 体制/機構 is an 必須の part of this 段階 含むing 的s which could be ROAS, ROI or CPA.

April 12, 2021 at 9:00 AM  

I truly like your composition style, awesome data, thankyou for 地位,任命するing.

freetress suzie

April 20, 2021 at 1:20 AM  

Thanks for uploading this article. Techno 動きやすい is best 動きやすい with best specifications. Now you can get new 動きやすいs update with Vivo y20 price in Bangladesh

May 9, 2021 at 3:52 AM  

Older 地位,任命する Home

Labels