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

7 things that lead to f***up

7 things that lead to f***up

Presented on iFuckup Meetup Kyiv #1 - https://www.facebook.com/events/1363042070378506/

This talk describes 7 thing you should do to not f*ck up. Deep into technology and a bit fun.

Petro Korienev

April 28, 2016
Tweet

More Decks by Petro Korienev

Other Decks in Programming

Transcript

  1. The problem • UIWebView-based browser application for iOS • After

    an iteration the regression issue is found • Login to google accounts (mail, drive etc.) is not persisted between app launches on iOS 9
  2. Investigation • UIWebView stores cookies in .binarycookies format on disk

    • Somehow it’s started to fail to read written cookies • [[NSHTTPCookieStorage sharedCookieStorage] allCookies] is nil
  3. The root-cause • We’ve adopted on-the-fly proprietary disk encryption solution

    • “on-the-fly” means “magic” • We’ve broken cookies storing mechanism
  4. Deep investigation • Encryption library hooks UNIX file-system functions. •

    200-line function with comparisons to string literals, magic numbers, system imports constants etc. • around 70-80 hooked unix implementations • And todo 17 Jan 2003
  5. • System calls atomic write to cookies file • File

    is written to temp • File is moved to original • Appropriate encryption applied • Hooked move is called on iOS 8 and not on iOS 9 Result
  6. • AdHoc for encryption solution - ignore “_tmp_” pattern •

    Initial vector for encryption is the same for temp/original • Profit Solution
  7. • Get the hook working on iOS 9 • symbolic

    breakpoints on UNIX-functions • debug symbol stubs • compare across different versions of iOS The next iteration
  8. • XCode->Debug->Always show disassembly • symbolic breakpoints on UNIX-functions •

    debug symbol stubs • compare across different versions of iOS Tools
  9. Thing #4 If you see use a previous document, you

    are most-likely doing something wrong.
  10. How to achieve Get back to original task and ask

    PO - probably we should skip it? Ask colleagues.
  11. It didn’t work for this case neither. But trying it

    first i could save a time. And for sure I could find it myself. The library works exactly as the needed hook code
  12. Ages of debugging on device, a week spent on implementing

    this for ARM architecture, offset calculations, reading Mach-O spec and i got the stubs working on iOS 9 I’ve written the solution
  13. I was inspired by my awkward solution. I’ve reversed a

    big bunch of a format. I forgot about initial issue with login, cookies, etc... Once upon a time...
  14. Under debugger, you can There are also some restrictions, bugs,

    etc. Try as a user You can’t modify an executable memory