FrenchYeti / dexcalibur

[Official] Android reverse engineering tool focused on dynamic instrumentation automation leveraging Frida. It disassembles dex, analyzes it statically, generates hooks, discovers reflected methods, stores intercepted data and does new things from it. Its aim is to be an all-in-one Android reverse engineering platform.
Apache License 2.0
1.06k stars 126 forks source link

Cannot open project UnhandledPromiseRejectionWarning #43

Open cryptax opened 3 years ago

cryptax commented 3 years ago

I am trying to open a project, it fails and shows errors in console.

[INFO] [APK HELPER] APK extracted into : /root/dexcaliburWS/alien_0/apk
TypeError: Cannot read property 'getUID' of undefined
    at DexcaliburProject.fullscan (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:712:56)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:438:49
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:695) UnhandledPromiseRejectionWarning: Error: [PROJECT] synchronizePlatform : unkow platform. Aborted
    at DexcaliburProject.synchronizePlatform (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:429:19)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:434:43
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:695) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
[INFO] [ADB] Enumerating connected devices ...
Execute command request : /root/dexcaliburWS/.dxc/bin/platform-tools/adb devices -l

This is running inside a Docker container which contains Android SDK + Android Emulators + NodeJS + Frida + Dexcalibur, (why? because I am trying to build such a container for people with Windows, for which Dexcalibur doesn't seem to install ok).

FrenchYeti commented 3 years ago

hi,

It is same issue than #42

I cannot reproduce the issue but i fixed a potential platform issue with 5942fa0a9b130a404485cd898c9e1b4e125fe25c.

Please retry with v0.7.6 (now available on NPM).

duckness commented 3 years ago

currently facing the same problem. I'm running Android 11/API 30 but don't notice it here

chrome_XbLn6F8GMk

is it related?

Tried with both 0.7.5 and 0.7.6

FrenchYeti commented 3 years ago

@duckness Can you check the content of folders inside "/.dxc/api/sdk_androidapi_29_google" ? Since you run Dexcalibur on Windows, this error can have a different root cause.

Is the stack trace is similar ? => Error in synchronizePlatform()

duckness commented 3 years ago
.dxc/api/sdk_androidapi_29_google
❯ dir

    Directory: C:\Users\duckness\dexcaliburWS\.dxc\api\sdk_androidapi_29_google

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           22/2/2021 10:35 pm                android
d----           22/2/2021 10:35 pm                androidx
d----           22/2/2021 10:35 pm                dalvik
d----           22/2/2021 10:35 pm                java
d----           22/2/2021 10:35 pm                javax
d----           22/2/2021 10:35 pm                org

after looking at the stacktrace a bit closer, I realised that the very first run (on 0.7.5) gave me that exact error:

TypeError: Cannot read property 'getUID' of undefined
    at DexcaliburProject.fullscan (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:712:56)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:438:49
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:25988) UnhandledPromiseRejectionWarning: Error: [PROJECT] synchronizePlatform : unkow platform. Aborted
    at DexcaliburProject.synchronizePlatform (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:429:19)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:434:43
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

subsequent runs on 0.7.5 and 0.7.6 gave me a slightly different error, instead of undefined, it is null. I have been unable to reproduce the undefined:

TypeError: Cannot read property 'getUID' of null
    at DexcaliburProject.fullscan (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:714:56)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:438:49
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:19708) UnhandledPromiseRejectionWarning: Error: [PROJECT] synchronizePlatform : unkow platform. Aborted
    at DexcaliburProject.synchronizePlatform (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:431:19)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:434:43
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
FrenchYeti commented 3 years ago

Very good information :)

As i cannot reproduce the error, can you patch your code with the commit dbba59a557b1489d7175d39bdeeeb81a1932b2c9 ?

Can you say me if an error occurs and if there are more error messages into terminal ?

Thanks !

EDIT: Only src/PlatformManager.js and src/WebServer.jsshould be patched.

duckness commented 3 years ago
[ERROR] Platform Manager : undefined is not a valid platform

I get this and nothing else

FrenchYeti commented 3 years ago

@cryptax can you check if v0.7.8 solves your issue ?

FrenchYeti commented 3 years ago

I close this issue. Feel free to update this issue, if problem persists.

cryptax commented 3 years ago

Just tried. The problem persists with 0.7.8.

[INFO] [APK HELPER] APK extracted into : /root/dexcaliburWS/Alien/apk
TypeError: Cannot read property 'getUID' of null
    at DexcaliburProject.fullscan (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:710:56)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:445:49
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:64) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getMinApiVersion' of null
    at DexcaliburProject.synchronizePlatform (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:411:78)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:441:43
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:64) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:64) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Would you like me to join my Dockerfile to help you reproduce?

cryptax commented 3 years ago

By the way, I am getting the same error, even without using a Dockerfile, i.e straight on the host. Version 0.7.8. Can you re-open the bug?

TypeError: Cannot read property 'getUID' of null
    at DexcaliburProject.fullscan (/home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/DexcaliburProject.js:710:56)
    at /home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/WebServer.js:445:49
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:276651) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getMinApiVersion' of null
    at DexcaliburProject.synchronizePlatform (/home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/DexcaliburProject.js:411:78)
    at /home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/WebServer.js:441:43
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:276651) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:276651) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
FrenchYeti commented 3 years ago

Did you select a device for the project ? Is this devices is successfully enrolled ?
Is it an emulator or a physical device ?

cryptax commented 3 years ago

dexcalibur

cryptax commented 3 years ago

With more tests, note this error only happens at the creation of the project. Actually, the project gets created, so, if after that you choose to open an existing project, it works, and you manage to open and analyze the APK.