Skip to content

Commit e58e218

Browse files
committed
December Update
-Added detectors for allatori -Improved transformer recommendations -Better detectors for ZKM -Small fixes
1 parent 52c9a9e commit e58e218

27 files changed

+354
-54
lines changed

commonerrors/Allatori.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
## Flow Obfuscation
2-
The latest versions of Allatori contain some flow obfuscation which moves around some instructions, so it is necessary to run allatori.FlowObfuscationTransformer to fix this. This transformer should always work, but if it doesn't, open an issue! Note: It is not necessary to run this before allatori.StringEncryptionTransformer.
2+
The latest versions of Allatori contain some flow obfuscation which moves around some instructions, so it is necessary to run allatori.FlowObfuscationTransformer to fix this. This transformer should always work, but if it doesn't, open an issue (an exception is if there is another type of flow obfuscation layered over it)! Note: It is not necessary to run this before allatori.StringEncryptionTransformer.
3+
4+
## Transformers to Use
5+
allatori.StringEncryptionTransformer works the fastest, although in rare cases where it doesn't work, you can use allatori.string.StringEncryptionTransformer.

commonerrors/DashO.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
## String Encryption
2-
If you get an error relating to SourceResult, it is because DashO's flow obfuscation was applied, which messes with the string decryptor. Run dasho.FlowObfuscationTransformer first, and you will able to decrypt all the strings.
2+
If you get an error relating to SourceResult, it is because DashO's flow obfuscation was applied, which messes with the string decryptor. Run dasho.FlowObfuscationTransformer first, and you will able to decrypt all the strings.
3+
4+
## Transformers to Use
5+
dasho.StringEncryptionTransformer works the fastest (and it cleans up properly), although in rare cases where it doesn't work (you get an error not related to SourceResult), you can use dasho.string.StringEncryptionTransformer.

commonerrors/General.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
In general, files must be deobfuscated in the reverse order in which obfuscators were applied. For example, if your file is obfuscated with Stringer and then Allatori, you would run the Allatori transformers, and then the Stringer ones. Also, if an obfuscator was applied multiple times (e.g. several layers of Allatori), you must run the transformers multiple times. The only exception with this rule is with flow obfuscation transformers, which typically do not need to be run multiple times.
1+
## Ordering
2+
In general, files must be deobfuscated in the reverse order in which obfuscators were applied. For example, if your file is obfuscated with Stringer and then Allatori, you would run the Allatori transformers, and then the Stringer ones. Also, if an obfuscator was applied multiple times (e.g. several layers of Allatori), you must run the transformers multiple times. The only exception with this rule is with flow obfuscation transformers, which typically do not need to be run multiple times.
3+
4+
## Write Errors
5+
If you see an error similar to "ClassA could not be found while writing ClassB" it is NOT a deobfuscation error. It just means that you have not added the right libraries. Unless you are trying to run the outputted file (Note: There are no guarantees that it will run, especially with obfuscators like ZKM) it will not affect you.
6+
7+
## Adding Libraries
8+
Adding libraries is usually good practice, but isn't necessary unless you are dealing with reflection obfuscation. If you are having trouble adding libraries, you can use deobfuscator-gui (https://github.com/java-deobfuscator/deobfuscator-gui) and add the library JARs to the "Path" tab. Libraries are what the program needs to run, so rt.jar (look this up!) should always be added. Then, check what JARs need to be available (for example, spigot plugins would need the spigot JAR) and add them accordingly.
9+
10+
## ZIP Compression Errors
11+
If your file cannot be opened in Bytecode Viewer or another decompiler (and it has valid classes), it may be using a certain ZIP compression that crashes decompilers. In that case, be sure to run deobfuscator on it once with no transformers, and then decompile the output ZIP. This will most likely fix the error.
12+
13+
## ASM Errors
14+
If the class files cannot be loaded (an error like IllegalArgumentException appears) and you are **certain** that they are valid, that means that an ASM exploit is being used. Since ASM is unable to parse these files, the deobfuscator is unable to deobfuscate it.
15+
16+
## Normalizers
17+
Normalizers should always be used last. If it is used first, then any string or reference obfuscation transformers applied afterwards will most likely fail, because they require that the classes and methods to retain their obfuscated names.

commonerrors/Radon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
## RadonTransformer(V2)
2-
RadonTransformer was meant to work on the earlier versions of Radon, while RadonTransformerV2 works on the later versions. Use RadonTransformer first, and if it doesn't work, use RadonTransformerV2. Note that there are some settings in the transformer that you cannot configure without forking the project.
2+
RadonTransformer was meant to work on the earlier versions of Radon, while RadonTransformerV2 works on the later versions. Use RadonTransformer first, and if it doesn't work, use RadonTransformerV2. Note that there are some settings in the transformer that you cannot configure without forking the project. Also, if your file has invokedynamic obfuscation, you should add all required libraries.

commonerrors/Stringer.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
## HideAccess Obfuscation
2-
If you see an error while running the transformer, it means that you did not remove the string encryption. Run stringer.StringEncryptionTransformer first and you will be able decrypt Stringer's hide access. Note that you need to add all libraries that are used by the JAR, otherwise you will not be able to decrypt the file!
2+
If you see an error while running the transformer, it means that you did not remove the string encryption. Run stringer.StringEncryptionTransformer first and you will be able decrypt Stringer's hide access. Note that you need to add all libraries that are used by the JAR, otherwise you will not be able to decrypt the hide access!
3+
4+
## Other Stringer Transformers
5+
In general, you should only use stringer.HideAccessTransformer, stringer.StringEncryptionTransformer, and stringer.ResourceEncryptionTransformer. The stringer.vX transformers are meant for specific versions of Stringer and should not be combined with the stringer.StringEncryption or stringer.HideAccess transformers.

