Skip to content

Instantly share code, notes, and snippets.

@victorrica
Last active November 20, 2021 08:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorrica/e516f27d29973d8e0fd9789d87ec3a6d to your computer and use it in GitHub Desktop.
Save victorrica/e516f27d29973d8e0fd9789d87ec3a6d to your computer and use it in GitHub Desktop.
Shifty 앱 리버스 엔지니어링
Java.perform(function() {
var array_list = Java.use("java.util.ArrayList");
var ApiClient = Java.use('com.android.org.conscrypt.TrustManagerImpl');
ApiClient.checkTrustedRecursive.implementation = function(a1, a2, a3, a4, a5, a6) {
// console.log('Bypassing SSL Pinning');
var k = array_list.$new();
return k;
}
}, 0);

Default Header

cookie

shiftee_employee_auth_token=(auth_token)

authorization

SHIFTEE-AUTH-TOKENS shiftee_account_auth_token=(auth_token),shiftee_employee_auth_token=(employee_auth_token)

출근

URL

Method

  • POST

Content

  • {"shift_id":(shifty_id),"wifi_bssid":(wifi_based)}

Response { "attendance": { "attendance_id": (attendance_id), "shift_id": (shift_id), "company_id": (company_id), "location_id": (location_id), "position_id": (position_id), "employee_id": (employee_id), "clock_in_time": (시간), "clock_out_time": null, "note": "", "notes": [""], "approved": false, "created_at": (created_at) } }

퇴근

URL

Method

  • PATCH

Content

  • {"wifi_bssid":(wifi_based)}

Response 위와 동일

휴식

URL

Method POST

Response { "break": { "break_id": (break_id), "company_id": (company_id), "attendance_id": (attendance_id), "break_in_time": (break_in_time), "created_at": (created_at), } } Content {"attendance_id":(attendance_id),"wifi_bssid":(wifi_bssid)}

휴식 종료

URL

Method PATCH

Content {"wifi_bssid":(wifi_bssid)}

shifty앱 리버스 엔지니어링을 위해 시도한 내용들을 정리 해두었습니다.

첫번째 시도 ( 패킷 스니핑 )

패킷 스니핑을 위해, Mac환경에 Charles(패킷 스니핑 툴) 과 Genymotion(안드로이드 에뮬레이터)를 설치 하였습니다. 가장 기본적으로 앱을 키고 내가 현재 사용하고 있는 네트워크 환경에 Proxy를 연결하여 패킷 스니핑 시도. 그러나, https를 사용 하고 있고 SSL로 암호화 되어있어 가로채기 실패. SSL 프록시를 하였으나, SSL Pining이 되어있어 가로채기 또 실패.

두번째 시도 ( Apk decompile )

앱 디컴파일 후, 내부 파일들을 확인한 결과 ionic으로 구성된 하이브리드 앱이었다. 대부분의 코드는 ionic위에서 작성된 자바스크립트로 이 파일 또한 build되서(compress) 너무 ugly하게 보여서 pass.

세번째 시도 ( SSL pining 우회 )

에뮬레이터에 frida-server를 올리고 SSL Bypass하는 스크립트 작성 [ bypass_ssl_pining.js ] bypass 후 스니핑 시도. 성공적. 그러나, 디바이스 검증 시도로 인해 접근 실패.

사용했던 명령어

adb root
adb shell "/data/local/tmp.frida-server &"
frida -U -f io.shiftee.app -l bypass_ssl_pining.js.js --no-pause

네번째 시도 ( 디바이스 정보를 가져온후 스푸핑 )

사실 이 모든 시도는 루팅하면 간단히 모든게 해결할 수 있었으나, 삼성 핸드폰이라 루팅하고 싶지않았다. 그래서, 핸드폰 안에 시프티앱 내 저장되어있는 db를 가져와야 했으므로 시프티 앱을 맥에 복원 한 후에 복호화 작업후 sqlite로 db 읽어서 auth_token이랑 device 정보 등 을 가져왔다. 모든 정보들을 에뮬레이터에 스푸핑 하고, 접근시도. 성공적. 모든 접근이 이제 가능해져서 다시 Charles를 통해 패킷 스니핑 후 API Endpoint 및 Request Header, Authenicate, Content 그리고 Response Body를 가져왔다.

사용했던 명령어

핸드폰

adb backup -noapk io.shiftee.app
dd if=backup.ab bs=1 skip=24 | python2.7 -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
sqlite3 apps/io.shiftee.app/db/_ionicstorage
.tables
select * from _ionickv;

에뮬레이터 ( 참고로 에뮬레이터의 모델명, 안드로이드 버전을 내 핸드폰과 동일하게 일치 시켜야 한다)

sqlite3 /data/data/io.shiftee.app/databases/_ionicstorage
settings put secure android_id (device_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment