CAN Flood - Metasploit
This page contains detailed information about how to use the post/hardware/automotive/can_flood metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: CAN Flood
Module: post/hardware/automotive/can_flood
Source code: modules/post/hardware/automotive/can_flood.rb
Disclosure date: -
Last modification time: 2019-04-01 12:04:31 +0000
Supported architecture(s): -
Supported platform(s): Hardware
Target service / protocol: -
Target network port(s): -
List of CVEs: -
This module floods a CAN interface with supplied frames.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
There are two ways to execute this post module.
From the Meterpreter prompt
The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:
meterpreter > run post/hardware/automotive/can_flood
From the msf prompt
The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.
msf > use post/hardware/automotive/can_flood
msf post(can_flood) > show options
... show and set options ...
msf post(can_flood) > set SESSION session-id
msf post(can_flood) > exploit
If you wish to run the post against all sessions from framework, here is how:
1 - Create the following resource script:
framework.sessions.each_pair do |sid, session|
run_single("use post/hardware/automotive/can_flood")
run_single("set SESSION #{sid}")
run_single("run")
end
2 - At the msf prompt, execute the above resource script:
msf > resource path-to-resource-script
Required Options
SESSION: The session to run this module on.
CANBUS: CAN interface
Knowledge Base
Introduction
CAN Flood is a post-exploitation module that floods a CAN interface for a number of rounds. Both the interface and the number of rounds are to be provided as inputs. An example list of frames also is part of the inputs, and sources the flooding at each round. The module therefore is general as it is parametric in the frame list.
Verification Steps
First, start up a virtual CAN bus:
sudo modprobe can
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
Then do the thing:
- Start
msfconsole
use auxiliary/server/local_hwbridge
set uripath trycanbus
run
use auxiliary/client/hwbridge/connect
set targeturi trycanbus
run
use post/hardware/automotive/can_flood
set canbus vcan0
set session 1
run
Options
CANBUS Determines which CAN interface to use.
FRAMELIST Path of the file that contains the list of frames. Default is "/usr/share/metasploit-framework/data/wordlists/can_flood_frames.txt".
ROUNDS Number of executed rounds. Default is 200.
SESSION The session to run this module on.
Scenarios
The user must know a list of frames that generate an effect on the car. This is because the module is general as it is parametric in the frame list. You can test the module by setting a virtual CAN interface and then execute the commands, thus obtaining the underlying output:
msf5 > use auxiliary/server/local_hwbridge
msf5 auxiliary(server/local_hwbridge) > run
[*] Auxiliary module running as background job 0.
[*] Using URL: http://0.0.0.0:8080/trycanbus
[*] Local IP: http://10.0.2.15:8080/trycanbus
[*] Server started.
msf5 auxiliary(server/local_hwbridge) > use auxiliary/client/hwbridge/connect
msf5 auxiliary(client/hwbridge/connect) > set targeturi trycanbus
targeturi => trycanbus
msf5 auxiliary(client/hwbridge/connect) > run
[*] Attempting to connect to 127.0.0.1...
[*] Hardware bridge interface session 1 opened (127.0.0.1 -> 127.0.0.1) at 2019-03-20 03:17:55 -0400
[+] HWBridge session established
[*] HW Specialty: {"automotive"=>true} Capabilities: {"can"=>true, "custom_methods"=>true}
[!] NOTICE: You are about to leave the matrix. All actions performed on this hardware bridge
[!] could have real world consequences. Use this module in a controlled testing
[!] environment and with equipment you are authorized to perform testing on.
[*] Auxiliary module execution completed
msf5 auxiliary(client/hwbridge/connect) > use post/hardware/automotive/can_flood
msf5 post(hardware/automotive/can_flood) > set canbus vcan0
canbus => vcan0
msf5 post(hardware/automotive/can_flood) > set session 1
session => 1
msf5 post(hardware/automotive/can_flood) > run
[*] -- FLOODING --
[*] Post module execution completed
Go back to menu.
Msfconsole Usage
Here is how the hardware/automotive/can_flood post exploitation module looks in the msfconsole:
msf6 > use post/hardware/automotive/can_flood
msf6 post(hardware/automotive/can_flood) > show info
Name: CAN Flood
Module: post/hardware/automotive/can_flood
Platform: Hardware
Arch:
Rank: Normal
Provided by:
Pietro Biondi
Compatible session types:
Hwbridge
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
CANBUS yes CAN interface
FRAMELIST /opt/metasploit-framework/embedded/framework/data/wordlists/can_flood_frames.txt yes Path to frame list file
ROUNDS 200 yes Number of executed rounds
SESSION yes The session to run this module on.
Description:
This module floods a CAN interface with supplied frames.
Module Options
This is a complete list of options available in the hardware/automotive/can_flood post exploitation module:
msf6 post(hardware/automotive/can_flood) > show options
Module options (post/hardware/automotive/can_flood):
Name Current Setting Required Description
---- --------------- -------- -----------
CANBUS yes CAN interface
FRAMELIST /opt/metasploit-framework/embedded/framework/data/wordlists/can_flood_frames.txt yes Path to frame list file
ROUNDS 200 yes Number of executed rounds
SESSION yes The session to run this module on.
Advanced Options
Here is a complete list of advanced options supported by the hardware/automotive/can_flood post exploitation module:
msf6 post(hardware/automotive/can_flood) > show advanced
Module advanced options (post/hardware/automotive/can_flood):
Name Current Setting Required Description
---- --------------- -------- -----------
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Post Actions
This is a list of all post exploitation actions which the hardware/automotive/can_flood module can do:
msf6 post(hardware/automotive/can_flood) > show actions
Post actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the hardware/automotive/can_flood post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(hardware/automotive/can_flood) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
Frame list file '<FRAMELIST>' does not exist
Here is a relevant code snippet related to the "Frame list file '<FRAMELIST>' does not exist" error message:
24: ])
25: end
26:
27: def run
28: unless File.exist?(datastore['FRAMELIST'])
29: print_error("Frame list file '#{datastore['FRAMELIST']}' does not exist")
30: return
31: end
32:
33: vprint_status("Reading frame list file: #{datastore['FRAMELIST']}")
34: frames = File.readlines(datastore['FRAMELIST']).map { |line| line.strip.split('+') }
Go back to menu.
Related Pull Requests
Go back to menu.
See Also
Check also the following modules related to this module:
- post/hardware/automotive/canprobe
- post/hardware/automotive/diagnostic_state
- post/hardware/automotive/ecu_hard_reset
- post/hardware/automotive/getvinfo
- post/hardware/automotive/identifymodules
- post/hardware/automotive/malibu_overheat
- post/hardware/automotive/mazda_ic_mover
- post/hardware/automotive/pdt
Authors
Pietro Biondi
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.