-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## Line 23\n\nThe vulnerable file is `src/SAE_J1939/SAE_J1939-21_Transport_Layer/Transport_Protocol_Data_Transfer.cpp`. The function is `SAE_J1939_Read_Transport_Protocol_Data_Transfer`, called every time the ECU receives a J1939 Transport Protocol Data Transfer frame on PGN 0xEB00. The bug is on the third line of the function body:\n\n```c\nvoid SAE_J1939_Read_Transport_Protocol_Data_Transfer(J1939 *j1939, uint8_t SA, uint8_t data[]) {\n /* Save the sequence data */\n j1939->from_other_ecu_tp_dt.sequence_number = data[0];\n j1939->from_other_ecu_tp_dt.from_ecu_address = SA;\n uint8_t index = data[0] - 1;\n for (uint8_t i = 1; i < 8; i++)\n j1939->from_other_ecu_tp_dt.data[index*7 + i-1] = data[i];\n```\n\n`data[0]` is the sequence number byte from a CAN frame. The CAN frame is an unauthenticated, unsigned wire-format message arriving over a shared bus. The function stores `data[0]` into `from_other_ecu_tp_dt.sequence_number`, then declares `uint8_t index = data[0] - 1`. The subtraction is unsigned. When `data[0]` is `0`, `index` underflows to `255`.\n\nThe loop runs `i` from 1 to 7 inclusive. Each iteration writes to `from_other_ecu_tp_dt.data[index*7 + i-1]`. With `index = 255`, the writes target offsets 1785 through 1791 of the `data[]` array. The array is declared `uint8_t data[MAX_TP_DT]`, where `MAX_TP_DT` is `1785`, indexed 0 through 1784. Every iteration of the loop is an out-of-bounds write.\n\nThe bytes written into those offsets come from `data[1]` through `data[7]`: the remaining seven bytes of the same CAN frame the sequence number arrived on. The attacker controls the index (through `data[0]`) and the seven bytes written (through `data[1..7]`).\n\nThe parent state object is the `J1939` struct in `Structs.h`. Its field ordering is fixed:\n\n```c\nstruct TP_DT {\n uint8_t sequence_number;\n uint8_t data[MAX_TP_DT];\n uint8_t from_ecu_address;\n};\n\ntypedef struct {\n /* ... */\n struct TP_CM from_other_ecu_tp_cm;\n struct TP_DT from_other_ecu_tp_dt;\n struct DM from_other_ecu_dm;\n struct Identifications from_other_ecu_identifications;\n /* ... */\n} J1939;\n```\n\nWriting past `from_other_ecu_tp_dt.data[]` reaches `from_other_ecu_tp_dt.from_ecu_address`, then continues into `from_other_ecu_dm`, which begins with `errors_dm1_active`, `errors_dm2_active`, and the byte fields of the embedded `dm1`. Those fields drive the diagnostic message dispatcher elsewhere in the library. Setting them to attacker-chosen values puts the ECU into states the diagnostic state machine does not expect, with no protocol-level signal that anything is wrong.\n\nCVSS records this as CVE-2026-37537, vector `AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H`, score 8.1.\n\n## The bound was documented two files away\n\nThe valid range of `data[0]` is not a mystery. The author of the library wrote it down. In `src/Open_SAE_J1939/Structs.h`:\n\n```c\nstruct TP_CM {\n uint8_t control_byte;\n uint16_t total_message_size;\n uint8_t number_of_packages; /* How many times we are going to send packages via TP_DT - 2 to 224 because 1785/8 is 224 rounded up */\n uint32_t PGN_of_the_packeted_message;\n uint8_t from_ecu_address;\n};\n\nstruct TP_DT {\n uint8_t sequence_number; /* When this sequence number is the same as number_of_packages from TP_CM, then we have our complete message */\n uint8_t data[MAX_TP_DT];\n uint8_t from_ecu_address;\n};\n```\n\nThe bound is in plain English. Number-of-packages is 2 to 224. The math is shown: 1785 divided by 8 equals 224 rounded up. The sequence number is described in the next struct as the value that matches `number_of_packages` from TP_CM, which implies its range is `[1, number_of_packages]`, which is bounded by `[1, 224]`.\n\nThe bound is also in the SAE J1939-21 specification. A sequence number of zero is not a valid TP-DT frame by the protocol. The first packet in a multi-packet transfer is sequence number 1.\n\nThe bound is also in the protocol's flow control. A `RTS` (Request To Send) frame in the TP-CM module declares `number_of_packages` before any TP-DT frames arrive. The receiver is supposed to reject TP-DT frames whose sequence number is outside `[1, number_of_packages]`.\n\nThe bound exists in three places: the author's prose, the SAE standard, and the protocol's own flow control. None of those three becomes a runtime check inside `SAE_J1939_Read_Transport_Protocol_Data_Transfer`. The function does not read `from_other_ecu_tp_cm.number_of_packages`. The function does not compare `data[0]` against any constant. The function does not validate that the TP_CM module has been initialized at all. A TP-DT frame received with no prior TP-CM exchange runs the same loop with the same arithmetic and the same out-of-bounds write.\n\nThe check the author wrote down was the check the compiler never ran.\n\n## The fork is frozen at the commit the CVE names\n\nThe CVE description names the commit by hash: `744024d4306bc387857dfce439558336806acb06`, dated 2023-03-08. That hash is the `master` branch's HEAD.\n\n```\n$ git log --oneline\n744024d Basically gutted remaining support for STM32 or the other default environments. Now supports CAN_COMMON compliant interfaces and Teensy FlexCAN_T4 which are the environments I needed.\nec3d7bf Restructured readme a bit\nd21a825 Add Arduino library properties file\n9f1bd73 Initial commit of modified library. Now geared toward Arduino\n```\n\nFour commits, all in February and March 2023. The repository has not been touched since. The library was modified to target Teensy FlexCAN_T4, the Arduino-compatible CAN board that researchers and small fleet operators use to talk to heavy-duty vehicle networks from a microcontroller. The fork was the author's working copy for a specific Teensy-based project. It was published, then frozen.\n\nThere will be no patch on this fork. There is no maintainer for this fork. The CVE record will exist as long as the fork's commit history does.\n\n## The upstream has the same line\n\n`collin80/Open-SAE-J1939` is a fork of `DanielMartensson/Open-SAE-J1939`. The upstream is still maintained. Its `master` branch HEAD is `b6caf88`. The upstream's TP-DT module contains:\n\n```c\n// daniel/Src/SAE_J1939/SAE_J1939-21_Transport_Layer/Transport_Protocol_Data_Transfer.c, line 23\nuint8_t i, j, index = data[0] - 1;\nfor (i = 1; i < 8; i++){\n j1939->from_other_ecu_tp_dt.data[index*7 + i-1] = data[i];\n}\n```\n\nIdentical arithmetic. Identical offset. Identical out-of-bounds write. The upstream adds CTS flow-control handling around the assignment (it sends a CTS retransmit when the sequence number does not match `number_of_packages_being_transmitted`), but the retransmit decision runs after the unsafe write executes. The bug is in the upstream at the same line, in the same function, in the same module.\n\nCVE-2026-37537 names the collin80 fork. The upstream is covered by CVE-2026-37534 and CVE-2026-42467, filed for an integer-underflow and a stack overflow in the same Transport Layer module. The same disclosure batch produced both sets of CVE numbers. The fork's CVE and the upstream's CVEs travel on the same vulnerability gist, in adjacent rows of the same table.\n\nThe upstream's line 23 is not in either of the upstream's CVE titles. It is the same bug as CVE-2026-37537 in everything but ownership. The disclosure treated the fork as its own product because the fork has its own GitHub URL.\n\n## What \"adjacent\" means on a truck\n\nThe CVSS vector is `AV:A`. Reading that on a web vulnerability, adjacent usually means a shared layer-2 segment, a research lab, a corporate VLAN. On a heavy-duty vehicle CAN bus, adjacent means:\n\n- The OBD-II port under the dash.\n- The trailer connector behind the cab.\n- The aftermarket telematics dongle the fleet's insurance carrier mailed the operator.\n- The post-sale ECU upgrade module bolted to the harness.\n- The cell-connected gateway whose firmware does not strictly filter the CAN frames it forwards from a remote endpoint.\n\n`AC:L` is honest about how easy it is to inject a frame onto a J1939 bus once any of the above is in reach. `PR:N` is honest about the absence of authentication on the CAN protocol. `S:U` (Scope: Unchanged) is the line that needs unpacking. The scope is \"unchanged\" because the J1939 protocol assumes the bus is a closed network and a malformed frame stays within the trust domain of the parser that receives it. The engine ECU, the transmission ECU, the brake controller, and the trailer brake controller all sit on the same bus and trust each other's frames the same way `SAE_J1939_Read_Transport_Protocol_Data_Transfer` trusts `data[0]`. Scope is unchanged because the threat model says the bus is friendly.\n\n## The disclosure is a survey\n\nCVE-2026-37537 cites a gist by Feng Ning of Innora Security Research, dated 2026-04-30. The gist is not a single-CVE writeup. It is a batch disclosure of eleven CVEs across eight CAN, J1939, ISO-TP, UDS, and CAN-log-format libraries:\n\n| Library | Class of bug |\n|---|---|\n| `Open-SAE-J1939` (upstream) | TP-CM size-calculation underflow, stack overflow |\n| `collin80/Open-SAE-J1939` (this fork) | TP-DT sequence-number underflow |\n| `openxc/isotp-c` | ISO 15765-2 reassembly OOB read |\n| `miaofng/uds-c` | UDS service-data stack overflow |\n| `socketcand` | CAN ID string stack overflow |\n| `cannelloni` | UDP/TCP/SCTP-tunneled CAN frame parsing heap overflow |\n| `OpenAMP` ELF loader | 32-bit multiplication overflow on `PT_LOAD` size |\n| `OVMS3` (three log parsers) | header-length-driven `memcpy` into stack buffer |\n\nEvery entry in the table is the same shape. A wire-format integer drives a memory operation without a bounds check. Different fields, different libraries, different protocols, different attack surfaces. The same bug class in every one of them.\n\nThe gist is not a vulnerability disclosure. The gist is a survey of one bug class across one ecosystem. The eight libraries were not chosen because they share code. They were chosen because they share a worldview: the bus is a closed network, the wire is a trusted source, the protocol defines the legal range so the legal range is what arrives. Each library implements the worldview in different code. The disclosure shows the worldview produces the same class of bug in every implementation.\n\nThis is the closed-network-assumed shape. A parser written for a \"trusted\" bus accepts framing fields as if the protocol's valid-range constraints were guaranteed by the medium. Sequence numbers, length fields, and indices arrive without bounds checks because the developer's threat model excludes adversaries on the wire. When the bus admits a malformed frame, the protocol-derived constant becomes the size of the overflow.\n\nCVE-2026-37537 is one row of the survey. The fork's specific CVE will not be patched. The upstream's matching bug travels on different CVE numbers. The other seven libraries each have their own. The worldview is intact.\n\nPoC: [collin80/Open-SAE-J1939](https://github.com/collin80/Open-SAE-J1939) ยท Disclosure: [Innora Security Research](https://gist.github.com/sgInnora/f4ac66faeefe07a653ceeb3f58cdc381)","closing_line":"The bug is the threat model. There is no patch for a threat model.","hook_md":"Line 23 of `Transport_Protocol_Data_Transfer.cpp` in `collin80/Open-SAE-J1939` reads a byte off a CAN frame and uses it as an array index. The valid range of that byte is documented in a comment in `Structs.h`, two files away: between 2 and 224, because 1785 divided by 8 is 224 rounded up. The comment is not a check. When the byte arrives as zero, a `uint8_t` index underflows to 255, and the loop on line 25 writes seven attacker-controlled bytes past the end of a 1785-byte buffer, into the next struct in the J1939 state machine. CVE-2026-37537 is those seven bytes. The commit the CVE names is three years old, and it is the most recent commit the repository has.","post_id":337,"slug":"open-sae-j1939-cve-2026-37537-bound-was-a-comment","title":"CVE-2026-37537: The Bound Was a Comment","type":"initial","unreadable_sentence":"The check the author wrote down was the check the compiler never ran."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCai8QtwAKCRDeZjl4jgkQ JqFwAQC6PDdA47IdT5FSPCiqqqSnkbxfaCnZjvI4/h/gUGGLtAEAlRQWSLEZX5JF ELWglyAgMnBEBFx+HepN/zn1TcPvYAM= =Q0FJ -----END PGP SIGNATURE-----