菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
39
0

Go语言程序调试

原创
05/13 14:22
阅读数 38459

1. Go语言二进制程序分析
   在分析一些使用GOlang语言进行编译的恶意程序时,由于程序在被打包成二进制程序时会打包诸多引用的库,并且作者对二进制程序进行了去符号化,导致在动态或是静态分析时函数过多而不便于跟踪。
   而如果GO编译成的二进制程序并未进行去符号化,那么在IDA中进行分析时,几乎可以相当于看源码了。所以只要将去符号的程序进行符号恢复,那么之后调试时就十分方便了。
   可以使用Github上的ida py脚本IDAGolangHelper,关于Go程序恢复符号的资料:[https://2016.zeronights.\ru/wp-content/uploads/2016/12/GO_Zaytsev.pdf](https://2016.zeronights. ru/wp-content/uploads/2016/12/GO_Zaytsev.pdf),主要就是为了确认Go语言程序特有的.gopclntab段位置,中文可以参考以下https://www.freebuf.com/articles/others-articles/176803.html

   另外还可以使用Redress对程序包结构进行分析。

2. 加密函数

EnryptOAEP/DecryptOAEP

// EncryptOAEP encrypts the given message with RSA-OAEP.
//
// OAEP is parameterised by a hash function that is used as a random oracle.
// Encryption and decryption of a given message must use the same hash function
// and sha256.New() is a reasonable choice.
//
// The random parameter is used as a source of entropy to ensure that
// encrypting the same message twice doesn't result in the same ciphertext.
//
// The label parameter may contain arbitrary data that will not be encrypted,
// but which gives important context to the message. For example, if a given
// public key is used to decrypt two types of messages then distinct label
// values could be used to ensure that a ciphertext for one purpose cannot be
// used for another by an attacker. If not required it can be empty.
//
// The message must be no longer than the length of the public modulus minus
// twice the hash length, minus a further 2.

EncryptOAEP(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte)
  查看相关源码后,可以知道散列函数hash被用于计算label的hash值;random参数产生hash.size()个强随机数作为seed;计算seed的hash值与包括明文和label的hash值在内的数据进行异或,从而防止旁路攻击。最终使用公钥加密包括seed、hash(label)、明文在内的数据,作为密文。

  加密的消息必须不大于(公钥长度 - 2*hash.size() - 2)。

发表评论

0/200
39 点赞
0 评论
收藏