commonerrors/UnknownObf.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Finding Obfuscators
2+
If the "detect" option did not show any obfuscators, be sure to try running most of the transformers (excluding the general category) first. If none of them are able to deobfuscate the file, check if the file doesn't just have name obfuscation (which is not reversible, but you can rename them to generic names using normalizers). It is recommended to decompile the file to try to find the type of obfuscation, as the detect feature is not perfect. Scroll to the bottom of this repo to get some examples of code to look for: https://github.com/GraxCode/threadtear
3+
4+
## A Note on the Detect Feature
5+
The detect feature mainly searches for string encryption and sometimes reflection obfuscation methods. This means that if a file is only obfuscated with flow obfuscation, the detect feature will not be able to find the type of obfuscation used. Also, obfuscators that are rarely seen (like SkidSuite) or have too many variations (like Radon) will not be detected.

commonerrors/Zelix.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## String Encryption
2-
The string encryption transformer supports ZKM 5-8. If the file was obfuscated using ZKM 9 and up, the strings will only be decrypted if the file lacks method parameter changes.
2+
The string encryption transformer (zelix.StringEncryptionTransformer) supports ZKM 5-8. If the file was obfuscated using ZKM 9 and up, the strings will only be decrypted if the file lacks method parameter changes.
33

4-
## Reference Obfuscation
5-
The reference obfuscation transformer supports both the non-invokedynamic and invokedynamic variants of the obfuscation, but only if method parameter changes aren't enabled. Note that you must use the string encryption transformer first if the decryptor methods are in a seperate class (or just always use string encryption transformer before this).
4+
## Reference/Reflection Obfuscation
5+
The reference obfuscation transformer supports both the non-invokedynamic and invokedynamic variants of the obfuscation, but only if method parameter changes aren't enabled. Note that you must use the Zelix string encryption transformer first, or the deobfuscation will fail. Also note that you must add the libraries to path or the deobfuscation will also fail!
6+
7+
## Flow Obfuscation
8+
The flow obfuscation transformer should generally be applied after the string encryption transformer, but if a file was obfuscated with multiple layers of ZKM, you should instead use FlowObfuscationTransformer first. Also, the flow deobfuscation will be limited if the code was obfuscated with method parameter changes.
9+
10+
## Transformers to Use
11+
You should stick to using zelix.StringEncryptionTransformer as it is the fastest and decrypts the most cases. It is not recommended to combine the zelix.string transformers with zelix.StringEncryptionTransformer.

src/main/java/com/javadeobfuscator/deobfuscator/Deobfuscator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ public void start() throws Throwable {
342342
logger.info("{}: {}", rule.getClass().getSimpleName(), rule.getDescription());
343343
logger.info("\t{}", message);
344344
logger.info("Recommend transformers:");
345+
logger.info("(Choose one transformer. If there are multiple, it's recommended to try the transformer listed first)");
345346

346347
Collection<Class<? extends Transformer<?>>> recommended = rule.getRecommendTransformers();
347348
if (recommended == null) {

src/main/java/com/javadeobfuscator/deobfuscator/executor/defined/JVMMethodProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ public class JVMMethodProvider extends MethodProvider {
435435
put("getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;", (targetObject, args, context) -> MessageDigest.getInstance(args.get(0).as(String.class)));
436436
put("digest([B)[B", (targetObject, args, context) -> targetObject.as(MessageDigest.class).digest(args.get(0).as(byte[].class)));
437437
}});
438+
put("java/security/MessageDigest$Delegate", new HashMap<String, Function3<JavaValue, List<JavaValue>, Context, Object>>() {{
439+
put("digest([B)[B", (targetObject, args, context) -> ((MessageDigest)targetObject.as(Class.forName("java.security.MessageDigest$Delegate"))).digest(args.get(0).as(byte[].class)));
440+
}});
438441
put("java/net/URL", new HashMap<String, Function3<JavaValue, List<JavaValue>, Context, Object>>() {{
439442
put("toURI()Ljava/net/URI;", (targetObject, args, context) -> targetObject.as(URL.class).toURI());
440443
// Probably not an issue because you can't construct URLs yet

src/main/java/com/javadeobfuscator/deobfuscator/rules/Rules.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ public class Rules {
4040
// Stringer
4141
new RuleStringDecryptor(),
4242
new RuleStringDecryptorWithThread(),
43+
new RuleStringDecryptorV3(),
44+
new RuleHideAccess(),
4345
new RuleInvokedynamic1(),
4446
new RuleInvokedynamic2(),
45-
new RuleStringDecryptorV3(),
4647

4748
// Zelix
4849
new RuleSuspiciousClinit(),
@@ -52,6 +53,9 @@ public class Rules {
5253
new RuleMethodParameterChangeStringEncryption(),
5354

5455
// Dash-O
55-
new com.javadeobfuscator.deobfuscator.rules.dasho.RuleStringDecryptor()
56+
new com.javadeobfuscator.deobfuscator.rules.dasho.RuleStringDecryptor(),
57+
58+
// Allatori
59+
new com.javadeobfuscator.deobfuscator.rules.allatori.RuleStringDecryptor()
5660
);
5761
}

0 commit comments

Comments
 (0)