PE代码段中的数据

PE代码段中可能包含一些数据,比如

optional header中的data directory会索引到一些数据,比如import/export table等等;

还有一些jump table/switch table等等。

 

一般来说,direct/indirect call/branch的目标,可能是代码,也可能是数据,比如:

mov eax, offset_func
call eax

以及

mov eax, offset_shellcode
xor [eax + N]
call eax

但是第二种,属于对代码段做修改之后,再调用的情况很可能是Malicious,而也不能够被“W异或X”机制所允许。

但是仅仅是读,或者以其为源,拷贝到可写数据区再进行修改还是有可能的。

 

可能通过监控对于代码段中的内容的读和写(写可能不会发生)进行监控,并且跟踪其数据流,就像是Taint分析一样。

 

在Pin中,与内存读写有关的参数

IARG_MEMORYREAD_EA      
Type: ADDRINT. Effective address of a memory read, only valid if INS_IsMemoryRead is true and at IPOINT_BEFORE.
 
IARG_MEMORYREAD2_EA      
Type: ADDRINT. Effective address of a 2nd memory read (e.g. 2nd operand in cmps on ia32), only valid at IPOINT_BEFORE.
 
IARG_MEMORYWRITE_EA     
 Type: ADDRINT. Effective address of a memory write, only valid at IPOINT_BEFORE.
 
IARG_MEMORYREAD_SIZE      
Type: UINT32. Size in bytes of memory read.
 
IARG_MEMORYWRITE_SIZE      
Type: UINT32. Size in bytes of memory write.

但是在真正跑时,出现了以下的exception:

IARG_MEMORY*_EA is only valid at IPOINT_BEFORE

因此,想要得到Write事后的地址,需要在程序中自己存储,参考pin sample pinatrace.

 

BOOL LEVEL_CORE::INS_OperandIsAddressGenerator    (     INS     ins,
UINT32     n
)     
     
Returns:
true if this operand generates an address, but the address does not access memory (e.g. load effective address instruction)

转载于:https://www.cnblogs.com/long123king/p/3716125.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值