Skip to the content
PCBKitNew board
2 layers31 × 24 mmMellon, the printed circuit board in 3D

OSDP attack tool (and the Elvish word for friend)

Size
31 × 24 mm
Copper layers
2
Thickness
1.6 mm
Parts
36
Nets
49
Pads
131
Tracks, vias
305, 30
Pours
3
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
2 Aug 2023
Updated
15 Aug 2023

Overview

Mellon is an open-source printed circuit board by BishopFox, from the BishopFox/mellon repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 31 × 24 mm with 36 parts on 49 nets, routed with 305 tracks and 30 vias.

It is built around the MAX485CSA+, ADP2302ARDZ-5.0-R7 and B330. Its parts include 11 resistors, 10 capacitors, 4 diodes, 3 ICs and 3 connectors.

Main components

3

README

README.md

OSDP Vulnerabilities this Exploits

OSDP attack tool (and the Elvish word for friend)

Attack #1: Encryption is Optional

OSDP supports, but doesn't strictly require, encryption. So your connection might not even be encrypted at all. Attack #1 is just to passively listen and see if you can read the card numbers on the wire.

Attack #2: Downgrade Attack

Just because the controller and reader support encryption doesn't mean they're configured to require it be used. An attacker can modify the reader's capability reply message (osdp_PDCAP) to advertise that it doesn't support encryption. When this happens, some controllers will barrel ahead without encryption.

Attack #3: Install-mode Attack

OSDP has a quasi-official “install mode” that applies to both readers and controllers. As the name suggests, it’s supposed to be used when first setting up a reader. What it does is essentially allow readers to ask the controller for what the base encryption key (the SCBK) is. If the controller is configured to be persistently in install-mode, then an attacker can show up on the wire and request the SCBK.

Attack #4: Weak Keys

OSDP sample code often comes with hardcoded encryption keys. Clearly these are meant to be samples, where the user is supposed to generate keys in a secure way on their own. But this is not explained or made simple for the user, however. And anyone who’s been in security long enough knows that whatever’s the default is likely to be there in production.

So as an attack vector, when the link between reader and controller is encrypted, it’s worth a shot to enumerate some common weak keys. Now these are 128-bit AES keys, so we’re not going to be able to enumerate them all. Or even a meaningful portion of them. But what we can do is hit some common patterns that you see when someone hardcodes a key:

  • All single-byte values. [0x04, 0x04, 0x04, 0x04 …]
  • All monotonically increasing byte values. [0x01, 0x02, 0x03, 0x04, …]
  • All monotonically decreasing byte values. [0x0A, 0x09, 0x08, 0x07, …]

Attack #5: Keyset Capture

OSDP has no in-band mechansim for key exchange. What this means is that an attacker can:

  • Insert a covert listening device onto the wire.
  • Break / factory reset / disable the reader.
  • Wait for someone from IT to come and replace the reader.
  • Capture the keyset message (osdp_KEYSET) when the reader is first setup.
  • Decrypt all future messages.

Getting A Testbed Setup (Linux/MacOS)

You'll find proof-of-concept code for each of these attacks in attack_osdp.py. Checkout the --help command for more details on usage. This is a Python script, meant to be run from a laptop with USB<-->RS485 adapters like one of these. So you'll probably want to pick some of those up. Doesn't have to be that model, though.

If you have a controller you want to test, then great. Use that. If you don't, then we have an intentionally-vulnerable OSDP controller that you can use here: vulnserver.py.

Some of the attacks in attack_osdp.py will expect to be as a full MitM between a functioning reader and controller. To test these, you might need three USB<-->RS485 adapters, hooked together with a breadboard.

Additional Medium / Low Risk Issues

