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 where ...
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 ...
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 ...
Updated for August 2020:
The below information is accurate to the best of my knowledge. It has been used to decrypt config.bin on 2 different routers at the time of writing.
The obfuscated section of your config file is a series of ZLIB-compressed sections that have been encrypted with AES in ECB mode with a 16-byte key.
There is an application named cspd ...
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 ... ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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
I have spent some time to look into Apple's airplay mirroring support, which is encrypted by fairplay protocol. After investigating serveral existing commercial applications I have finally managed to get a way of decrypting fairplay protected streams.
I have extended the shairplay code to demostrate this ability. Please look at https://github.com/foxsen/...
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 ...
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 ...
What is the profile being used?
Home Automation (which is the one used by most devices) uses 'ZigBeeAlliance09' trust center link key to encrypt a random network key in the APS_CMD_KEY_TRANSPORT message. Joining devices decrypt the random network key in the APS_CMD_KEY_TRANSPORT message and then use the network key to encrypt/decrypt further network layer ...
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 ...
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 ...
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)
The first function (the one at .text:004D5A40) computes the 64-bit product of two 32-bit unsigned operands and stores the result through EAX. It is probably some half-assed 16-bit code recompiled with a half-assed 32-bit compiler...
For a quick test you can paste the disassembly into an __asm block to make it recompilable. Then you can make a call stub to ...
I think the API you're looking for is idaapi.make_ascii_string(start, len, strtype)
It's not really documented on https://www.hex-rays.com/products/ida/support/idapython_docs/idaapi-module.html but an example blog post showing how to use the API for a similar circumstance is here: http://security.my/post/38222980198/decrypting-strings-in-a-binary-with-an-...
A good way to find compressed or encrypted parts in a binary is entropy investigation, as compressed and encrypted parts show a high degree of disorder (a value of 1 means maximum disorder). I can recommend the tool binwalk which produces a graphical output of the memory's entropy. The picture shows a binwalk output, as an example of such a static analysis ...
Your code has a function at 0x400960 that looks like a main function, and, omitting all initialization (everything gets initialized to 0) and error checking, looks like this:
Good news, You're lucky!
What you're facing in front of you is a stream cipher. Why is that good? because the way stream ciphers are built makes them extremely easy to reverse - the decryption and encryption functions of stream ciphers are actually the same function.
A stream cipher is a symmetric key cipher where plaintext digits are combined with a ...
Based on your examples, it looks like the strings are reversed and each byte is XORed with the byte 4. Here's a quick Perl one-liner to demonstrate this:
perl -lne 'print reverse($_) ^ ("\x04" x length($_))'
and what happens when you apply it to your test strings:
$ cat test.txt
It seems they also added compression there.
This utility seems to decode it: https://www.nirsoft.net/utils/router_password_recovery.html
Also, I'd just written my own decoder and encoder for it:
openssl enc -d -des-ecb -K 478DA50BF9E3D2CF -nopad -in conf.bin -out conf.lztp
There exists an official encryption addon for SQLite but from your description it sounds more like the data is simply stored encrypted in the blobs and the application decrypts it internally before displaying its content, however:
we don’t know the exact encryption algorithm
we don’t know how the password you enter is converted into the decryption key