After a little bit more work and some more careful re-reading, I figured out my mistake: the files in /data/app-asec/ are the encrypted containers. They're actually dm-crypt volumes, which then get mounted at /mnt/asec/[app_id]. The pkg.apk in that directory is the unencrypted apk that can be analyzed using any of the fine tools in this answer.
TL;DR: What we have here is probably not an encryption algorithm, it is more likely a decompression loop, by the look of it. It simply does not do anything that could be considered even remotely similar to encryption.
Encryption algorithms are divided into two classes. First is a stream cipher. From wikipedia:
A stream cipher is a symmetric key cipher ...
I hope you recognized base64. The first few bytes in a hexadecimal dump are
30 82 04 a3 02 01 00 02 82 01 01 00 a2 9f 9e 9e
30 82 screams “ASN.1 DER” — 30 means “sequence”, 82 means “followed by a 2-byte length” and the next two bytes are the length. The first element in the sequence has the type integer, with a 2-byte length 01 01 (257), and the next 257 ...
To create a full duplicate, able to generate valid transmission packets you'll need the following information:
Button press mapping
32 bit of KeeLoq encrypted data
See attached Figure 1-2, from the datasheet, near "Transmitted information" at the bottom right:
Using those three pieces of information you can theoretically create your own ...
You can try to use binwalk. It can be used in various ways:
Embedded file identification and extraction
Executable code identification
Entropy analysis and graphing (useful for compression and encryption identification)
"Smart" strings analysis
You could also try to open your file with 7zip, since it supports a shitload of compression formats.
There is clearly not enough of information to get you the exact answer. However, I will try my best to demonstrate logic behind what happens. That in a way might give you an idea how to go about locating the encryption function. I will assume you are using Windows, since it has not being stated otherwise.
The main logic of ordinary (and when I say ordinary,...
I would start with not have critical strings in memory in linear manner
Instead each character can be offseted by some offset like by table mixing all the strings together. For example you got 0123456789 if you store them in memory like this:
where x is anything or another string ... ...
First I would run some static analysis on the application such as Findcrypt or ProtectID and PEID's Kanal plugin to scan for known static values used in various encryption algorithms. If you find something, check which function accesses them with cross referencing (X in IDA, CTRL+r in olly) and you will get to the encryption function(s) or at least very near ...
There are typically many ways to start, and which one you want to use depends on your experience. Also, what works for one target might fail on another, and vice versa. What i'd start with is:
Use signsrch to check if the executable has a standard encryption algorithm linked in. Note that this might yield false positives (if the application links openssl, ...
Initialization of the forward S-box
As you probably saw in the source-code, the forward S-box is present several times and initialized at two different places.
The first time that the forward S-box (Fsb) is declared is at the top of aes.c:
This array is then dynamically generated by aes_gen_tables() like this:
FSb[0x00] = 0x63;
This is not yet a complete answer, but perhaps what I've found can be combined with other information to come up with the complete solution.
First name encoding
If we assume a linear encoding, then we have everything needed to figure this out based on your four samples. If we consider letter values as a=0, b=1, ... regardless of whether they're uppercase ...
This is quite likely either a botched RIPEMD128 or something very similar, as otus also commented.
You wanted to know how to approach such a task so I'll explain what I did.
Typically, when trying to identify crypto-related code you rely on spotting constants. In this case, the constants seem to be obfuscated on purpose, so you need to play around with the ...
I would start with checking the first bytes of a file after base64 decoding. Those would indicate what file format is.
MZ(5A4D) - meaning this is an executable file and you can start with executing it in save (virtual) environment with SysInternals utilities open - ProcMon and Process explorer. In addition, calculate its MD5 value and look it in the Net, ...
Assuming the you are speaking about strong encryption, most of the algorithms are supposed to be indistinguishable even if you provided either the key or the clear text. So, it should not be possible to know that a given key is used just by looking at the result.
One example of this is the field of Kleptography where:
[...] the outputs of the infected ...
Statically, use IDA to find all cross-references to the "various algorithms in use" to determine how they find the keys they use.
Dynamically, use a debugger to set breakpoints on the "various algorithms in use", thereby allowing you to examine the callstacks and determine how they find the keys they use.
In case you're still trying to figure this out, I've made some progress. With assistance from u/jccool5000 on reddit (post), who has a collection of over 900 samples mostly from Ontario. AFAIK, Ontario and NJ share the same encoding - Quebec, not so sure. I did some data manipulation to figure this out.
Starting with the numbers of the last name, 1st of 4 ...
There are a number of ways to accomplish what you've stated. Generally, more robust techniques, while affording a higher level of protection, will also put more burden on the programmer creating the software. So in approximately increasing order of difficulty, here are some ideas:
Store the data non-contiguously
The simplest approach is to simply not ...
mix_column returns _col (typo underscore?)
The return value of mix_columns just concatenates the columns together like rows instead of slotting them back into columns - effectively transposing the result.
AESENC takes its parameters and returns its results as columns concatenated together. Your aesenc takes the parameters and returns the ...
I'm trying to hack a similar router (ZXHN H298N).
I took your config.bin and mine, the headers look pretty similar, as does lukas'... The key differences are the lengths of the files, and the name of the router in the 'magic area'.
Anyhow here's my efforts at decipher the header by hand:
-------- 1st 64 byte block --------
This is actually one of the main attributes of Cryptographic Hash Functions. As mentioned in the wiki page, they are designed so they cannot be reversed:
It is infeasible to generate a message from its hash value except by trying all possible messages
Additionally, the property which dictates a small change in the message will result in a completely ...
Edit: The encryption is Bitwise XOR with the key 0x04 (see the bottom of this answer)
The application uses a simple Substitution Cipher (Or, to be exact Caesar Cipher with shift 4) and then perform reverse() on the function.
We can domnstrate it using python's maketrans method:
The method maketrans() returns a translation table that maps each
Disclaimer: I do not work for any of the companies that make either of these pieces of software. All details shown are from my own personal research.
This comparison will only include the protectors I personally have a licence for: VMProtect and Themida. I do not have a licence to Enigma, so I cannot tell about its protection features.
I will also not be ...
The best way to locate AES in a binary blob would be to locate first the AES S-box. It is specifically designed for AES and recommended by the NIST, so a standard AES must include it. Moreover, they are quite unique and easily found through a simple pattern recognition. Here is the value of such S-box:
unsigned char s =
0x63, 0x7C, 0x77, 0x7B, ...
Many states use something called SoundEx to generate license numbers (sometimes you even see SoundEx on government forms and/or computer screens when they ask for drivers license numbers.)
The soundex system was designed to phonetically map names that sound similar to close values, even though they might be spelled wildly differently eg Pheiffer vs Fifer)
I don't see this above, but male or female is coded in as well. in the last five digits, the first 2 are month of birth. Males are 01-12. Females 50 is added. so the run from 51 (january) to 62 (december)
Also, my name is Alexandra, which is also 019 as is your example of alexander.
The absence of a middle name is reflected as 00
i know a friend with ...
You could give a shot at dynamic binary visualization. There's an excellent presentation given by Christopher Domas at REcon as well at BlackHat 2013. The deck for REcon is available here.
I believe the tool is out now in beta so you could give a try at it.
I would say this guide is a good place to start. However, this is assuming when you say "wifi-like" you mean very similar to authentication using WPA2.
Cracking WPA2 is a little more complex than WEP, for example. The initialization code for WPA2 uses a four-way handshake to properly initialize all of the vectors that are used in the actual encrypting. So ...