原文:https://blog.fabiopires.pt/running-your-instance-of-burp-collaborator-server/

在本文中,我们将为读者介绍如何搭建自己的Burp Collaborator服务器。读者也许会问,难道它们没有提供官方指南吗?哈哈,但凡亲自动过手的读者就会知道,如果以它为指导的话,安装过程还是会遇到许多麻烦,所以我决定将自己的搭建过程详细记录下来,希望对读者有所帮助。

Burp Collaborator简介


在本文中,我们将为读者详细介绍如何在VPS上配置Burp Collaborator服务器,并且让它支持通配符型SSL证书。同时,我们还会介绍如何配置DNS服务器,这样,我们就可以使用自定义子域了。

Burp Collaborator是一种外部服务,在使用Burp时,可以借助该服务来发掘各种安全漏洞。例如:

准备工作


搭建环境


搭建VPS


好的,让我们首先安装java,最简单的方法就是直接使用Debian系统打包的版本。具体来说,我们需要安装OpenJDK 8,因为这是最新的推荐版本。

首先,需要通过下列命令来更新包索引。

sudo apt-get update

接下来,安装Java。准确地说,是安装Java运行时环境(JRE)。

sudo apt-get install default-jre

然后,安装iptables-persistent。

sudo apt-get install iptables-persistent

安装好上述软件后,接下来需要创建一个工作目录,并将burpsuitepro<latest_version>.jar 上传到该目录中。</latest_version>

sudo mkdir -p /usr/local/collaborator/

从现在开始,我们假定您已经将burpsuitepro<latest_version>.jar上传至/usr/local/collaborator/。实际上,即使没有Burp许可证,读者也照样可以运行Burp Collaborator。</latest_version>

接下来,创建一个系统用户来运行该服务器。注意,一定要对该用户的权限加以限制,以防止它以root身份运行Collaborator服务器:

sudo adduser --shell /bin/nologin --no-create-home --system collaborator

将/usr/local/collaborator的属主改为collaborator:

sudo chown collaborator /usr/local/collaborator

配置Collaborator服务器


在继续下面的操作之前,请先在系统上运行ifconfig命令,以获取服务器的IP地址:

