Reverse engineering Samsung system apps - Galaxy S6 Themes and Apps

Hi,
I'm trying to reverse engineer certain Samsung system apps in the Galaxy S6 firmware system image, such as KnoxAttestationAgent.apk. I'm a noob when it comes to reverse engineering, and so far my attempts have been unsuccessful. Here's what I've done so far.
- Run apktool on the APK. I got a few XML files, including the AndroidManifest, but no source. Apparently this is because there is no classes.dex in the package.
- Noticing that there's a KnoxAttestationAgent.odex in the arm64/ folder, I tried to run baksmali 2.1.1 on it. However, this version apparently doesn't support Android 5 versions of oat. The S6 firmware I'm working on is 5.1.1.
- I tried an earlier version of baksmali 2.0.8 which doesn't have the limitation, but I get another error "KnoxAttestationAgent.odex is not an apk, dex file or odex file."
- I tried to run AndroGuard on the APK, but was also unsuccessful. A bunch of errors.
Is there a way for these tools (or others) to work on system apps such as the Samsung Knox ones?
Thanks!

Related

RELEASED - Nook Color 1.2 w/ su / root / and off-market APK Install Enabler

We have a nice little discussion going in the Development section. The 1.2 root / APK enabler is now available and ready for testing. Let me know what you think, and what you'd like to see done in the future. It's all down-hill from here.
http://forum.xda-developers.com/showthread.php?p=13212931#post13212931
I’m having problems
I am unable to get the apk files to run on my nook color.
I was at some point able to install apk files from the browser.
I had so other issues and had to start over from scratch. After doing so and running the new version now when I download the apk files from the browser it tells me it is an unrecognized file and does nothing with it. Everything else seemed to work with the patch but the key feature.

Why does the SW Upgrade show "Cannot open binary file"?

Hello there, I tried restoring my sprint galaxy tab using SW upgrade and i can't just figure out why it shows this below:
could be a windows error?
hey
do you have a solution to this "windows's error"?
+1
I've been having the same problem on both Win& 64bit and 32bit machines. After several tries and searching around the forums I even tried unzipping the "SPH-P100.EA24.SECURE.REV07-FULL_CL871413.tar.md5" file in the binary folder before using the GUI again but it still doesn't work. Installing via heimdall has been a no go as well. I don't know how to use Odin, so I haven't tried that.
I'm having major issues getting my camera and gps back after playing with the CDMA Honeycomb 2.5 build and it would be nice if I could get this to work. My Titanium backups aren't fixing the issue either.
I bought this as a toy (the W00t sale) to learn about android and I am definitely getting schooled.
Same issue
I'm getting the same error. It looks like the program can't find the binary file that comes with the download. Does it have to be in a specific directory? I've tried c:\, c:\Program Files, c:\Program Files (x86) and my desktop.
Anybody figured this out yet?
I ended up flashing with the Odin version from this post. The zip includes a text file with instructions on how to use Odin.
It worked for me and fixed my camera problem.

[Q] How to mod XAP files.

