How to deobfuscate but make sure metadata tokens stay the same?

--preserve-tokens will preserve all important metadata tokens, the #US and #Blob heaps, and keep junk data in signatures.

--keep-types should normally also be used. If used, no obfuscator types or methods will be removed.

Most of the time you don't need to preserve the method parameters' metadata tokens. You can use--preserve-table all,-pd which will preserve all important tokens except the parameter tokens.

--dont-rename or --keep-names can also sometimes be necessary. For example, if you're deobfuscating Confuser obfuscated assemblies, then --keep-names d will rename everything except fields in delegate types.

If the file has been obfuscated by an unsupported obfuscator, then all tokens are preserved by default.

Examples:

Preserve all important tokens, #US heap, #Blob heap, junk sig data, and don't remove any obfuscator types/methods:

de4dot --preserve-tokens --keep-types file.dll

Preserve all tokens except parameter tokens, and don't rename fields in delegate types:

de4dot --keep-names d --preserve-table all,-pd file.dll

An assembly has been obfuscated by two or more supported obfuscators. How do I deobfuscate the assembly?

If two or more obfuscators are detected, de4dot will print that and a description on how to force detection of one of them.

You need to figure out in which order the obfuscators were used and deobfuscate it in reverse order. You should also use --preserve-tokens to preserve metadata tokens in case the next obfuscator uses hard coded metadata tokens to decrypt eg. strings.

The -p XX option can be used to force detection of an obfuscator, where XX is the type of the obfuscator. de4dot -h will show all types.

Assume filename.dll has been obfuscated by sa followed by ef, then you should use these commands:

de4dot --preserve-tokens --dont-rename filename.dll -p ef -o tmp.dll
de4dot tmp.dll -p sa -o cleaned-file.dll
del tmp.dll

The output will be in cleaned-file.dll.

How do I decrypt strings in an assembly obfuscated by an unsupported obfuscator?

First you must figure out the metadata token of the string decrypter. You can use Simple Assembly Explorer (SAE). Locate the string decrypter and hover the mouse over the method name and you should see something like 06001234. That's the method's metadata token. The following command will dynamically decrypt the strings:

de4dot filename.dll --strtyp delegate --strtok 06001234

If it has more than one string decrypter, just append more --strtok 06xxxxxx like so:

de4dot filename.dll --strtyp delegate --strtok 06001234 --strtok 06001235 --strtok 06001236

--strtyp delegate will create a dynamic method and simply call the string decrypter and let it decrypt the string for us. --strtype emulate needs to be used if the string decrypter detects dynamic methods. If you suspect the assembly to be malware, you should only do this in a sandbox since unknown code is executed.

What could be the reason for an assembly to crash if it's been renamed?

If it's a supported obfuscator, renaming should always work, except in a few cases.

It could happen when a resource isn't renamed when the class that uses it has been renamed.

It could also happen if you deobfuscate an assembly, A.dll, but there's another assembly, B.dll, that has a reference to A, and that reference has been renamed in A.dll but not in B.dll. In this case, you must deobfuscate both A.dll and B.dll to make sure all references to A.dll in B.dll also are renamed.

de4dot A.dll B.dll

After deobfuscating a .NET Reactor obfuscated assembly, I see methods with only a throw (uint)-559038242 statement.

That throw is actually throw 0xDEADCODE. Those methods are encrypted native (x86 code) methods and the throw won't execute at run time. The method body will be replaced with the real method at run time by the obfuscator's methods decryptor. You'll know when there are native methods left in the image if you see something like this after deobfuscation:

Re-encrypted 10/73 native methods

In this example, there are 10 methods left that are still native methods. The remaining 63 methods were converted back to CIL code or deleted from the image. A future version of de4dot may convert the remaining native methods back to CIL code.