These issues are not, in isolation, exploitable but nonetheless represent a weakening of the protocol, implementation, or overall system.

  • MACs are truncated to 32 bits "to reduce overhead". This is very nearly (but not quite in our calculation) within practical exploitable range.
  • IVs (which are derived from MACs) are similarly reduced to 32 bits of entropy. This will cause IV reuse, which is a big red flag for a protocol.
  • Session keys are only generated using 48 bits of entropy from the controller RNG nonce. This appears to not be possible for an observing attacker to enumerate offline, however. (Unless we're missing something, in which case this would become a critical issue.)
  • Sequence numbers consist of only 2 bits, not providing sufficient liveness.
  • CBC-mode encryption is used. GCM would be a more modern block cipher mode appropriate for network protocols.
  • SCS modes 15 & 16 are essentially "null ciphers", and should not exist. They don't encrypt data.
  • The OSDP command byte is always unencrypted, even in the middle of a Secure Channel session. This is a huge benefit to attackers, making attack tools much easier to write. It means that an attacker can always see what "type" of packet is being sent, even if it's otherwise encrypted. Attackers can tell when people badge in, when the LED lights up, etc... This is not information that should be in plaintext.
  • SCBK-D (a hardcoded "default" encryption key) provides no security and should be removed. It serves only to obfuscate and provide a false sense of security.

Parts

36
QtyValueFootprintReferences
410KResistor_SMD:R_0603_1608MetricR5, R6, R7, R8
31KResistor_SMD:R_0603_1608MetricR2, R9, R10
3LEDDiode_SMD:D_0603_1608MetricD2, D3, D4
2009176002022106footprints-KVX:CONN_9176_2WAY_KYOJ2, J3
210uFCapacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-AC5, C6
210uFCapacitor_SMD:C_0603_1608MetricC1, C7
220KResistor_SMD:R_0603_1608MetricR3, R4
222pFCapacitor_SMD:C_0603_1608MetricC9, C10
222uFCapacitor_SMD:C_0603_1608MetricC3, C4
10.1uFCapacitor_SMD:C_0603_1608MetricC2
1100KResistor_SMD:R_0603_1608MetricR1
110uHInductor_SMD:L_1008_2520MetricL2
1120Resistor_SMD:R_0603_1608MetricR11
11uFCapacitor_SMD:C_0603_1608MetricC8
132.768khzCrystal:Crystal_SMD_MicroCrystal_CC7V-T1A-2Pin_3.2x1.5mmX2
14077eec:Adafruit_Industries-4077-*MD1
16.8uHInductor_SMD:L_TDK_VLS6045EX_VLS6045AFL1
1ADP2302ARDZ-5.0Package_SO:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.29x3mmU1
1AZ1117-3.3Package_TO_SOT_SMD:SOT-223U3
1B330Diode_SMD:D_SMAD1
1LOGOLOGOG***
1MAX485CSA+footprints:21-0041B_8_MXMU2
1ST_Nucleo_SWD_5pConnector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_VerticalJ1

Questions

How big is the Mellon PCB?

It measures 31 × 24 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Mellon use?

36 parts, built around the MAX485CSA+, ADP2302ARDZ-5.0-R7 and B330. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Mellon KiCad files?

From the BishopFox/mellon repository on GitHub, at the commit this page was made from: the board is Mellon/Mellon.kicad_pcb and its schematic Mellon/Mellon.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Mellon design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

Similar boards

  • 4 layers85 × 54 mmPECDR, the printed circuit board in 3D

    PECDR

    pedro-ibs/trekking

    Desenvolvimento de um robô rádio-controlado/autônomo da moralidade “tracker”

    68 parts9
  • 2 layers78.7 × 58.4 mmAGV SENSOR PCB 2, the printed circuit board in 3D

    AGV SENSOR PCB 2

    Ashutoshkarve007/STM32_Learning

    Learining STM32

    53 parts3
  • 2 layers172.7 × 114.3 mmModules, the printed circuit board in 3D

    Modules

    DarekKrawczyk/MastersThesis

    System to support management and control of plant cultivation

    115 parts3
  • 4 layers73.7 × 76.2 mmMotherboard, the printed circuit board in 3D

    Motherboard

    bfrigon/alarm-clock-hardware

    Alarm clock

    92 parts2GPL-3.0
  • 2 layers92 × 88 mmBattery Board, the printed circuit board in 3D

    Battery Board

    bluesatunsw/rocketry-datasat

    Cubesat-shaped data collection payload for Rocketry's Griffon rocket

    34 parts2GPL-3.0
  • 6 layers106.5 × 103 mmTURBINADA, the printed circuit board in 3D

    TURBINADA

    GoncaloMark/Turbina

    Componente Hardware e Software para Turbinas Tesup carregarem baterias de 12V.

    49 parts
  • 2 layers119 × 64.9 mmSmartplug, the printed circuit board in 3D

    Smartplug

    rileylyman/smart-plug-pcb

    19 parts
  • 2 layers53.9 × 29.7 mmWind transmitter, the printed circuit board in 3D

    Wind transmitter

    pypilot/pypilot_mfd

    lcd display for various types of marine data including nmea0183, signalk and pypilot

    43 parts4