http://section9labs.github.io/Cartero/
一个功能强大的网络钓鱼框架,带有功能完整的 CLI 界面。该项目的诞生源于多年的实战需求——现有工具始终无法胜任工作。尽管市面上已有许多项目,但我们始终未能找到一个兼具易用性和可定制性的合适解决方案。
Cartero 是一个模块化项目,分为执行独立任务的命令(例如 Mailer、Cloner、Listener、AdminConsole 等)。此外,每个子命令都具有可重复的配置选项,用于配置和自动化你的工作。
例如,如果我们想要克隆 gmail.com,只需执行以下命令即可。```shell ❯❯❯ ./cartero Cloner --url https://gmail.com --path /tmp --webserver gmail_com ❯❯❯ ./cartero Listener --webserver /tmp/gmail_com -p 80 Launching mongodb Puma starting in single mode...
一旦我们有一个网站运行起来,就可以直接使用 Mailer 命令向受害者发送模板化电子邮件:```shell
❯❯❯ ./cartero Mailer --data victims.json --server gmail_com --subject "Internal Memo" --htmlbody email_html.html --attachment payload.pdf --from "John Doe <[email protected]>"
Sending [email protected]
Sending [email protected]
Sending [email protected]
加入我们的 Slack 社区:https://carteroslack.herokuapp.com/
使用 brew 2.1.5 ruby 作为默认 ruby 库```shell ❯❯❯ curl -L https://raw.githubusercontent.com/Section9Labs/Cartero/master/data/scripts/setup.sh | bash
使用 RVM 安装 Ruby 2.1.5```shell
❯❯❯ curl -L https://raw.githubusercontent.com/Section9Labs/Cartero/master/data/scripts/setup.sh | bash -s -- -r
❯❯❯ \curl -sSL https://get.rvm.io | bash -s stable --ruby
##### MongoDB
Cartero 使用 MongoDB + MongoID 库来在 Listener 和 Admin 端存储数据。
在 OSX 上:```shell
❯❯❯ brew install mongodb
在 Ubuntu / Kali / Debian 上```shell ❯❯❯ apt-get install mongodb
在 Arch Linux 上```
❯❯❯ pacman -Syu mongodb
❯❯❯ git clone https://github.com/section9labs/Cartero ❯❯❯ cd Cartero ❯❯❯ gem install bundle ❯❯❯ bundle install ❯❯❯ cd bin
### 用法
### 命令
Cartero 是一个功能非常强大且易于使用的 CLI。```shell
❯❯❯ ./cartero
Usage: cartero [options]
List of Commands:
AdminConsole, AdminWeb, Mailer, Cloner, Listener, Servers, Templates
Global options:
--proxy [HOST:PORT] Sets TCPSocket Proxy server
-c, --config [CONFIG_FILE] Provide a different cartero config file
-v, --[no-]verbose Run verbosely
-p [PORT_1,PORT_2,..,PORT_N], Global Flag fo Mailer and Webserver ports
--ports
-m, --mongodb [HOST:PORT] Global Flag fo Mailer and Webserver ports
-d, --debug Sets debug flag on/off
--editor [EDITOR] Edit Server
Common options:
-h, --help [COMMAND] Show this message
--list-commands Prints list of commands for bash completion
--version Shows cartero CLI version
这是一个简单的 MongoDB 封装器,允许我们使用相应命令在正确的 ~/.cartero 路径上启动或停止数据库。```shell ❯❯❯ ./cartero Mongo Usage: Cartero Mongo [options] -s, --start Start MongoDB -k, --stop Stop MongoDB -r, --restart Restart MongoDB -b, --bind [HOST:PORT] Set MongoDB bind_ip and port
Common options: -h, --help Show this message --list-options Show list of available options
#### Cloner
一个网站克隆器,允许我们将网站下载并转换为 Cartero WebServer 应用程序。
我们可以快速轻松地定制网站,用于收集凭据、服务端 Payload,或出于各种目的全面修改网站。```shell
❯❯❯ ./cartero Cloner
Usage: Cartero Cloner [options]
-U, --url [URL_PATH] Full Path of site to clone
-W, --webserver [SERVER_NAME] Sets WebServer name to use
-p, --path [PATH] Sets path to save webserver
-P, --payload [PAYLOAD_PATH] Sets payload path
--useragent [UA_STRING] Sets user agent for cloning
--wget Use wget to clone url
--apache Generate Apache Proxy conf
Common options:
-h, --help Show this message
--list-options Show list of available options
默认情况下,该命令使用我们的 Ruby 实现来下载并转换链接以进行渲染,但我们也支持 --wget 选项,该选项将使用本地的 wget 系统命令。
监听器负责运行通过 Cloner 创建的 WebServer 或手动创建的站点。默认情况下,如果未提供任何站点,我们会展示一个非常简单的网站。```shell ❯❯❯ ./cartero Listener Usage: Cartero Listener [options] -i, --ip [1.1.1.1] Sets IP interface, default is 0.0.0.0 -p [PORT_1,PORT_2,..,PORT_N], Sets Email Payload Ports to scan --ports -s, --ssl Run over SSL. [this also requires --sslcert and --sslkey] -C, --sslcert [CERT_PATH] Sets Email Payload Ports to scan -K, --sslkey [KEY_PATH] Sets SSL key to use for Listener. -V, --views [VIEWS_FOLDER] Sets SSL Certificate to use for Listener. -P, --public [PUBLIC_FOLDER] Sets a Sinatra public_folder -W [WEBSERVER_FOLDER], Sets the sinatra full path from cloner. --webserver --payload [PAYLOAD] Sets a payload download to serve on /download --customapp [CUSTOM_SINATRA] Sets a custom Sinatra::Base WebApp. Important, WebApp name should be camelized of filename
Common options: -h, --help Show this message --list-options Show list of available options
Web 服务器支持跨多个 IP、主机名和端口的 SSL 密钥和虚拟主机。
#### 服务器
为了发送电子邮件活动,我们需要设置电子邮件服务器,该命令允许 Cartero 创建、存储和列出服务器。所有数据都存储在 ~/.cartero 配置目录中。```shell
./cartero Servers
Usage: Cartero Servers [options]
-a, --add [NAME] Add Server
-e, --edit [NAME] Edit Server
-d, --delete [NAME] Edit Server
-l, --list List servers
Configuration options:
-T, --type [TYPE] Set the type
-U, --url [DOMAIN] Set the Mail or WebMail url/address
-M, --method [METHOD] Sets the WebMail Request Method to use [GET|POST]
--api-access [API_KEY] Sets the Linkedin API Access Key
--api-secret [API_SECRET] Sets the Linkedin API Secret Key
--oauth-token [OAUTH_TOKEN] Sets the Linkedin OAuth Token Key
--oauth-secret [OAUTH_SECRET]
Sets the Linkedin OAuth Secret Key
Common options:
-h, --help Show this message
--list-options Show list of available options
与 Servers 类似,电子邮件活动也需要一个预定义的模板来向受害者发送内容。该模块允许攻击者跟踪、创建、列出和编辑其活动中使用的模板。
注意:此处设置模板并非必需,Mailer 接受来自 CLI 的电子邮件模板直接路径。```shell ❯❯❯ ./cartero Templates Usage: Cartero Templates [options] -a, --add [NAME] Add Template -e, --edit [NAME] Edit Template -d, --delete [NAME] Edit Template -l, --list List Templates -h, --help Show this message
#### Mailer
Mailer 是 Cartero Framework 中的主要命令和组件——它允许 Cartero 向一个或多个电子邮件地址发送自定义模板电子邮件。
每封电子邮件都可以使用强大的 erb 模板引擎进行自定义,允许用户在模板中创建复杂的程序化规则,从而发送大量极具针对性的电子邮件。
有关如何构建自定义模板的更多信息,请参阅我们的 Examples。```shell
❯❯❯ ./cartero Mailer
Usage: Cartero Mailer [options]
-D, --data [DATA_FILE] File containing template data sets
-S, --server [SERVER_NAME] Sets Email server to use
-s, --subject [EMAIL_SUBJECT] Sets Email subject
-f, --from [EMAIL_FROM] Sets Email from
-r, --reply-to [EMAIL_REPLY_TO] Sets Email from
-b, --body [FILE_PATH] Sets Email Text Body
-B, --htmlbody [FILE_PATH] Sets Email HTML Body
-c, --charset [CHARSET] Sets Email charset
-C [CONTENT_TYPE], Sets Email content type
--content-type
-a [FILE_1,FILE_2,..,FILE_N], Sets Email Attachments
--attachment
-p [PORT_1,PORT_2,..,PORT_N], Sets Email Payload Ports to scan
--ports
Common options:
-h, --help Show this message
--list-options Show list of available options
该命令支持通过 Web 请求,利用已知存在漏洞或匿名的 Webmail 服务发送消息,作为 SMTP / IMAP 服务器的替代方案。```shell ❯❯❯ ./cartero WebMailer Usage: Cartero WebMailer [options] -R, --raw [RAW_REQUEST_FILE] Sets WebMail Raw Request -S, --server [SERVER_NAME] Sets WebMail server to use -U, --url [URL:PORT] Sets WebMail server url to use -H [HEADER:VAL\nHEADER:VAL], Sets WebMail Headers to use --headers -C, --cookies [COOKIES] Sets WebMail Cookies to use -D, --data [DATA_FILE] File containing template data sets -s, --subject [EMAIL_SUBJECT] Sets Email subject -f, --from [EMAIL_FROM] Sets Email from -r, --reply-to [EMAIL_REPLY_TO] Sets Email reply-to -b, --body [REQUEST_FILE_PATH] Sets Email Text request query Body -p [PORT_1,PORT_2,..,PORT_N], Sets Email Payload Ports to scan --ports
Common options: -h, --help Show this message --list-options Show list of available options
该命令可以通过两种主要方式使用。一种是使用原始命令,例如我们通过 Web 代理(即 Burp Proxy)拦截流量时获得的命令,或者使用 Cartero 上可用的 servers 命令。
#####针对 send-mail.org 的 Webmail 服务器示例```json
{
"name": "send-email",
"type": "webmail",
"options": {
"url": "http://send-email.org/send",
"method": "POST",
"cookies": "",
"headers": {
"Host": "send-email.org",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0",
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With": "XMLHttpRequest",
"Referer": "http://send-email.org/",
"Content-Length": "126",
"Connection": "keep-alive",
"Pragma": "no-cache"
}
},
"confirmation" : "Your message was sent!"
}
Using this pre-configured request, we can easily send message using the same datasets for Mailer and using the same type of templates. An example is available in /templates/mail/sample.web
#####示例命令:```shell ❯❯❯ ./cartero WebMailer -S webmail -D ~/sample.json -b ../templates/mail/sample.web -r [email protected]
#### LinkedIn
LinkedIn 命令是 Cartero 框架中首个社交网络扩展。该插件允许攻击者利用社交平台,在 LinkedIn 内直接发送消息并攻击用户。```shell
❯❯❯ ./cartero LinkedIn
Usage: Cartero LinkedIn [options]
-D, --data [DATA_FILE] File containing template data sets
-S, --server [SERVER_NAME] Sets Email server to use
-s, --subject [MESSAGE_SUBJECT] Sets LinkedIn Message subject
-b, --body [FILE_PATH] Sets LinkedIn Message Body
-l, --list [CONNECTIONS|GROUPS] List json of (connections or groups)
--send [MESSAGE|GROUP_UPDATE]
Send one or more (message/s or group/s updates)
-o, --save [FILE_PATH] Sets LinkedIn Message Body
Common options:
-h, --help Show this message
--list-options Show list of available options
该命令需要攻击者的个人资料中具备开发者 API 和 oauth 密钥。这些可以很容易地从 https://www.linkedin.com/secure/developer 获取,并且可以使用 Server 命令创建新的服务器模板。
允许 Cartero 在 OS X 上向受害者地址发送 iMessage,就像发送电子邮件一样,但这些消息会显示在他们注册到 apple 的每台 iDevice 上。
背景:在阅读了一些关于中国垃圾邮件发送者滥用 iMessage 消息会显示在与账号关联的所有设备上这一事实的新闻后,我们快速开发了一个命令,让 Cartero 用户也可以在框架中使用此功能。
重要:目前此功能仅适用于 OSX。```shell ❯❯❯ ./cartero IMessage Usage: Cartero IMessage [options] IMPORTANT: This command only works on OSX
-D, --data [DATA_FILE] File containing template data sets
-A, --attachment [ATTACHMENT] Sets iMessage file path to send
-b, --body [BODY_FILE] Sets iMessage message
-m, --message [MESSAGE] Sets iMessage message
Common options: -h, --help Show this message --list-options Show list of available options
iMessage 不允许在单条消息中同时包含文本和附件,但当同时提供两者时,消息将被拆分为两条单独的消息发送。
#####示例命令```shell
❯❯❯ ./cartero IMessage --data /Users/cartero/Desktop/test.json -b ../templates/mail/sample.imsg -a /Users/cartero/Downloads/jon.jpg
如果你有 GoogleVoice 账号,并且想要自动发送短信,这可能是一个不错的方式。它与其他所有命令采用相同的基础架构。````shell ❯❯❯ ./cartero GoogleVoice Usage: Cartero GoogleVoice [options] -D, --data [DATA_FILE] File containing template data sets -S, --server [SERVER_NAME] Sets SMS server to use -b, --body [FILE_PATH] Sets SMS Text Body -m, --message [MESSAGE] Sets SMS message -u, --username [USER] Sets Google Voice Username -p, --password [PWD] Sets Google Voice password
Common options: -h, --help Show this message --list-options Show list of available options
#### Twilio
如果你有一个 Twilio 账户,并且想要自动发送短信,这可能是另一种发送短信的方式。值得注意的是,这是一项付费服务,并且需要一个有效的访问令牌(sid)和密钥(secret_token)。更多信息请参考 Twilio 的网站:https://www.twilio.com/sms/api````shell
❯❯❯ ./cartero Twilio
Usage: Cartero Twilio [options]
-D, --data [DATA_FILE] File containing template data sets
-S, --server [SERVER_NAME] Sets SMS server to use
-f, --from [NUMBER] Sets SMS from number to use
-b, --body [FILE_PATH] Sets SMS Text Body
-m, --message [MESSAGE] Sets SMS message
-u, --sid [SID] Sets Twilio Username
-p, --token [TOKEN] Sets Twilio password
-A, --attachment [PATH_1||PATH_2||PATH_3] Sets Twilio MMS URL image paths to send
Common options:
-h, --help Show this message
--list-options Show list of available options
Admin Web 界面是一个简单的 Web 应用程序,允许攻击者检索所有 Campaign 的信息。```shell ❯❯❯ ./cartero AdminConsole Usage: Cartero AdminConsole [options] -i, --ip [1.1.1.1] Sets IP interface, default is 0.0.0.0 -p [PORT_1,PORT_2,..,PORT_N], Sets Email Payload Ports to scan --ports -s, --ssl Run over SSL. [this also requires --sslcert and --sslkey] -C, --sslcert [CERT_PATH] Sets Email Payload Ports to scan -K, --sslkey [KEY_PATH] Sets Email Payload Ports to scan
Common options: -h, --help Show this message --list-options Show list of available options
#### AdminConsole
管理控制台是一个 CLI 工具,允许列出关于人员、活动、点击和已收集凭据的信息。```shell
❯❯❯ ./cartero AdminConsole
Usage: Cartero AdminConsole [options]
-p, --persons [LATEST_N] Display the list of persons that responded
-i, --hits [LATEST_N] Display the list of hits
-c, --creds [LATEST_N] Display the list of Credentials
-a, --all Sets Email Payload Ports to scan
-f, --filter flag to search by parameters
--email [EMAIL] Display the list of hits
--campaign [CAMPAIGN] Display the list of hits
--ip [IP_ADDRESS] Display the list of hits
Common options:
-h, --help Show this message
--list-options Show list of available options
命令框架相当简单。示例框架命令存储在 Cartero/lib/cartero/commands/*.rb 和 ~/.cartero/commands/*.rb 中。```ruby module Cartero module Commands class CommandName < ::Cartero::Command
description( name: "Long Command Name Here", description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", author: ["Author Name <noname [©] cartero.com>"], type:"General", license: "LGPL", references: [ "https://section9labs.github.io/Cartero", "https://section9labs.github.io/Cartero" ] )
def initialize super do |opts| #OptionsParser options available here. opts.on("-x", "--xoption [DATA_FILE]", String, "Description of command option") do |data| @options.xoption = data end opts.on("-y", "--yoption [DATA_FILE]", String, "Description of command option") do |data| @options.xoption = data end # help() option already provided. # --list-options for auto-complete automatic. end end
def setup # This will be hooked and run before run(). # It is meant as a method so the commands can run everything before that. end
def run # Everything that will run. end
def after # This is the place to run clean-up code. end end end end
### 邮件模板
电子邮件是简单的 txt 文件或有限的 HTML 文件,具体取决于所使用的格式。Cartero 通过 erb Ruby 库以及一个 CLI 接口支持复杂模板,帮助构建和模板化这两种格式。
通过 erb 可对文件针对活动进行广泛定制,erb 在运行时提供动态替换和程序化决策。
另一个重要特性是加密的 `self[:payload]`,它应被添加到每个邮件模板中,使 Cartero 能够识别来源实体,无论经过多少次转发或点击。这一小型载荷使用随机生成的密钥加密,使攻击者能够保持其来源数据安全且不易被检测。
**示例数据文件**```json
[{
"email": "[email protected]",
"name": "John Doe"
}, {
"email": "[email protected]",
"name": "Gas Hill"
}, {
"email": "[email protected]",
"name": "John Doe 2"
}, {
"email": "[email protected]",
"name": "Jane Doe - Hotmail",
"subject": "Hotmail Test 123"
}]
HTML 示例模板```html
This is an automated email to your email <%= self[:email] %>.
<% if self[:ports] %> <% self[:ports].each do |port| %> /image?key=<%= self[:payload] %>"> <% end %> <% end %>
**文本示例模板**```txt
Hola <%= self[:name] %>,
This email needs to be displayed as HTML.
This is an automated email to your email<%= self[:email] %>.
In addition, this email can also be displayed securely
on http://192.168.1.216:8080/click?key=<%= self[:payload] %>
cheers,
<%= self[:from_name] %>
可以使用 Servers 命令来管理服务器,该命令提供了添加、编辑和删除服务器的功能。 注意:可以在 ~/.cartero/servers/*.json 中手动编辑服务器。
####smtp```json { "name": "gmail", "type": "smtp", "options": { "address": "smtp.yourserver.com", "port": 25, "user_name": "user", "password": "password", "authentication": "plain", "domain": "localhost.localdomain" } }
####linkedin```json
{
"name": "linkedin",
"type": "linkedin",
"options": {
"api_access": "api_access",
"api_secret": "api_secret",
"oauth_token": "oauth_token",
"oauth_secret": "oauth_secret"
}
}
####网页邮箱```json { "name": "webmail-sample", "type": "webmail", "options": { "url": "http://www.send-email.com/data/send/email", "method": "POST", "cookies": "sdajsda09s7das923i3j2l131;21381903810", "headers": { "x-forward": "asdadadasad" } }, "confirmation" : null }
.
### 更新日志
- [更新日志](https://github.com/mrbrutti/cartero/blob/HEAD/CHANGELOG.md)
### 待办事项
- [待办事项](https://github.com/mrbrutti/cartero/blob/HEAD/TODO.md)