root@collaborator:/usr/local/collaborator# ifconfig
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 54.38.**.**  netmask 255.255.255.255  broadcast 54.38.**.**
        ether aa:bb:cc:dd:ee:ff  txqueuelen 1000  (Ethernet)
        RX packets 1751433  bytes 1655333949 (1.5 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1266913  bytes 1302210556 (1.2 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

创建配置文件nano /usr/local/collaborator/collaborator.config,该文件的内容如下所示(注意编辑突出显示的部分):

{
  "serverDomain" : "my-subdomain-for-burp.example.com", # edit here
  "workerThreads" : 10,
  "eventCapture": {
      "localAddress" : [ "54.38.**.**" ], # and here
      "publicAddress" : "54.38.**.**", # and here (yeah, same ip..)
      "http": {
         "ports" : 3380
       },
      "https": {
          "ports" : 33443
      },
      "smtp": {
          "ports" : [3325, 33587]
      },
      "smtps": {
          "ports" : 33465
      },
      "ssl": {
          "certificateFiles" : [
              "/usr/local/collaborator/keys/privkey.pem",
              "/usr/local/collaborator/keys/cert.pem",
              "/usr/local/collaborator/keys/fullchain.pem" ]
      }
  },
  "polling" : {
      "localAddress" :  "54.38.**.**", # and here
      "publicAddress" :  "54.38.**.**", # and here
      "http": {
          "port" : 39090
      },
      "https": {
          "port" : 39443
      },
      "ssl": {
          "certificateFiles" : [
              "/usr/local/collaborator/keys/privkey.pem",
              "/usr/local/collaborator/keys/cert.pem",
              "/usr/local/collaborator/keys/fullchain.pem" ]

      }
  },
  "metrics": {
      "path" : "jnaicmez8",
      "addressWhitelist" : ["0.0.0.0/1"]
  },
  "dns": {
      "interfaces" : [{
          "name":"ns1.my-subdomain-for-burp.example.com", # and here
          "localAddress":"54.38.**.**", # and here
          "publicAddress":"54.38.**.**" # and here
      }],
      "ports" : 3353
   },
   "logLevel" : "INFO"
}

注意:这里要求所有端口号都必须高于1024,只有这样,Burp Collaborator才能在没有root权限的情况下绑定它们。稍后,我们将利用iptables命令来解决这个问题。

设置通配符型SSL证书


自2018年3月起,Let's Encrypt就宣布支持免费的通配符型SSL证书。为了安装最新版本的Let's Encrypt,请执行以下命令:

cd /usr/local/collaborator/
wget https://dl.eff.org/certbot-auto
chmod a+x ./certbot-auto

现在,让我们来创建一个bash脚本,让它帮我们完成将证书移动到正确位置并安排权限的工作:

sudo nano /usr/local/collaborator/configure_certs.sh

然后编辑其内容,具体如下所示:

#!/bin/bash

CERTBOT_DOMAIN=$1
if [ -z $1 ];
then
    echo "Missing mandatory argument. "
    echo " - Usage: $0  <domain> "
    exit 1
fi
CERT_PATH=/etc/letsencrypt/live/$CERTBOT_DOMAIN/
mkdir -p /usr/local/collaborator/keys/

if [[ -f $CERT_PATH/privkey.pem && -f $CERT_PATH/fullchain.pem && -f $CERT_PATH/cert.pem ]]; then
        cp $CERT_PATH/privkey.pem /usr/local/collaborator/keys/
        cp $CERT_PATH/fullchain.pem /usr/local/collaborator/keys/
        cp $CERT_PATH/cert.pem /usr/local/collaborator/keys/
        chown -R collaborator /usr/local/collaborator/keys
        echo "Certificates installed successfully"
else
        echo "Unable to find certificates in $CERT_PATH"
fi

获取证书


下一步是创建SSL证书,具体命令如下所示:

./certbot-auto certonly -d my-subdomain-for-burp.example.com -d *.my-subdomain-for-burp.example.com  --server https://acme-v02.api.letsencrypt.org/directory --manual --agree-tos --no-eff-email --manual-public-ip-logging-ok --preferred-challenges dns-01

然后按照命令的提示进行操作(它会要求您提供自己的电子邮件)。

之后,我们将看到第一条消息,该消息是关于如何重播DNS TXT记录的。按Enter键,这时会看到第二条消息:

-------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name
_acme-challenge.my-subdomain-for-burp.example.com with the following value:

YKoOF0jc6wqZJLUIhF3YQJ8MzyWWfkT3weW24_8hhBU

Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue (Press enter here, we are expecting two different TXT records)

-------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name
_acme-challenge.my-subdomain-for-burp.example.com with the following value:

s10-sRD0KPJfFujYl5_ql6TEQkwkVppLZLW45ITK-d4

Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue

既然要设置两个TXT记录,所以请转至DNS服务器的/cloudflare,并配置两个记录(使用相同的名称:“_acme-challenge.my-subdomain-for-burp”)。

将DNS域委托给VPS

现在,按Enter键,这时将看到下列内容:

Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   ...

好了,证书已经到手了。下面我们来安装证书,命令如下所示:

chmod +x /usr/local/collaborator/configure_certs.sh && /usr/local/collaborator/configure_certs.sh my-subdomain-for-burp.example.com

下面,我们来看看安装是否正确无误:

sudo -H -u collaborator bash -c  "java -Xms10m -Xmx200m -XX:GCTimeRatio=19 -jar /usr/local/collaborator/burpsuite_pro_1.7.33.jar --collaborator-server --collaborator-config=/usr/local/collaborator/collaborator.config"
2018-04-08 19:46:36.082 : Using configuration file /usr/local/collaborator/collaborator.config
2018-04-08 19:46:37.473 : Listening for DNS on 54.38.**.**:3353
2018-04-08 19:46:37.486 : Listening for HTTP on 54.38.**.**:39090
2018-04-08 19:46:37.486 : Listening for SMTP on 54.38.**.**:3325
2018-04-08 19:46:37.487 : Listening for HTTP on 54.38.**.**:3380
2018-04-08 19:46:37.486 : Listening for SMTP on 54.38.**.**:33587
2018-04-08 19:46:37.600 : Listening for SMTPS on 54.38.**.**:33465
2018-04-08 19:46:37.600 : Listening for HTTPS on 54.38.**.**:39443
2018-04-08 19:46:37.602 : Listening for HTTPS on 54.38.**.**:33443

看到类似上面的内容,说明一切正常,这样就可以开始下一步了! 为此,只需按CTRL-C就可以了。

配置DNS


转到DNS服务器/cloudflare,并新建两个记录。

    • NS记录,指向ns1.my-subdomain-for-burp.example.com
    • A纪录,指向54.38。

将DNS域委托给VPS

安装iptables


在配置Burp Collaborator时,还记得当时说过要求端口号必须高于1024吗?很好,现在需要将默认端口转发到我们配置的端口上。

为了完成上述转发工作,可以使用如下所示的命令。

iptables -t nat -A PREROUTING -i ens3 -p udp --dport 53 -j REDIRECT --to-port 3353
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 9090 -j REDIRECT --to-port 39090
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 25 -j REDIRECT --to-port 3325
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 80 -j REDIRECT --to-port 3380
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 587 -j REDIRECT --to-port 33587
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 465 -j REDIRECT --to-port 33465
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 9443 -j REDIRECT --to-port 39443
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 443 -j REDIRECT --to-port 33443
iptables-save

将Collaborator服务器设置为服务


为了在VPS重启或该服务当机时自动启动Collaborator服务器,我们需要创建一个新服务。

为此,需要创建一个名为collaborator.service的文件。

sudo nano /etc/systemd/system/collaborator.service

然后,将下面的内容复制到上面的文件中:

[Unit]
Description=Burp Collaborator Server Daemon
After=network.target

[Service]
Type=simple
User=collaborator
UMask=007
ExecStart=/usr/bin/java -Xms10m -Xmx200m -XX:GCTimeRatio=19 -jar /usr/local/collaborator/burpsuite_pro_1.7.33.jar --collaborator-server --collaborator-config=/usr/local/collaborator/collaborator.config
Restart=on-failure

# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target

启用该服务:

systemctl enable collaborator

最后,运行该服务:

systemctl start collaborator

配置 Burp Suite


启动Burp Suite,打开“Project Options” > “Misc” 选项卡,然后配置如下内容:

配置Burp Suite

本文到此结束,希望对读者能够有所帮助!

源链接

Hacking more

...