beef

BeEF是The Browser Exploitation Framework的缩写。它是一种专注于Web浏览器的渗透测试工具。

使用 apt-get install beef-xss 安装,打开 http://127.0.0.1:3000/ui/panel

配置Beef

  1. ### 指定某个网段,只有在这个网段的浏览器才能被hook
  2. permitted_hooking_subnet: "0.0.0.0/0"
  3. ### 指定某个网段,只有在这个网段的浏览器才能访问管理UI
  4. permitted_ui_subnet: "0.0.0.0/0"
  5. ### 上面这两项都是可以被绕过的,只要使用X-Forwarded-For首部绕过,一般不需要设置
  6. ### 设置beef服务器的主机, 如果有自己的域名, 那么可以设置自己的域名, 没有就使用默认
  7. host: "0.0.0.0"
  8. ### 设置beef服务器监听的端口, 可以自己定一个,比如8080, 记得端口号需要大于1024
  9. port: "3000"
  10. ### 受害浏览器轮询beef主机的时间, 默认为1秒,可以设置为更低。
  11. xhr_poll_timeout: 1000
  12. #public: "" # public hostname/IP address
  13. #public_port: "" # experimental
  14. ### 这是让BeEF运行在一个反向代理或者NAT环境下才需要设置的。
  15. ### 管理页面的URI, 默认是/ui, 建议修改,这样就不会让别人找到你的管理页面
  16. web_ui_basepath: "/ui"
  17. ### hook_file 的名称, 建议修改, 可以修改为jquery.js之类的来提升隐蔽性
  18. hook_file: "/hook.js"
  19. ### 管理页面登录的用户名和密码, 这个一定要改,两个都改是最好的
  20. credentials:
  21. user: "beef"
  22. passwd: "beef"

Metasploit自动连接postgresql

  • 启动postgresql
root@y2my:~/Desktop# service postgresql start
  • 设置用户与数据库
root@y2my:# su postgres 
postgres@y2my:$ createuser msf5 -P
Enter password for new role: 
Enter it again: 
postgres@y2my:$ createdb --owner=msf5 msf5
postgres@y2my:$ exit
exit
  • 测试数据库连接此状态
root@y2my:~/Desktop# msfconsole 
msf5 > db_connect msf5:qwe123@localhost/msf5
Connected to Postgres data service: localhost/msf5
msf5 > db_status 
[*] Connected to msf5. Connection type: postgresql. Connection name: nKjeFQbm
  • 设置自动连接
root@y2my:/usr/share# cd metasploit-framework/config/
root@y2my:/usr/share/metasploit-framework/config# cp database.yml.example database.yml
root@y2my:/usr/share/metasploit-framework/config# vi database.yml

development: &pgsql
  adapter: postgresql
  database: msf5
  username: msf5
  password: passwd
  host: localhost
  port: 5432
  pool: 200
  timeout: 5

与Metasploit联动

  • 配置文件 /usr/share/beef-xss/config.yaml
metasploit:

enable: false
# 改为
metasploit:

enable: true
  • 再启动Beef之前,再metasploit加载 msgrpc:load msgrpc ServerHost=127.0.0.1 Pass=1234 SSL=y
  • 配置文件 /usr/share/beef-xss/extensions/metasploit/config.yaml
            name: 'Metasploit'
            enable: true
            # Metasploit msgrpc connection options
            host: "127.0.0.1"
            port: 55552
            user: "msf"
            pass: "1234"
  • IP地址指定 beef.extension.metasploit.callback_host
            #为受害者连接到Metasploit 
            callback_host的公共连接回主机IP地址: “ <ATTACKER WAN IP ADDRESS> ”
  • 设置 beef.extension.metasploit.ssl 改为
            ssl: true
            ssl_version: 'TLS1'
            ssl_verify: true

https://www.freebuf.com/articles/web/175755.html

https://github.com/beefproject/beef/issues/1256