I have LUMIA 620 dev unlocked via dream spark.
I downloaded XAP file from marketplace and it seams to be encrypted so they are not installing via DEV tools to my device.
But i searched around some apps which can be installed via DEV tool because the are modified and i want to know what are the changes that are need to be made in XAP files:good:
One thing i have noticed that those XAP files which can be installed on device via DEV can be opend via any archive software like winrar etc...
but those XAP that are not able to install on device via DEV cannot be open with any archive software.
prashantvrm said:
One thing i have noticed that those XAP files which can be installed on device via DEV can be opend via any archive software like winrar etc...
but those XAP that are not able to install on device via DEV cannot be open with any archive software.
Click to expand...
Click to collapse
The XAP files from the store are encrypted. Unless someone figures out a way to break the encryption, it cannot be done.
The XAP files you found are probably home-made apps, which can be sideloaded, because they're deployed by developer tools in an unencrypted format, or WP7 apps. The encryption is applied after you submit the XAP to the store.
There is no known workaround to sideload store XAPs without an SD card, at the moment.
TheGoldrocker said:
The XAP files from the store are encrypted. Unless someone figures out a way to break the encryption, it cannot be done.
The XAP files you found are probably home-made apps, which can be sideloaded, because they're deployed by developer tools in an unencrypted format, or WP7 apps. The encryption is applied after you submit the XAP to the store.
There is no known workaround to sideload store XAPs without an SD card, at the moment.
Click to expand...
Click to collapse
You are correct sir. It sucks that you can't even sideload Xaps that were downloaded manually due to the app being removed from the WP store on a non-SD device. I'm trying to see if I can make a workaround for this though. It would be nice if it worked. In terms of modifying the encrypted XAP, it'll be a while before one of us figures out how to decrypt, but at the same time that opens a whole new can of worms regarding to piracy.
I've looked at the encrypted XAPs a bit myself; they're basically a PlayReady wrapper around the ZIP archive (XAPs are just renamed ZIP files; I usually use 7-Zip to open them). Unfortunately, I don't think anybody has broken PlayReady yet. The various programs which claim to strip PlayReady (usually from music or video) all appear to work by running the file through the decoder built into various programs like Zune and Windows Media Player, and re-capturing the content that comes out of the decoder. That won't work for these files.
We might be able to do something similar if we can get the XAP decoder out of the phone ROM and use that, though it will be ARM code (I don't know if the x86 "emulator" image includes the DRM decoder) and therefore somewhat tricky to work with. It will also probably be obfuscated to deter reverse engineering, and may be difficult to make work independently. A kernel debugger on the phone may be needed to figure it out.
GoodDayToDie said:
I've looked at the encrypted XAPs a bit myself; they're basically a PlayReady wrapper around the ZIP archive (XAPs are just renamed ZIP files; I usually use 7-Zip to open them). Unfortunately, I don't think anybody has broken PlayReady yet. The various programs which claim to strip PlayReady (usually from music or video) all appear to work by running the file through the decoder built into various programs like Zune and Windows Media Player, and re-capturing the content that comes out of the decoder. That won't work for these files.
We might be able to do something similar if we can get the XAP decoder out of the phone ROM and use that, though it will be ARM code (I don't know if the x86 "emulator" image includes the DRM decoder) and therefore somewhat tricky to work with. It will also probably be obfuscated to deter reverse engineering, and may be difficult to make work independently. A kernel debugger on the phone may be needed to figure it out.
Click to expand...
Click to collapse
It would be nice to be able to put one on the emulator itself and see what was going on..
I offer up my Programs folder dumped from my Lumia 928 if it is any help. Devs do with it as you will At the very least under common files you will find the xaps installed on my device which do open with 7zip and include the license xml. As far as installing or side loading I did throw a few xaps at the various emulators with mixed results. Have at it guys!!!
http://sdrv.ms/13tlc0F
tonbonz said:
I offer up my Programs folder dumped from my Lumia 928 if it is any help. Devs do with it as you will At the very least under common files you will find the xaps installed on my device which do open with 7zip and include the license xml. As far as installing or side loading I did throw a few xaps at the various emulators with mixed results. Have at it guys!!!
http://sdrv.ms/13tlc0F
Click to expand...
Click to collapse
Xaps within the Programs directory from a ROM are unencrypted. These will help out a lot though!
Edit: Ohhh... Something interesting. CommonFiles\Xaps\SyncUi.xap is the Verizon Backup Assistant. This has some code to intercept SMS..
<Extensions>
<!-- Email & Accounts UX Integration -->
<Extension ExtensionName="Accounts_Extension_Standard" ConsumerID="{47998C28-3D90-11E1-8E07-8B2B4924019B}" TaskID="_default" ExtraFile="Extensions\Extras.xml" />
<Extension ExtensionName="SMS_INTERCEPT_STANDARD" ConsumerID="{55DB4873-5CDF-43B0-82B4-87EB13E9BF6B}" TaskID="SmsInterceptAppExtension" ExtraFile="Extensions\Extras.xml" />
<Extension ExtensionName="Service_Agent_Application" ConsumerID="{208558CC-4407-40F8-83AE-AE3D567126B3}" TaskID="BackgroundTask" />
</Extensions>
snickler said:
Xaps within the Programs directory from a ROM are unencrypted. These will help out a lot though!
Edit: Ohhh... Something interesting. CommonFiles\Xaps\SyncUi.xap is the Verizon Backup Assistant. This has some code to intercept SMS..
<Extensions>
<!-- Email & Accounts UX Integration -->
<Extension ExtensionName="Accounts_Extension_Standard" ConsumerID="{47998C28-3D90-11E1-8E07-8B2B4924019B}" TaskID="_default" ExtraFile="Extensions\Extras.xml" />
<Extension ExtensionName="SMS_INTERCEPT_STANDARD" ConsumerID="{55DB4873-5CDF-43B0-82B4-87EB13E9BF6B}" TaskID="SmsInterceptAppExtension" ExtraFile="Extensions\Extras.xml" />
<Extension ExtensionName="Service_Agent_Application" ConsumerID="{208558CC-4407-40F8-83AE-AE3D567126B3}" TaskID="BackgroundTask" />
</Extensions>
Click to expand...
Click to collapse
I don't like the sound of that The app is part of the settings on my device but when opened says there is a problem with my account and contact Verizon.
@tonbonz: Thanks for the dump! That could be really handy. I'll explore and see if I can find anything useful. Any direct applications will likely be Nokia-specific (which among other things means I can't test them) but lots of people have Nokia phones, and I may find something more generally useful too.
GoodDayToDie said:
@tonbonz: Thanks for the dump! That could be really handy. I'll explore and see if I can find anything useful. Any direct applications will likely be Nokia-specific (which among other things means I can't test them) but lots of people have Nokia phones, and I may find something more generally useful too.
Click to expand...
Click to collapse
I've enjoyed the benefits of all the devs and their hard work here at XDA since my HTC Trophy. Glad to give back in any way I can. If any other files or folders are needed I would be happy to oblige...and... I thank you sir!!!
Oh what the h*** Rest of the dump files currently uploading. Dump 1, three 7z files altogether, is the Programs folder from earlier post. Left out maps data from Data/shared data folder as it was huge and of no consequence as to what we are trying to accomplish. Also, to be clear, this is a dump from the Lumia 928 variant package not my actual device. Have fun!!!
http://sdrv.ms/13tlc0F
@djtonka Thank you for your tutorial on Nokia Care Suite on wimdowsmania.pl. 
 @AnDim Extra thanks for ImgMount Tool which was used to dump these files!!!
