Get the Vehicle Information Such as the VIN from the Target Module - Metasploit


This page contains detailed information about how to use the post/hardware/automotive/getvinfo metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Get the Vehicle Information Such as the VIN from the Target Module
Module: post/hardware/automotive/getvinfo
Source code: modules/post/hardware/automotive/getvinfo.rb
Disclosure date: -
Last modification time: 2020-09-22 02:56:51 +0000
Supported architecture(s): -
Supported platform(s): Hardware
Target service / protocol: -
Target network port(s): -
List of CVEs: -

Post Module to query DTCs, Some common engine info and Vehicle Info. It returns such things as engine speed, coolant temp, Diagnostic Trouble Codes as well as All info stored by Mode $09 Vehicle Info, VIN, etc

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/getvinfo

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/getvinfo
msf post(getvinfo) > show options
    ... show and set options ...
msf post(getvinfo) > set SESSION session-id
msf post(getvinfo) > 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/getvinfo")
  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.

Knowledge Base


Introduction


This module gathers several pieces of information from the vehicle. First it reports the available PIDS for pulling realtime current_data from Mode $01. If some of the common PIDs are returned it will print those as well, such as Engine Temp and Vehicle speed. If there are any Diagnostic Trouble Codes (DTCs) it will list those. The DTCs and Engine Light can be cleared by setting the optional CLEAR_DTC to true. Finally it gathers Vehicle information via UDS Mode $09 requests. The module first probes Mode $09 PID $00 to determine what all PIDs are supported then iterates through them and prints the response. The module will format known PIDs to ASCII.

Options


SRCID

This is the SRC CAN ID for the ISO-TP connection. Default is 0x7E0.

DSTID

This is the CAN ID of the expected response. Default is 0x7E8.

CANBUS

Determines which CAN bus to communicate on. Type 'supported_buses' for valid options.

CLEAR_DTCS

If any Diagnostic Trouble Codes (DTCs) are present it will clear those and reset the MIL (Engine Light).

PADDING

Optional byte-value to use for padding all CAN bus packets to an 8-byte length. Padding is disabled by default.

FC

Optional. If true forces sending flow control packets on all multibyte ISO-TP requests

Scenarios


Given a standard vehicle ECU that is connected to can2 of the HWBridge device:

hwbridge > run post/hardware/automotive/getvinfo CANBUS=can2

[*] Avaiable PIDS for pulling realitme data: 46 pids
[*]   [1, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 24, 25, 28, 31, 32, 32, 33, 44, 45, 46, 47, 48, 49, 50, 51, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 76]
[*]   MIL (Engine Light) : OFF
[*]   Number of DTCs: 0
[*]   Engine Temp: 140 °C / 284 °F
[*]   RPMS: 0
[*]   Speed: 0 km/h  /  0.0 mph
[*] Supported OBD Standards: OBD and OBD-II
[*] Mode $09 Vehicle Info Supported PIDS: [2, 4, 6, 8]
[*] VIN: 1G1ZT53826F109149
[*] Calibration ID: UDS ERR: {"RCRRP"=>"Request Correctly Received, but Response is Pending"}
[*] PID 6 Response: ["00", "00", "C4", "E9", "00", "00", "17", "33", "00", "00", "00", "00"]
[*] PID 8 Response: ["00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00"]

Go back to menu.

Msfconsole Usage


Here is how the hardware/automotive/getvinfo post exploitation module looks in the msfconsole:

msf6 > use post/hardware/automotive/getvinfo

msf6 post(hardware/automotive/getvinfo) > show info

       Name: Get the Vehicle Information Such as the VIN from the Target Module
     Module: post/hardware/automotive/getvinfo
   Platform: Hardware
       Arch: 
       Rank: Normal

Provided by:
  Craig Smith

Compatible session types:
  Hwbridge

Basic options:
  Name        Current Setting  Required  Description
  ----        ---------------  --------  -----------
  CANBUS                       no        CAN Bus to perform scan on, defaults to connected bus
  CLEAR_DTCS  false            no        Clear any DTCs and reset MIL if errors are present
  DSTID       2024             no        Expected reponse ID, defaults to SRCID + 8
  FC          false            no        Optinal forces flow control
  PADDING                      no        Optinal end of packet padding
  SESSION                      yes       The session to run this module on.
  SRCID       2016             yes       Module ID to query

Description:
  Post Module to query DTCs, Some common engine info and Vehicle Info. 
  It returns such things as engine speed, coolant temp, Diagnostic 
  Trouble Codes as well as All info stored by Mode $09 Vehicle Info, 
  VIN, etc

Module Options


This is a complete list of options available in the hardware/automotive/getvinfo post exploitation module:

msf6 post(hardware/automotive/getvinfo) > show options

Module options (post/hardware/automotive/getvinfo):

   Name        Current Setting  Required  Description
   ----        ---------------  --------  -----------
   CANBUS                       no        CAN Bus to perform scan on, defaults to connected bus
   CLEAR_DTCS  false            no        Clear any DTCs and reset MIL if errors are present
   DSTID       2024             no        Expected reponse ID, defaults to SRCID + 8
   FC          false            no        Optinal forces flow control
   PADDING                      no        Optinal end of packet padding
   SESSION                      yes       The session to run this module on.
   SRCID       2016             yes       Module ID to query

Advanced Options


Here is a complete list of advanced options supported by the hardware/automotive/getvinfo post exploitation module:

msf6 post(hardware/automotive/getvinfo) > show advanced

Module advanced options (post/hardware/automotive/getvinfo):

   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/getvinfo module can do:

msf6 post(hardware/automotive/getvinfo) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the hardware/automotive/getvinfo post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(hardware/automotive/getvinfo) > 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.

CLEAR_DTCS


Here is a relevant code snippet related to the "CLEAR_DTCS" error message:

22:	    register_options([
23:	      OptInt.new('SRCID', [true, "Module ID to query", 0x7e0]),
24:	      OptInt.new('DSTID', [false, "Expected reponse ID, defaults to SRCID + 8", 0x7e8]),
25:	      OptInt.new('PADDING', [false, "Optinal end of packet padding", nil]),
26:	      OptBool.new('FC', [false, "Optinal forces flow control", nil]),
27:	      OptBool.new('CLEAR_DTCS', [false, "Clear any DTCs and reset MIL if errors are present", false]),
28:	      OptString.new('CANBUS', [false, "CAN Bus to perform scan on, defaults to connected bus", nil])
29:	    ])
30:	
31:	  end
32:	

No reported PIDs. You may not be properly connected


Here is a relevant code snippet related to the "No reported PIDs. You may not be properly connected" error message:

34:	    opt = {}
35:	    opt['PADDING'] = datastore["PADDING"] if datastore["PADDING"]
36:	    opt['FC'] = datastore['FC'] if datastore['FC']
37:	    pids = get_current_data_pids(datastore["CANBUS"], datastore["SRCID"], datastore["DSTID"], opt)
38:	    if pids.size == 0
39:	      print_status("No reported PIDs. You may not be properly connected")
40:	    else
41:	      print_status("Available PIDS for pulling realtime data: #{pids.size} pids")
42:	      print_status("  #{pids.inspect}")
43:	    end
44:	    if pids.include? 1

Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Craig Smith

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.