碳基体

奋斗在产品安全第一线的安全妹子

Go版heartbleeder PoC ——Ubuntu/Debian上搭建Go运行环境

说起为啥要安装Go环境,完全是因为想运行Heartbleed  Bug(CVE-2014-0160)Go版本的PoC heartbleeder.go (估计大家都使用的python版本的PoC ssltest.py, perl版本的PoC hb_honeypot.pl 附上在线检测站点https://filippo.io/Heartbleed/,https://possible.lv/tools/hb/ )

作为工具党,熟悉各种工具的编译运行方式是最基础的了,而渗透工具一般都需要了解c,perl,python,ruby,go的运行方式。好了,进入正题。我们搭建好go运行环境,并演示在这个环境中运行heartbleeder.go


一、Go环境搭建

第一步:安装c语言工具

apt-get install bison ed gawk gcc libc6-dev make


第二步:安装Mercurial版本管理系统(后续使用其获取/更新Go源码)

apt-get install python-setuptools python-dev build-essential


easy_install mercurial


第三步:获取源码

hg clone -r release https://go.googlecode.com/hg/ go或更新到最新版本

cd go/src

hg pull

hg update release

./all.bash


第四步:编译

cd go/src

./all.bash


第五步:设置环境变量

vim ~/.bashrc

增加

#Go 二进制文件存放地址

export GOBIN=/root/go/pkg/tool/linux_386
export PATH=$GOBIN:$PATH
#Go 安装包源码路经

export GOROOT=/root/go
export GOPATH=/root/goTool

#操作系统和CPU类型,可以使用uname -a查看
export GOOS=linux
export GOARCH=386

source ~/.bashrc


第六步:检查是否安装成功

vim hello.go

package main
import "fmt"

func main(){
   fmt.Println("hello, Go ! ")
}

运行

-bash-4.2# go run hello.go
hello, Go ! 



二、Heartbleeder使用


cd goTool/

go get github.com/titanous/heartbleeder #获取PoC源码

经过上一步操作:

PoC的二进制文件放置在了$GOBIN/heartbleeder下,/root/go/pkg/tool/linux_386/heartbleeder

PoC的源码放置在了$GOPATH/src下,/root/goTool/src/github.com/titanous/heartbleeder


我们运行尝试一下

-bash-4.2# heartbleeder www.xxx.com
INSECURE - www.xxx.com:443 has the heartbeat extension enabled and is vulnerable

或者

-bash-4.2# go run heartbleeder.go www.xxx.com
INSECURE - www.xxx.com:443 has the heartbeat extension enabled and is vulnerable



来源:碳基体

评论