{"id":441,"date":"2010-08-02T21:01:00","date_gmt":"2010-08-02T21:01:00","guid":{"rendered":"http:\/\/3.68.38.87\/?p=441"},"modified":"2023-06-01T03:10:05","modified_gmt":"2023-06-01T03:10:05","slug":"oh-no-odometer-reading-and-righting-er-writing","status":"publish","type":"post","link":"https:\/\/canbushack.com\/web\/oh-no-odometer-reading-and-righting-er-writing\/","title":{"rendered":"OH NO, ODOMETER: READING AND RIGHTING\u2026 ER, WRITING."},"content":{"rendered":"\n<p>A legal requirement in most countries, including the U.S., odometer is the measure of the distance your vehicle has traveled. Possibly, this is to aid sellers of the car in appraising the true market value of the vehicle.<\/p>\n\n\n\n<p>Many people have requested if there was a way to modify this value so that they could increase the value of their vehicle correct their miscalculated Odometer and as you can imagine, this is a very difficult task. Similarly I have had request on how to simply read this parameter from the CAN Bus.<\/p>\n\n\n\n<p>First off let me just note that changing or rolling back your odometer is technically not illegal. If you wish you can modify this number without penalty (<strong>Don\u2019t listen to me I\u2019m not a lawyer<\/strong>). However when it comes time to sell the vehicle you must properly report the true odometer reading by placing a tag on the inside driver\u2019s door along the side. This is because device that displays the odometer could go bad and could need to be replaced. In some cases, this means that the odometer value is reset back to zero. When this happens the installer will typically add this tag with the old odometer value and legitimize the install.<\/p>\n\n\n\n<p>So how do you modify an existing odometer? The answer depends firmly on the vehicle that you are attempting to use. This means that some vehicles are moderately difficult and others unbelievably impossible. There are a handful of tools available for technician. If your engine is replaced, in some cases you may be able to reset the odometer. So for this event a technician will have a specialized tool designed to connect to the controller or controllers that may store the odometer\u2019s value. This tool, through some secure method, will modify the odometer data that is stored on the controller(s). Of course these tools are difficult to find, cost upwards of $2,000 for one unit, and typically only work for one manufacturer. So they are not very accessible.<\/p>\n\n\n\n<p>So what if you only want to read the odometer from the network? There are a handful of applications that could use the odometer\u2019s value as an input. For instance, automotive insurance companies around the globe would like to create a more equitable method for charging rates. In some cases they can install a data logging device into your vehicle and measure the distance that you typically travel. Like your electrical bill, these devices would allow you to pay for only what you use. In the case if you drive a shorter distance you will pay less than another person who drives more than you. This pay-per-mile or pay-per-kilometer idea could give a particular auto insurance agency a competitive advantage for those who commute less and could prove it.<\/p>\n\n\n\n<p>Sadly odometer is not an OBDII legislated PID. This means the federal government does not require OEMs to have this information available to the general public via vehicle diagnostics. So you if you wanted odometer you would have to find it. Like other similar data, odometer may or may not be available via an enhanced diagnostic command and if it is available its ID and request method is not required to be publicly available. So if you want to find it you\u2019re going to have to roll up your sleeves, get out your CAN Bus Hacking tool and start reverse engineering.<\/p>\n\n\n\n<p>So what are you looking for? If it is available, odometer could be obtained in one or two different ways: Enhanced Diagnostics or Normal Messages (data that is sent without a request). This means we have two vectors (cool buzz word I learned at defcon) (I\u2019m probably using it wrong) that we need to explore.<\/p>\n\n\n\n<p>Getting Odo via Diagnostics:<\/p>\n\n\n\n<p>As stated in some of my previous blog entries, Enhanced Diagnostics is a Command\/Response protocol that allows you to \u201cask\u201d the controllers for data. This is the preferred method as we can control when the data is broadcast on the network simply by asking. So let\u2019s assume we know nothing about how this request is going to look, Enhanced Diagnostics must follow a very specific format for it to be effective. This message format is based on the ISO 15765-2 specification (<a href=\"https:\/\/web.archive.org\/web\/20190721203446\/http:\/\/canbushack.com\/web\/blog\/index.php\/2010\/03\/19\/iso-15765-2-can-transport-layer-yes-it-can-be-fun\" target=\"_blank\" rel=\"noreferrer noopener\">CANBUSHACK.com: ISO-15765<\/a>&nbsp;). We must also have made a list of command Request IDs (a.k.a. Node IDs) and Response IDs (<a href=\"https:\/\/web.archive.org\/web\/20190721203446\/http:\/\/canbushack.com\/web\/blog\/index.php\/2010\/05\/15\/scanning-for-diagnostic-data\" target=\"_blank\" rel=\"noreferrer noopener\">CANBUSHACK.com: Scan for Diagnostic Data<\/a>). Once we have the IDs for each node we must now find a list of valid PIDs (Parameter IDs). PIDs are typically a representation of a single parameter for example PID&nbsp;0x0C&nbsp;in OBDII diagnostics is the Engine Speed data request. So we are looking for the PID that belongs to Odometer\u2026<\/p>\n\n\n\n<p>So let\u2019s take a big step back and narrow down the list of possible Services that may be used to request a parameter like odometer. This list is essentially vehicle specific and is not necessarily published anywhere so you will have to have some experience with this to narrow the list. If you don\u2019t then your effort will take a bit more time, but it isn\u2019t impossible. Typically PIDs are requested using the following services:&nbsp;0x1A, 0x22, and 0x21. Now it\u2019s important to know one thing before we continue: what is the PID size (in bytes) that the controller is expecting. This is typically one or two bytes. For example service&nbsp;0x1A&nbsp;on GMLAN requires the PID (actually they call it a DID) to be 1 byte in length whereas, the service&nbsp;0x22&nbsp;on GMLAN requires two byte PIDs.<\/p>\n\n\n\n<p>Now that we have a small list of possible services, let\u2019s start with them (Tip: Services are essentially functions that you are requesting the controller to perform). Let\u2019s assume that we have a controller that has a Diagnostic Request ID of&nbsp;<strong>0x734<\/strong>&nbsp;and a response ID of&nbsp;<strong>0x744<\/strong>, I want to send&nbsp;<strong>0x734 03 1A 01 00 00 00 00 00<\/strong>&nbsp;to the controller. Translation: Function 0x1A, PID 0x01. Now we are hoping for the following positive response from the controller:&nbsp;<strong>0x744 06 5A 01 00 02 03 04 00<\/strong>&nbsp;where the 0x5A is the positive response to our 0x1A request (Recall: Service ID plus 0x40 = positive response) and 0x06 lets us know that the data coming back is going to be 4 bytes (why not 6? Because 0x06 includes the service ID response and the PID Echo). 4 bytes is very promising when looking for odometer because chances are we will need this size to be large enough to store all potential values of odometer including possibly scaling it to the 10ths or 100ths of a Mile or Kilometer. 0x01 is the PID that we requested and&nbsp;0x00020304&nbsp;is the four byte response data we received.<\/p>\n\n\n\n<p>Odds are that odometer will likely be stored in a large number of bytes because typically the odometer will need to be an overly large number just in case. 4 bytes = 8 bits * 4 = 32 bits; Upper Limit is 2^32 = 4,294,967,296. Why so big? I don\u2019t know, maybe it\u2019s scaled so the upper limit will be smaller.. But in this case if we rescaled 4,294,967,296 to&nbsp;<em>X\/100<\/em>, this would allow us more granularity of the odometer value itself. Now let\u2019s look at our vehicle\u2019s odometer value on the dash display. We\u2019ll assume it reads 824 Miles. The first thing we that must do is change this value to Kilometers.&nbsp;<strong>The metric system is an absolute when dealing with data on the CAN Bus&nbsp;<\/strong>(mostly \ud83d\ude42<strong>.&nbsp;<\/strong>So this is approximately 1,318.4 KM. Now let\u2019s convert the data we got back from our controller from hexadecimal to decimal. 0x00020304 = 131,844. So now we simply take the observed data from the CAN Bus and see if there is some correlation to what we saw on the dash and of course we can see this one is quite easily: 131,844\/100 = 1,318.4 KM. Now we must hope this isn\u2019t some strange, strange coincidence and we\u2019ll mark this one down in our book as solved. If we have a chance to validate this on another vehicle this may be ideal.<\/p>\n\n\n\n<p>But what would happen if the controller didn\u2019t send a positive response? Nearly 90% of the time the controller is going to say that you have requested a non-existent PID these responses can take many forms but they will always have 0x7F in the second data byte. A typical negative response would look like this&nbsp;<strong>0x744 03 7F 1A 30 00 00 00 00<\/strong>. This follows the ISO 15765 protocol for negative responses and in this example 0x30 is the NRC (negative response code). This code is a clue as to why the data was rejected. Be careful, because sometimes the NRC may be telling to send another message before you request a PID and NOT that you have a bad PID. So pay close attention to the NRC and again take a look at my ISO 15765 post to view a list of NRCs.<\/p>\n\n\n\n<p>Now that we have the Odometer we should be able to read it any time we want. This allows us full control of when we get the data, but there is a possibility that we won\u2019t be able to find it using this method. We may want to find a factory scan tool (not an easy task at all!) and see if it can request odometer from the vehicle. If it can, then we need only monitor the request and simulated it by connecting our CAN Bus tool at the same time as the scan tool (OBDII Y-splitter is recommended, obdiicables.com).<\/p>\n\n\n\n<p>Getting Odo via Normal Messages:<\/p>\n\n\n\n<p>Like in our previous example, we are going to be looking for a parameter; the difference is we are essentially looking for a needle in a needle stack. The needle is the odometer and the stack is a lot of other data parameters that are being broadcast by a handful of controllers.<\/p>\n\n\n\n<p>So let\u2019s take a second to figure out how we might narrow the list of possible candidates. First, since we are probably in a stationary car, the data should not be changing. So filter out any changing data. Second, the data should be a non-zero value about two to four bytes in length. Third, the data will have to have some type of correlation with odometer value that we see on the dash. The smaller the width (in bytes) of the odometer parameter that we find the more likely that there is some type of scalar associated with it. These scalars may be something like: x\/10 or even x*10 or more likely x*2^y (where y could is typically between -4 and 4) or simply x*1. Try to run each possible hit through each possible scalar; this should yield the best results.<\/p>\n\n\n\n<p>In short, odometer is an elusive parameter to find, but with some perseverance you can find it\u2026 but then again who cares right?<\/p>\n\n\n\n<p>\u2014\u2014\u2014\u2014\u2014\u2013 \u2014\u2014\u2014\u2014- \u2014\u2014\u2014\u2014\u2014- \u2014\u2014\u2014\u2014\u2013<\/p>\n\n\n\n<p>On a side note, if you do find odometer on a vehicle, please post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A legal requirement in most countries, including the U.S., odometer is the measure of the distance your vehicle has traveled. Possibly, this is to aid sellers of the car in appraising the true market value of the vehicle. Many people have requested if there was a way to modify this value so that they could [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":388,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-441","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/posts\/441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/comments?post=441"}],"version-history":[{"count":0,"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/posts\/441\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/media\/388"}],"wp:attachment":[{"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/media?parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/categories?post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/canbushack.com\/web\/wp-json\/wp\/v2\/tags?post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}