I'll let you know. Just for curiosity's sake, how are you extracting those files? Is it from a working device, or a ROM image?
EDIT: Just saw your message, thanks for the info!
Initial results are a mix of cautious hope, disappointment, and speculation.
1) The OEM apps use a ton of restricted capabilities (among the most tame, for example, is "ID_CAP_MEDIALIB_PHOTO_FULL", which gives direct access to the image folders and has visibility "public" according to the policy XML files from the Windows directory).
2) The OEM apps can be sideloaded, but you have to remove the PlayReady header and all the restricted capabilities. They aren't very exciting at that point; they may not even start up.
3) Speculation: The so-called "public" restricted capabilities require a (Store-?)signed app when used on a standard phone. It *may* be possible to sign the apps ourselves, install that cert on the phone, and then sideload them, but I doubt it.
4) More speculation: These new, high-privilege capabilities seem to have largely replaced ID_CAP_INTEROPSERVICES. Although the error when trying to sideload them on an interop-locked phone is different than it is for INTEROPSERVICES, it may be that an interop-unlock would allow sideloading apps that use those capabilities anyhow.
5) The OEM apps include WPInteropManifest.xml. It's exactly the same near-empty file as on WP7. However, they don't use COM but instead use the same native-CLR interop as the official SDK advocates (.winmd files that bridge managed code to C++ DLLs). Its presence does not impede sideloading.
6) Speculation: The WPInteropManifest may be needed for apps which intend to use the "raw" win32 API (as opposed to WinRT) in C++. This theory is supported by the presence of things like DLLs that read and write to the registry directly (not through a driver, which would need INTEROPSERVICES), using APIs such as RegCreateKeyW.
7) More speculation: Since we can extract the system libraries from our phones, it should be possible to use the DLL-to-LIB tools to create .LIB files (the official WP8 SDK is extremely short on these) that we can then use to link to the native Win32 API. Although we would still be (cripplingly) limited by the sandbox's low permissions, we could probably do things like write a basic registry browser.
8) The provxml commands to install apps are very simple, but I don't understand all the parameters. Nonetheless, whenever we have an app, its license, and a tool which can process AppInstall provxmls, we should be able to install those apps on any reasonably compatible phone.
9) Speculation: Due to the use of OS-based capabilities rather than OEM drivers, an app that is installed on any given phone *should* work on other OEMs' phones even if it accesses the registry or does similarly privileged operations.
10) There may yet be a vulnerable app which we could exploit (possibly by using a provxml-injection attack?) to write to the registry / move files / do similar stuff. However, it would probably have very limited permissions even so; unlike on WP7, most things which can write to *some* of the registry can't write to *most* of it.

Samsung Live Wallpaper App Missing after debloat.

