Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Chasing In The Backstage
Search
Takahiro Yoshimura
August 30, 2022
Technology
0
8
Chasing In The Backstage
Analysis of iOS/Android versions of TikTok (OWASP Saitama MTG #9, talk #2)
Takahiro Yoshimura
August 30, 2022
Tweet
Share
More Decks by Takahiro Yoshimura
See All by Takahiro Yoshimura
In The Middle Of Chatter #2
alterakey
0
10
Chaotic Channel
alterakey
0
27
In The Middle Of Chatter #1
alterakey
0
32
Shadow Runners 2
alterakey
0
6
Shadow Runners
alterakey
0
6
Looking Back: 2023
alterakey
0
8
Fill In The Blank
alterakey
0
8
Ticket To The Dark World
alterakey
0
11
Looking Back: 2022
alterakey
0
8
Other Decks in Technology
See All in Technology
OCI Vault 概要
oracle4engineer
PRO
0
9.8k
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
7
740
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
130
型チェック 速度改善 奮闘記⌛
tocomi
1
260
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
250
SSMRunbook作成の勘所_20241120
koichiotomo
3
190
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
290
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
140
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
280
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.9k
クラウドインフラ構築における.NETとその他IaCの比較
ymd65536
1
110
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Building Adaptive Systems
keathley
38
2.3k
The Cult of Friendly URLs
andyhume
78
6k
A Philosophy of Restraint
colly
203
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Making Projects Easy
brettharned
115
5.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Speed Design
sergeychernyshev
25
620
Adopting Sorbet at Scale
ufuk
73
9.1k
Automating Front-end Workflow
addyosmani
1366
200k
KATA
mclloyd
29
14k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Transcript
CHASING IN THE BACKSTAGE OWASP SAITAMA MTG #9, TALK #2
TEXT SESSION FLAGS ▸ ըɾԻɾެ։: OK Image by Nico Kaiser
on flickr, CC-BY 2.0
TEXT WHO I AM ▸ Takahiro Yoshimura (@alterakey) https://keybase.io/alterakey ▸
Monolith Works Inc. Co-founder, CTO Security researcher ▸ ໌࣏େֶαΠόʔηΩϡϦςΟݚڀॴ ٬һݚڀһ
TEXT WHAT I DO ▸ Security research and development ▸
iOS/Android Apps →Financial, Games, IoT related, etc. (>200) →trueseeing: Non-decompiling Android Application Vulnerability Scanner [2017] ▸ Windows/Mac/Web/HTML5 Apps →POS, RAD tools etc. ▸ Network/Web penetration testing →PCI-DSS etc. ▸ Search engine reconnaissance (aka. Google Hacking) ▸ Whitebox testing ▸ Forensic analysis
TEXT WHAT I DO ▸ CTF ▸ Enemy10, Sutegoma2 ▸
METI CTFCJ 2012 Qual.: Won ▸ METI CTFCJ 2012: 3rd ▸ DEF CON 21 CTF: 6th ▸ DEF CON 22 OpenCTF: 4th ▸ ൃදɾߨԋͳͲ DEF CON 25 Demo Labs (2017) DEF CON 27 AI Village (2019) CODE BLUE (2017, 2019) CYDEF (2020) etc. Image by Wiyre Media on flickr, CC-BY 2.0
DO YOU KNOW..?
TIKTOK ▸ ྑ͘ΘΕ͍ͯΔSNSΞϓϦ ▸ ಈըڞ༗ ▸ ίϝϯτػೳ etc.
TIKTOK ▸ ӡӦମ ▸ ByteDance Ltd. (த՚ਓຽڞࠃ) Photo by VCG
TEXT BACKGROUND ▸ In-app browserʹJSΛೖ →͜Ε͚ͩͳΒྑ͋͘Δ →KeystrokeΛऔ͍ͬͯΔͷͰʁͱ͍͏ٙ ▸ ൃݟऀʹΑͬͯݕग़αΠτ͕࡞͞Εͨ ▸
TikTokͷଞʹInstagramSnapchatͳͲ ▸ Androidʹ͍ͭͯʁެࣜൃදͳ͠ ▸ iOS 14.3Ҏ߱Ͱݕग़ෆೳͳख๏͕ར༻Մೳʹ (WKContentWorld) →ܯΛ໐Β͍ͯ͠Δ
TEXT BACKGROUND ▸ ੩తʹݟ͑ͳ͍ͷ͔ʁ AndroidӨڹͳ͍ͷ͔ʁ →͜ΕҎ֎ʹಠࣗղੳɾൃදࠓݱࡏͳ͍ ▸ ੩తղੳʹϦόʔεΤϯδχΞϦϯά
WAIT, BUT IS IT LEGAL? ▸ ຊͰ߹๏ʹͳΓ·ͨ͠ (ஶ࡞ݖ๏ୈ30ͷ4) ▸ ͍ͭ࠷ۙ·Ͱҧ๏ɺ͕ͩͬͨ:
Βͳ͍ͱݟ͑ͳ͍ ▸ ͦΕࠃӹʹ͔ͳ͏͜ͱʁ →ͦ͜·Ͱͯ͠ஶ࡞ݖอޢ͞ΕΔ͖ͳͷ͔ʁ →ҧ๏Ͱ͋ͬͯΔҙຯ ɹˠ࣮ߦ͢ΔΛཧղ͠Α͏ͱ͢Δવͷߦҝ ɹɹʢ৯Ͱ͋Εݪࡐྉͷੳʹ૬ʣ →ղੳ͕ҋͷख๏ʁ ɹˠಉௐѹྗͱ૬·ΓɺӴೳྗ্͕͠ͳ͍ཧ༝Λ ͍ͯ͠Δͱߟ͑ΒΕΔ Photo by Onasill ~ Bill - 78.8M on flickr, CC-BY-NC-SA 2.0
CASE 1: IOS
TEXT TARGETS ▸ TikTok (us): 25.8.0
TEXT TOOLCHAIN ▸ Ghidra: Multiarch Disassembler (NSA) ▸ frida-ios-dump: Binary
dumper (Alone_Monkey et al.) Swiss Army Knife on black by Edgar Pierce on flickr, CC-BY 2.0
STATIC ANALYSIS ▸ ੩తղੳ ▸ Ϧιʔεղੳ ▸ όΠφϦղੳ: AArch64
OVERVIEW ▸ App StoreʹΑΔ҉߸Խ (FairPlay) ▸ jailbrokenͱfrida-ios-dumpͰղಡ ▸ Ͱ෮߸ͤ͞ɺϝϞϦղੳͰఠग़ ▸
࣮ߦʹઌཱͬͯOS͕શจΛ෮߸Խ͢Δ͜ͱΛ ར༻ɺෆਖ਼ݕ͕͋ͬͯແ ▸ ৗखஈ͕ͩൺֱతΒΕ͍ͯͳ͍ The App Store by Glen Bledsoe on flickr, CC-BY 2.0
JAILBREAK ▸ Apple͕ڐՄ͍ͯ͠ͳ͍ίʔυΛ࣮ߦͤ͞Δ͜ͱ ͕Ͱ͖Δ ▸ FairPlayͷղআʹඞਢ ▸ ࠓճcheckra1nΛ༻ (~iOS 14.5)
→Intel Mac͕ඞཁͩͬͨ…
JAILBREAK ▸ fridaͷηοτΞοϓ →ղੳϗετʹfrida-ios-dump͕ඞཁ https://github.com/AloneMonkey/frida-ios- dump jailbreak by Viniloco on
flickr, CC-BY-NC-ND 2.0
TEXT RESOURCE ANALYSIS ▸ Assetͷதʹڵຯਂ͍༰ ▸ ಛఆͷύεʹ͍ͭͯτϦΨ͕͋Δ ▸ ϩʔΧϧDNSΛૡ͍જΔՄೳੑ
TEXT RESOURCE ANALYSIS ▸ Assetͷதʹڵຯਂ͍༰ ▸ WebViewΛࢹ͢ΔΑ͏ͳهड़ →ҰݟύϑΥʔϚϯεऔಘʹݟ͑Δɺ͕… →͜Ε͕औΓͭ͘ͱ͢Εେมͳ
TEXT ARCHITECTURE ▸ Private Frameworkͱͯ͠શϩδοΫ͕֨ೲ →ϝΠϯόΠφϦ͕͵͚ͷ֪ʂ ▸ ετϦϯάςʔϒϧɺϝιουςʔϒϧͷѹॖ ▸ ࣮ߦ࣌ʹϩʔμʔ͕ల։
→Private FrameworkԽ͍ͯ͠Δཧ༝
TEXT ARCHITECTURE ▸ ѹॖ ▸ LZFSE: COMPRESSEDV2_BLOCK (“bvx2”) ▸ _C_ҎԼͷηΫγϣϯˠ_D_ҎԼల։
▸ cstring, ustring, methname, methtype ▸ ͋Εʁcfstring, selrefs… →͓ͦΒ͘ผϥΠϒϥϦ͔Βల։͍ͯ͠Δ →ਅ૬ෆ໌͕ͩଟཚ࡞
TEXT ARCHITECTURE ▸ cfstring, selrefsͱ… ▸ Objective-Cͷจࣈྻϝιουࢀর →ղੳʹඞཁෆՄܽͳใ ▸ จࣈྻͰͳ͘ΞυϨεςʔϒϧ
→ਖ਼֬ʹղ͔ͳ͍ݶΓҙຯΛҝ͞ͳ͍
TEXT PROTECTION ▸ ੩తʹଘࡏ͠ͳ͍ →Objective-C 2.0 Messageղੳ͕ޮ͔ͳ͍ →iOSΞϓϦղੳʹ͓͍ͯக໋త ▸ ਵͱಛघͳߏ
▸ ྺͷTikTokɺ͓ΑͼಉࣾʹΑΔฒߦϓϩμΫ τ (e.g. Lemon8) ͰྫΛݟͳ͍… ݼଉͳखஈ
TEXT BREACHING THE PROTECTION ▸ ϝϞϦμϯϓ߈ܸ ▸ ࣮ࡍʹಈ࡞ͤ͞ԾϝϞϦΛࠜͦ͗͜ऩू →ಈతใΛԣऔΓ͢Δৗखஈ ▸
Fridump →readonly/writableͷ2ηοτऔΔ ▸ cfstring, selrefs͜ΕͰऔΕΔ…ͣ
TEXT BREACHING THE PROTECTION ▸ ϝϞϦμϯϓ߈ܸ ▸ …͕ɺASLRͷհࡏʹҙ ▸ ASLR:
Address Space Layout Randomization ▸ ͕࣮ߦ࣌ʹΞυϨεۭؒΛγϟοϑϧ ▸ ϝϞϦഁյܥ߈ܸʹର͢Δॏཁͳޚػߏ ʢBuffer over fl ow, Return-oriented programmingͳͲʣ
TEXT BREACHING THE PROTECTION ▸ Կ͕ʁ ▸ ࣮ߦϑΝΠϧ: ૬ରΞυϨεࢀর (PIE:
Position-Independent-Executable) ▸ ࣮ߦ࣌Πϝʔδ: ઈରΞυϨεࢀর ▸ Πϝʔδ͔ΒηΫγϣϯΛషΓࠐΉ͚ͩͰ ΞυϨε͕߹Θͳ͍ (→ςʔϒϧ͕ਖ਼֬ʹղ͚ͳ͍) ▸ ࣮ߦϑΝΠϧ࠶ߏ͠ʹ͍͘ →ASLRΛ࡞ʹར༻͍ͯ͠ΔΑ͏ʹݟ͑Δ
TEXT BREACHING THE PROTECTION ▸ ϑΝΠϧͰͳ͘ϝϞϦΠϝʔδΛղੳ ▸ Մೳ͕ͩ໘Ͱ͋Δ →ηΫγϣϯԟʑʹͯ͠ଟ ▸
ΤϯτϦϙΠϯτͳͲͷใ͕શͯܽམ →Ͳ͔͜ΒղੳΛߦͳ͏ͷ͔ʁ
TEXT BREACHING THE PROTECTION ▸ ໘͕ͩͬͨؤுͬͨ →ࠓճro͔Β15%ఔ; rw͔ΒཁٻʹԠͯ͡ →selrefs͕ͦͦwritable… ▸
ΤϯτϦϙΠϯτ ▸ 103240000͕Mach-Oϔομ →શͰͳ͍ͷͰ݁ہGhidraʹͤͨ (“Analyze function starts”) ▸ ͔͔͕࣌ؒͬͨ…
TEXT PROTECTION IS HISTORY ▸ ༗ҙٛͳใ͕औΕΔΑ͏ʹͳͬͨ (~30min. / M1 MacBookPro)
▸ एׯͷ ▸ objc_msgSendͳͲͷC APIίʔϧͷղܾ ▸ ηΫγϣϯͷܧଓతͳషΓࠐΈ
TEXT VERDICT ▸ Ϧιʔεʹpayload͕ଘࡏɺ͔ͭ ▸ WebViewʹऔΓ͘Մೳੑͷ͋ΔAPIίʔϧ͋ Δ͍ͦ͏͍͏ڍಈʹͭͳ͕ΔγϯϘϧ͕ଘࡏ ▸ ຊདྷ͏গ͖ͪ͠ΜͱηΫγϣϯΛ࠶ߏ͠ ͯݟΔඞཁ͕͋Δɺ͕ݶΓͳ͍Ϋϩ
→ཪ͚͕ͮऔΕͨ
BUSTED. Uni. Cat. Plausibly part Manx. by ▓▒░ TORLEY ░▒▓
on flickr, CC-BY-SA 2.0
CASE 2: ANDROID
TEXT TARGETS ▸ TikTok (us): 25.9.4 (Android)
TEXT TOOLCHAIN ▸ Trueseeing: Non-decompiling Android app vulnerability scanner (alterakey
et al.) Swiss Army Knife on black by Edgar Pierce on flickr, CC-BY 2.0
TEXT RESOURCE ANALYSIS ▸ Assetͷதʹڵຯਂ͍༰ ▸ WebViewࢹεΫϦϓτྨͷଘࡏ →iOS൛ͱಉ
TIME OUT
TEXT TAKEAWAYS ▸ In-app browserԚછݕग़αΠτສೳͰͳ͍ ▸ Android͓ͦΒ͘ಉ༷ (payload͕֬ೝͰ͖Δ) ▸ In-app
browser֎͔Β͍Ζ͍ΖհೖͰ͖Δ ▸ In-app browserΛ༏ઌ͢Δ෩ைͲ͏ͳͷ͔ →ϢʔβʹબࢶΛఏڙ͖͢ →Androidಉ༷
FIN. 30.8.2022 TAKAHIRO YOSHIMURA (@ALTERAKEY)