de4dot FAQ的更多相关文章

  1. Google软件构建工具Bazel FAQ

    Google软件构建工具Bazel FAQ 本文是我的翻译,原文在这里.欢迎转载,转载请注名本文作者和原始链接 注:如果想了解Bazel的原理,可以看看我之前翻译的Google Blaze原理及使用方 ...

  2. 领域驱动设计常见问题FAQ

    本文出处:http://www.cqrs.nu/Faq What is a domain? The field for which a system is built. Airport managem ...

  3. CQRS FAQ (翻译)

    我从接触ddd到学习cqrs有6年多了, 其中也遇到了不少疑问, 也向很多的前辈牛人请教得到了很多宝贵的意见和建议. 偶尔的机会看到国外有个站点专门罗列了ddd, cqrs和事件溯源的常见问题. 其中 ...

  4. (译)关于async与await的FAQ

    传送门:异步编程系列目录…… 环境:VS2012(尽管System.Threading.Tasks在.net4.0就引入,在.net4.5中为其增加了更丰富的API及性能提升,另外关键字”async” ...

  5. De4Dot+Reflector 支持多种反混淆

    官网: http://www.de4dot.com/ 源码:https://github.com/brianhama/de4dot 使用方法 通过CMD命令方式进入: F:\2\de4dot-v3-1 ...

  6. Async/Await FAQ

    From time to time, I receive questions from developers which highlight either a need for more inform ...

  7. Unity3D热更新全书FAQ

    只要有程序员朋友们问过两次的问题 就会收录在此FAQ中 1.C#Light对比LUA有什么好处 C#Light是静态类型脚本语言,语法同C#,Lua是动态类型脚本语言,这两种都有人喜欢. 我更喜欢静态 ...

  8. discuz /faq.php SQL Injection Vul

    catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 . 通过获取管理员密码 . 对管理员密码进行破解.通过在cmd5.com ...

  9. Part 2: Oracle E-Business Suite on Cloud FAQ

    Running Oracle E-Business Suite on Oracle Cloud is simple, but it doesn't take too much effort to co ...

随机推荐

  1. 线性表——顺序表的实现与讲解(C++描述)

    线性表 引言 新生安排体检,为了 便管理与统一数据,学校特地规定了排队的方式,即按照学号排队,谁在前谁在后,这都是规定好的,所以谁在谁不在,都是非常方便统计的,同学们就像被一条线(学号)联系起来了,这 ...

  2. MySQL(一)面试集合

    1. 什么是索引? 索引是一种数据结构(存储数据),可以帮助我们快速的进行数据的查找. 索引是帮助高效获取数据的数据结构,索引是一个文件   1)索引有哪些类型:          hash 二叉树 ...

  3. Python yield 使用浅析【转】

    Python yield 使用浅析 IBM developerWorks 中国 : Open source IBM 开源 - IBM Developer 中国 (原 developerWorks 中国 ...

  4. gopacket 在 windows 上面遇到的问题

    前阵子有个需求是使用 golang 抓包改包,我用到了 gopacket 这个包,但是出了一些小问题. 我按照网上的方法进行使用 OpenLive 抓包,发现并不行,报错 error open ada ...

  5. 手工给程序插入 ShellCode

    PE格式是 Windows下最常用的可执行文件格式,理解PE文件格式不仅可以了解操作系统的加载流程,还可以更好的理解操作系统对进程和内存相关的管理知识,而有些技术必须建立在了解PE文件格式的基础上,如 ...

  6. 如何使用Cloud Foundry CLI把一个应用推送到MindSphere

    一.登录MindSphere - Cloud Foundry 1. 安装Cloud Foundry CLI (Command Line Interface). 下载地址:https://github. ...

  7. hdu 2822 ~!!!!!!坑死我

    首先 在此哀悼...  为我逝去的时间哀悼...  每一步都确定再去写下一步吧...日狗 不过还是有点收获的..  对优先队列的使用 有了进一步的理解 先上代码 #include<iostrea ...

  8. sql语句中包含引号处理方法

    1. 背景 在使用Python脚本向数据库导入日志文件时候,突然报错. 2. 解决思路 查看messages文件,发现有一条语句里包含单引号. 查看sql语句,是使用单引号标注str类型. 3. 得出 ...

  9. django pk 和id用法

    pk就是primary key的缩写,也就是任何model中都有的主键,那么id呢,大部分时候也是model的主键,所以在这个时候我们可以认为pk和id是完全一样的. class Student(mo ...

  10. 【转载】Sqlserver使用SUBSTRING函数截取字符串

    在SQL语句查询过程中,Sqlserver支持使用LEFT().RIGHT().SUBSTRING()等几个函数对字符串进行截取操作,SubString函数相对于其他两个函数来说更灵活,使用场景更多, ...