MOV混淆

这次来了解一下movfuscator混淆#### 在mov指令的图灵完备性被证明之后,就产生了一种使用mov指令代替其他各种指令的混淆机制,运算,跳转,函数调用都可以全部使用mov指令实现

#mov混淆器的下载
git clone https://github.com/xoreaxeaxeax/movfuscator
cd movfuscator
./build.sh
sudo ./install.sh
!!!这里少了一个指令
apt-get install libc6-dev-i386
否则会报错
#这里对下程序进行mov混淆
#include <stdio.h>
#include <string.h>
int main(int argc,char*argv[])
{
        char s[10] = {0};
        int i=0;
        scanf("%9s",s);
        for(i=0;i<strlen(s);i++)
        {
                s[i] = (s[i] + 1);
        }
        printf("%s\n",s);
        return 0;
}
#gcc test.c -o test1
#movcc test.c -o test2
#下图是混淆前和混淆后的对比

 

 

有混淆就有解混淆

首先需要三个依赖库
1.libcapstone
sudo git clone https://github.com/aquynh/capstone.git
cd capstone/
make
sudo make install
​
2.libz3
sudo git clone https://github.com/Z3Prover/z3.git
cd z3
python scripts/mk_make.py
cd build
make
sudo make install
​
3.libkeystone
sudo git clone https://github.com/keystone-engine/keystone.git
cd keystone/
sudo mkdir build
cd build/
sudo ../make-share.sh 
sudo make install
sudo ldconfig
​
最后
git clone https://github.com/kirschju/demovfuscator.git
make
当然你make之后会报一个致命错误,使用下面一个指令就可以了
sudo apt-get install libssl-dev
​
使用指令在demovfuscator里面的
./demov [input] -o [output]
​
不过作用嘛,微乎其微

1.AlexCTF 2017的re

首先脱壳,使用upx指令

拖入ida发现程序经过mov混淆,全局搜索相关字符

跟进去上下翻动
发现R2很可疑,程序一直给R2传入字符也把’}‘给了它,搜索mov R2
直接在IDA中搜索字节序列:字符串C7 05 68 20 06 (“mov R2” 对应字节码)
alt+b

找到flag

2.SusCTF 2018 MoVfuscationl

运行程序,测试发现它会将正确字符打印出来,因此可以采用逐位爆破的方法

 

import subprocess
import string
import sys
#和你的文件名一致
binary = "354e846facdf6f3d3205a1465d2fd811"

length = 0
result = ""
while 1:
    for i in string.printable:
        p = subprocess.Popen("./%s" % binary, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
        p.stdin.write("1\n")
        p.stdin.write(result+i+"\n")
        output = p.stdout.readlines()[-1]
        if "Congraz~" in output:
            result += "}"
            print result
            sys.exit(0)
        if len(output)-8 > length:
            length += 1
            result += i
            print output
            break

运行文件

 

3.ekoparty-pre-ctf-2015 mov

和第一个一样 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值