Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Chasing In The Backstage

Chasing In The Backstage

Analysis of iOS/Android versions of TikTok (OWASP Saitama MTG #9, talk #2)

Takahiro Yoshimura

August 30, 2022
Tweet

More Decks by Takahiro Yoshimura

Other Decks in Technology

Transcript

  1. TEXT WHO I AM ▸ Takahiro Yoshimura (@alterakey) https://keybase.io/alterakey ▸

    Monolith Works Inc. Co-founder, CTO Security researcher ▸ ໌࣏େֶαΠόʔηΩϡϦςΟݚڀॴ ٬һݚڀһ
  2. 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
  3. 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
  4. TEXT BACKGROUND ▸ In-app browserʹJSΛ஫ೖ →͜Ε͚ͩͳΒྑ͋͘Δ࿩ →KeystrokeΛऔ͍ͬͯΔͷͰ͸ʁͱ͍͏ٙ࿭ ▸ ൃݟऀʹΑͬͯݕग़αΠτ͕࡞੒͞Εͨ ▸

    TikTokͷଞʹ΋Instagram΍SnapchatͳͲ ▸ Androidʹ͍ͭͯ͸ʁެࣜൃදͳ͠ ▸ iOS 14.3Ҏ߱Ͱݕग़ෆೳͳख๏͕ར༻Մೳʹ (WKContentWorld) →ܯ৊Λ໐Β͍ͯ͠Δ
  5. WAIT, BUT IS IT LEGAL? ▸ ೔ຊͰ΋߹๏ʹͳΓ·ͨ͠ (ஶ࡞ݖ๏ୈ30৚ͷ4) ▸ ͍ͭ࠷ۙ·Ͱҧ๏ɺ͕ͩͬͨ:

    ΍Βͳ͍ͱݟ͑ͳ͍ ▸ ͦΕ͸ࠃӹʹ͔ͳ͏͜ͱʁ →ͦ͜·Ͱͯ͠ஶ࡞ݖ͸อޢ͞ΕΔ΂͖෺ͳͷ͔ʁ →ҧ๏Ͱ͋ͬͯ΋΍Δҙຯ ɹˠ࣮ߦ͢Δ෺Λཧղ͠Α͏ͱ͢Δ౰વͷߦҝ ɹɹʢ৯඼Ͱ͋Ε͹ݪࡐྉͷ෼ੳʹ૬౰ʣ →ղੳ͕ҋͷख๏ʁ ɹˠಉௐѹྗͱ૬·Γɺ๷Ӵೳྗ͕޲্͠ͳ͍ཧ༝Λ ੒͍ͯ͠Δͱߟ͑ΒΕΔ Photo by Onasill ~ Bill - 78.8M on flickr, CC-BY-NC-SA 2.0
  6. 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
  7. OVERVIEW ▸ App StoreʹΑΔ҉߸Խ (FairPlay) ▸ jailbroken୺຤ͱfrida-ios-dumpͰղಡ ▸ ୺຤Ͱ෮߸ͤ͞ɺϝϞϦղੳͰఠग़ ▸

    ࣮ߦʹઌཱͬͯOS͕શจΛ෮߸Խ͢Δ͜ͱΛ ར༻ɺෆਖ਼୺຤ݕ஌͕͋ͬͯ΋ແ໰୊ ▸ ৗ౟खஈ͕ͩൺֱత஌ΒΕ͍ͯͳ͍ The App Store by Glen Bledsoe on flickr, CC-BY 2.0
  8. TEXT ARCHITECTURE ▸ ѹॖ ▸ LZFSE: COMPRESSEDV2_BLOCK (“bvx2”) ▸ _C_ҎԼͷηΫγϣϯˠ_D_ҎԼ΁ల։

    ▸ cstring, ustring, methname, methtype ▸ ͋Εʁcfstring, selrefs͸… →͓ͦΒ͘ผϥΠϒϥϦ͔Βల։͍ͯ͠Δ →ਅ૬͸ෆ໌͕ͩଟ෼᎟ཚ޻࡞
  9. TEXT PROTECTION ▸ ੩తʹଘࡏ͠ͳ͍ →Objective-C 2.0 Messageղੳ͕ޮ͔ͳ͍ →iOSΞϓϦղੳʹ͓͍ͯ͸க໋త ▸ ਵ෼ͱಛघͳߏ଄

    ▸ ྺ୅ͷTikTokɺ͓ΑͼಉࣾʹΑΔฒߦϓϩμΫ τ (e.g. Lemon8) Ͱ͸ྫΛݟͳ͍… ݼଉͳखஈ
  10. TEXT BREACHING THE PROTECTION ▸ ϝϞϦμϯϓ߈ܸ ▸ …͕ɺASLRͷհࡏʹ஫ҙ ▸ ASLR:

    Address Space Layout Randomization ▸ ୺຤͕࣮ߦ࣌ʹΞυϨεۭؒΛγϟοϑϧ ▸ ϝϞϦഁյܥ߈ܸʹର͢Δॏཁͳ๷ޚػߏ ʢBuffer over fl ow, Return-oriented programmingͳͲʣ
  11. TEXT BREACHING THE PROTECTION ▸ Կ͕໰୊ʁ ▸ ࣮ߦϑΝΠϧ: ૬ରΞυϨεࢀর (PIE:

    Position-Independent-Executable) ▸ ࣮ߦ࣌Πϝʔδ: ઈରΞυϨεࢀর ▸ Πϝʔδ͔ΒηΫγϣϯΛషΓࠐΉ͚ͩͰ͸ ΞυϨε͕߹Θͳ͍ (→ςʔϒϧ͕ਖ਼֬ʹղ͚ͳ͍) ▸ ࣮ߦϑΝΠϧ͸࠶ߏ੒͠ʹ͍͘ →ASLRΛ๦֐޻࡞ʹར༻͍ͯ͠ΔΑ͏ʹݟ͑Δ
  12. TEXT BREACHING THE PROTECTION ▸ ໘౗͕ͩͬͨؤுͬͨ →ࠓճ͸ro͔Β15%ఔ౓; rw͔Β͸ཁٻʹԠͯ͡ →selrefs͕ͦ΋ͦ΋writable… ▸

    ΤϯτϦϙΠϯτ ▸ 103240000͕Mach-Oϔομ →׬શͰͳ͍ͷͰ݁ہGhidraʹ೚ͤͨ (“Analyze function starts”) ▸ ࣌ؒ͸͔͔͕ͬͨ…
  13. TEXT PROTECTION IS HISTORY ▸ ༗ҙٛͳ৘ใ͕औΕΔΑ͏ʹͳͬͨ (~30min. / M1 MacBookPro)

    ▸ एׯͷ໰୊ ▸ objc_msgSendͳͲͷC APIίʔϧͷղܾ ▸ ηΫγϣϯͷܧଓతͳషΓࠐΈ
  14. 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
  15. TEXT TAKEAWAYS ▸ In-app browserԚછݕग़αΠτ͸ສೳͰ͸ͳ͍ ▸ Android΋͓ͦΒ͘ಉ༷ (payload͕֬ೝͰ͖Δ) ▸ In-app

    browser͸֎͔Β͍Ζ͍ΖհೖͰ͖Δ ▸ In-app browserΛ༏ઌ͢Δ෩ை͸Ͳ͏ͳͷ͔ →Ϣʔβʹબ୒ࢶΛఏڙ͢΂͖ →Android΋ಉ༷