Howdy all,
I recently rooted my note 5 and ran this debloating script which worked fantastically. However, it did remove the Samsung live wallpaper app which has left me unable to use live wallpapers.
So "no problem" I thought, went and found the .APK for Android 7 online and tried to install it. Unfortunately I get the error "The package conflicts with an existing package by the same name." error.
I've been attempting various fixes I found after googling the problem however I've yet to find anything that'll work (and is within my realm of understanding) in this instance. So what I'm hoping is one of you folks can help me fix this little annoyance without having to completely blow out my phone and edit the debloat script to not uninstall that app.
Cheers!
InfiniteWeird said:
Howdy all,
I recently rooted my note 5 and ran this debloating script which worked fantastically. However, it did remove the Samsung live wallpaper app which has left me unable to use live wallpapers.
So "no problem" I thought, went and found the .APK for Android 7 online and tried to install it. Unfortunately I get the error "The package conflicts with an existing package by the same name." error.
I've been attempting various fixes I found after googling the problem however I've yet to find anything that'll work (and is within my realm of understanding) in this instance. So what I'm hoping is one of you folks can help me fix this little annoyance without having to completely blow out my phone and edit the debloat script to not uninstall that app.
Cheers!
Click to expand...
Click to collapse
First off you are supposed to learn about editing the script & then flashing it after making necessary changes to the script by deleting the lines of needed apks.
Secondly for the apk package conflict, you need to manually replace the apk to its actual location with an file explorer capable to access root & restart the phone.

What is the function of the "/ prism" directory in the system folder? (SM-A715F/DS)

Good day,
I recently discovered malware in the root directory under the / prism folder that installed an app called Yandex into my system and contained various hidden APKs. (and files with .sogou at the end).
These manipulated my internet browser in some way and I was only able to remove them by flashing the stock rom.
Now I get the message from TWRP that the partition / prism could not be mounted. Even so, everything seems to be working fine on the device.
Now there is no more content in the / prism directory. What is usually stored there and what is its purpose?
Do I have to rework something?
I can't find an explanation anywhere else on the Internet ...
Thank you and best regards
According to https://github.com/PrismLibrary/Prism
Prism provides an implementation of a collection of design patterns that are helpful in writing well-structured and maintainable XAML applications, including MVVM, dependency injection, commands, EventAggregator, and others.
Click to expand...
Click to collapse
In short Prism is a framework to build applications which in turn it's built on top of another framework called Xamarin (XAML for Android).
As of why it's in the root directory I suspect is part of AppCloud, Samsung's system app, that basically does remote installation of apks.
If it is correlated to AppCloud (Big IF) then:
If you are rooted and on stock OS and have that app enabled it's not far fetched to think that there is an exploit for it out there and basically anyone could remote install any APK through root privileges and the backdoor that AppCloud system app gives the.
It's could be as easy as editing a file from within the malicious app which could change the behaviour and URL from which it fetches the needed apks. Whereas installing apks from within the malicious app needs explicit OS permissions (which AppCloud has).
I too had apps installed post-upgrade by the AppCloud system app, but I don't have root to analyse this further so all the above are just speculations based on the two things you said and my previous observations.
In the end you could have contracted the malware in a million different ways. That's how it goes with root access on OS and careless root management.
I have to admit that I was too careless with root privileges and experimented with little knowledge.
Hope that helps others to deal with it more intensively beforehand.
Your explanation helped me, the problem is a bit more serious, it is probably about corrupt security certificates in the system that are administered from outside
In this case, is it even possible to reset or delete the CA certificates? I guess I fell into a spoofing trap.
Maybe flash the stick rom again through Odin?
Is that embarrassing: D
Sorry for the graveyard post but I don't see any other threads about this.
Prism is the name of the NSA surveillance program. I guess that this is exactly that.
It's hidden because you can only see that it exists with root and most people don't have root.
I have this folder too on my rooted Galaxy Fold 4. It was already in the stock ROM and I cannot remove it because the directory is mounted as read only.
If found the mounts file (which is also read-only) and it says:
Code:
/dev/block/platform/soc/1d84000.ufshc/by-name/prism /prism ext4 ro,seclabel,relatime,i_version 0 0
I tried to give me the permission to write / delete the folder but "permission denied" ... and yes I did that as root.
Nexariuss said:
Sorry for the graveyard post but I don't see any other threads about this.
Prism is the name of the NSA surveillance program. I guess that this is exactly that.
It's hidden because you can only see that it exists with root and most people don't have root.
I have this folder too on my rooted Galaxy Fold 4. It was already in the stock ROM and I cannot remove it because the directory is mounted as read only.
If found the mounts file (which is also read-only) and it says:
Code:
/dev/block/platform/soc/1d84000.ufshc/by-name/prism /prism ext4 ro,seclabel,relatime,i_version 0 0
I tried to give me the permission to write / delete the folder but "permission denied" ... and yes I did that as root.
Click to expand...
Click to collapse
did you ever find anymore about this? ive found it on two of my phones. both samsung. cant find much online about it...

Categories

Resources