Code Monkey home page Code Monkey logo

rfidtool / esp-rfid-tool Goto Github PK

View Code? Open in Web Editor NEW
474.0 37.0 91.0 1.73 MB

A tool for logging data/testing devices with a Wiegand Interface. Can be used to create a portable RFID reader or installed directly into an existing installation. Provides access to a web based interface using WiFi in AP or Client mode. Will work with nearly all devices that contain a standard 5V Wiegand interface. Primary target group is 26-37bit HID Cards. Similar to the Tastic RFID Thief, Blekey, and ESPKey.

License: MIT License

C++ 79.79% C 16.85% PHP 3.36%
rfid card reader wiegand hid access-control pentest-tool facility-security physical-security

esp-rfid-tool's Introduction

ESP-RFID-Tool

By Corey Harding

Logo

Official website:

Board
April Brother is currently manufacturing this hardware and it can be purchased direct from China from their  

Third Party Distributors:

Video Demos of Capturing Credentials using various technologies that utilize a Wiegand Interface:  

Firmware:  

Intended use cases

  • Security researchers performing red team assessments.
    • Capturing card values to later be cloned.
    • Replaying raw binary captures.*(see note below)
    • Fuzzing access control systems.*(see note below)
    • Brute forcing PIN codes.*(see note below)
    • Denial of Service mode.*(see note below)
  • To create a standalone device for capturing credentials or testing badges and or card readers without the need for a Wiegand Controller.
    • Add a battery and a card reader to make the unit portable.
    • Add a benchtop power supply to use for testing hardware.
  • Installers troubleshooting issues with a card reader, the data lines, or even testing for a faulty card.
  • Useful for merchants or surplus resellers who are testing if access control equipment is functional.
  • Hobbyist experimenting with various systems that utilize a Wiegand Interface.
  • Simulating an access control system using multiple units of ESP-RFID-Tool.
  • RFID-Tool is not intended to be used in any unlawful manner.

What is it?

A universal data logger that captures the raw binary data from a standard 5V Wiegand Interface. The device is capable of logging the credentials for access control systems or nearly any device that utilizes a Wiegand Interface such as RFID card readers, pin pads, magnetic stripe systems, barcode, and even some biometric readers. Wiegand Interfaces also do not have to be limited to just access control systems. The main target group for this device is 26-37bit HID cards. For known card types both the binary and hexadecimal data is displayed directly in the log file for easy badge identification and also in case a clone of a card may be needed. For unknown card types only the raw binary data is shown.

How do you install it?

The device may be installed directly into an existing system drawing its power from the preexisting wiring or it can also be used to turn a reader into a standalone portable unit for data logging when a battery is added. Wiring is simple and consists of 4 wires, (+), (-), D0(Green), and D1(White). The device is capable of operating on voltages ranging from around 4.5V up to a maximum of 12v. Commonly found voltages are 12V and 5V. **(See Installation Notes Below)

How do you access the logs?

Access to the log files and various settings is provided via a web based interface. The device has WiFi capabilities and can be set up to spawn its own access point or set to connect to an existing network. In the event you get locked out of the web interface you can bridge the J3 jumper on power up or while resetting the device to regain access without losing your log files.

I want to know a little more...

The hardware is based on an ESP12 WiFi chip with a full TCP/IP stack and Microcontroller Unit. The software is open source licensed under the MIT License and will be released the day the product is launched. The software will reside in this GitHub repo so it may be reviewed by the community. We will accept various pull requests from the community after being reviewed if it improves the value of the device for others. The software was written in the Arduino IDE so both hobbyist and professionals will have no issue modifying the code if they so choose. A Wiegand Interface operates using 3 wires, a ground, Data0, and Data1. A zero is sent when D0 goes low and a one is sent when D1 goes low, the other line remains high during this time. The timing is 40uS from low to high on a line with 2mS between bits. The software logs this binary output to a file and if the device thinks it is a known card format the preamble is guessed(not sent by card reader but it is the same for all cards of a specific format, our primary target is 26-37bit HID cards) and both the raw binary and hexadecimal data is logged. For unkown card formats only the raw binary output is logged with no guess at the preamble and without showing the data in hexadecimal format to prevent confusion. If you know what kind of card was captured, simply look up the preamble and add it to the beginning of the binary then typically convert it to hexadecimal format to make a clone of a card. It is possible the card is actually an unknown format and the preamble was guessed incorrectly with the device thinking it was a known card format(the guess is based on the bit count output by the reader), if this is the case in the log file there is a literal space in the binary between the preamble and the card data, simply ignore the preamble. When replaying a captured credential*(see note below) you do not include the preamble as that is not output by the card reader but instead you only replay*(see note below) the actual card data as output from the reader. You only need to worry about the preamble if making a clone of a card. The primary function of this device is for logging the raw binary data as output from a Wiegand Interface. You can read from 1 bit all the way up to 4,096 bits. The default buffer setting only allows 52 bits and must be manually increased from the settings page accessible from the web interface.

*Experimental TX Mode

The device was made with minimal hardware to keep costs extremely low and in reach of hobbyist and also so security professionals can buy multiple units and also use them without the fear of losing a unit. This being said there are no level shifters on the board.(It is possible that in the future a PRO version may be released) This means that with the current hardware the device can work with a 3V3 Wiegand Interface as well as a 5V Wiegand interface because the hardware operates at 3V3 and is also 5V tolerant. The drawback of this is that not all 5V Wiegand controllers are guaranteed to be triggered when replaying or fuzzing data because only 3V3 is output from the device. There is also a risk when the device is in TX mode and the output goes low for 40uS, if the device were to also receive data during this time there will be a short. For this reason be sure that absoulutely no cards are being scanned while the device is in TX mode. The device does not go into TX mode until you press on a form submit button and as soon as the data is done being transmitted it goes back into listening mode. For the reasons above TX mode is for experimental use only and was designed primarily for easily debugging the software when making changes.(two units were tied together)
Use transmit mode at your own risk, it is not officially supported. Consider it a bonus in the software.

**Installation Notes

Click here for wiring diagrams
Click here to see connector options

  • Make sure the reader outputs data in the Wiegand format
  • Connect D0 on device to D0 on reader
  • Connect D1 on device to D1 on reader
  • Connect + on device to + on reader
  • Connect - on device to - on reader
    • The ESP-RFID-Tool accepts 4.5-12v but you must also be sure to supply enough voltage and current to power your reader if creating a standalone or portable unit.
    • SAFETY: It has come to my attention that the voltage regulator used on the commercially available units that you may find for sale is different than the voltage regulator I originally chose for this project. Also due to global chip shortages and the possibility of manufacturers substituting components I am downgrading the absolute maximum voltage rating to 12v as in you may be stressing the unit to its limits at this voltage and extra care should be taken. Most of my smaller portable prototypes ran at around 9v(x6 AA Batteries) and I found this to be more than adequate, remember that you can always power your reader and the RFID-Tool unit separately if needed and I suggest supplying your project with the lowest possible voltage that you can get away with. In fact, I have found multiple readers that run just fine at less than the recommended voltage. Note that I did not notice a significant range increase in my original testing between supplying 12v and 24v to my reader(I do not recommend this as I tend to abuse the specs for what I am testing, and I was using a different voltage regulator in my prototype). Also be advised that most commonly used batteries produce more than the commonly stated nominal voltage at a full charge. It may also be a good idea to apply a heatsink to your voltage regulator especially if you notice that the unit runs hot at your chosen voltage. It is also never recommended to leave your device unattended. Please be safe and take all necessary safety precautions when testing your setup.
    • OPTIONAL: Connect 4.5-12v battery into the same + and -(only if building a portable unit, do not add a battery if implanting device into an existing installation, or if you do use a battery do not connect the + wire from the existing installation to your device, only tie in the GND -)  
    • NOTE: At a minimum D0, D1, and GND(-) must be connected to the reader for proper function, no matter the power source.
  • Configure settings
    • See Below

Making Sense of the Binary Data

Keypads
Magstripe/ABA Format

Flashing Firmware

OPTION 1: OTA via the Web Interface:

OPTION 2: Arduino IDE:

Software Help

Accessing ESP-RFID-Tool Web Interface

SSID: "ESP-RFID-Tool"
URL: http://192.168.1.1

Configure ESP-RFID-Tool

Default credentials to access the configuration page:

  • Username: "admin"
  • Password: "rfidtool"

Default credentials for ftp server:

  • Username: "ftp-admin"
  • Password: "rfidtool"

WiFi Configuration:

Network Type:

  • Access Point Mode: Create a standalone access point(No Internet Connectivity-Requires Close Proximity)
  • Join Existing Network: Join an existing network(Possible Internet Connectivity-Could use Device Remotely)

Hidden: Choose whether or not to use a hidden SSID when creating an access point

SSID: SSID of the access point to create or of the network you are choosing to join
Password: Password of the access point which you wish to create or of the network you are choosing to join
Channel: Channel of the access point you are creating

IP: IP to set for device
Gateway: Gateway to use, make it the same as ESP-RFID-Tool's IP if an access point or the same as the router if joining a network
Subnet: Typically set to 255.255.255.0

Web Interface Administration Settings:

Username: Username to configure/upgrade ESP-RFID-Tool
Password: Password to configure/upgrade ESP-RFID-Tool

FTP Server Settings:

Note: Supports Passive(PASV) Mode Only!

  • Enabled: Turn FTP Server ON
  • Disabled: Turn FTP Server OFF
    Username: Username to login to ftp server
    Password: Password to login to ftp server

Power LED:

  • Enabled: Turn ON Power LED
  • Disabled: Turn OFF Power LED

RFID Capture Log:

Useful to change this value to differentiate between facilities during various security assessments.
File Name: File name to save captured RFID tags to for the current security assessment.

List Exfiltrated Data

Displays all log files containing RFID tag captures.

Format File System

This will erase the contents of the SPIFFS file system including ALL RFID tag captures.
Formatting may take up to 90 seconds.
All current settings will be retained unless you reboot your device during this process.

Upgrade ESP-RFID-Tool Firmware

Authenticate using your username and password set in the configuration page.

Default credentials to access the firmware upgrade page:

  • Username: "admin"
  • Password: "rfidtool"

Select "Browse" choose the new firmware to be uploaded and then click "Upgrade".

You will need to manually reset the device upon the browser alerting you that the upgrade was successful.

Jumpers

  • J1: Bridge to reset the board(your FTDI doesn't have a reset button?)
  • J2: Cut the trace to disable DTR pin after programming then use it as an additional IO(continue updating firmware via web interface)
  • J3: Bridge this during a power cycle to restore default configuration without losing your log files.

Restore Default Settings

  • Option 1: Go to settings under web interface and choose restore default configuration.
  • Option 2: Bridge J3 before booting the device. (Either before powering on or bridge it and reset the device)
  • Option 3: Connect via serial(9600 baud) and send the command "ResetDefaultConfig:" without quotes.

History

I pushed the design for the original prototype to GitHub back in September of 2016 albeit under a different repo. I was using an Adafruit Feather Huzzah running some code that I had modified porting the Tastic RFID Thief(by Fran Brown from Bishop Fox) to the ESP12S chip. At the time no sort of Wiegand logger existed offering WiFi capabilities and providing an easy to use web interface for accessing the log files.(I could not find one so I created it) During the second evolution of the project I decided to design dedicated hardware and I lightly upgraded the software. It was open source hardware and it was out there on GitHub but still not easily available to the masses. Not everyone is confident in surface mount soldering and even for me it was time consuming assembling boards for personal use. It was then that I realized there is a need for an affordable device like mine to be mass produced so anyone that has a legitimate for need one can have access to it. During the third stage I redesigned both the software and the hardware and decided to contact April Brother to see about them manufacturing it and selling it for a fair price. That is when ESP-RFID-Tool was born.

Licensing Information

Created by Corey Harding
https://github.com/rfidtool/ESP-RFID-Tool
ESP-RFID-Tool software is licensed under the MIT License

Libraries/borrowed code being used

Arduino and ESP8266 core libraries
  • Typically: GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
    • Assorted Authors
ArduinoJson.h
  • The MIT License (MIT)
    • Copyright (c) 2014-2017 Benoit BLANCHON
ESP8266FtpServer.h
  • GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
    • Originally by nailbuster, later modified by bbx10 and apullin
WiegandNG.h
  • GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
    • JP Liew
Wiegand Preamble Calculator Code
  • No License Specified
    • Fran Brown of Bishop Fox
strrev.h
  • Custom License(see file)
    • Copyright (c) 2007 Dmitry Xmelkov
aba-decode.py
  • No License Specified
    • Andrew MacPherson(andrewmohawk)

esp-rfid-tool's People

Contributors

corey-harding avatar exploitagency avatar rfidtool avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp-rfid-tool's Issues

Doesn't read properly

I connected it to a 125khz ID wg26 reader but when it read i first converted the hex number to decimal and it didn't match the real number. I also tried to get some number of the binary data with no luck as well. I don't know, maybe my device is faulty. It restarts every time i read and i have to connect the wifi again. Or i don't know how to get the decimal number of the card. This is my log file. The last (underlined) reads are of a card with the number 0008617284. I will be very thankful if someone could give me some much needed help.
20210120_112631
16111351372634130453558213782740

Questions about replay attacks

Hello,
Is ESP RFID Tool able to replay or clone 13.56 MHz and 125 kHz RFID cards/tokens? Or it's used for different things. I am interested into buying one if so.
Best regards,
Ben.

Problem with logging

Hi!

Do anyone know why i could have problems with esp-rfid-tools not logging properly?

Sometimes it manages to read a card but after I have checked the log and then tries to read a new card it does not work. I have tried to both clear the log and keep it. but that doesn't seem to make a difference.

Does anyone have a tip?

Thanks in advance for your help!

Latest build generates random data constantly

I've used this in the past and in the initial out of the box setting (1.02 I think) it works like a champ. When I upgrade to firmware 1.21 I get constant random data in the logs. Anyone else have this issue?

Configure settings

im not able to configure settings to capture Wiegand 34 bit. I cant get the whole DATA of EM4100.

If i convert Wiegand 26 bit i get only xxxxA1A2A3, (A1A2A3 = HEX DECIMAL) which u need to know the unkown hexdecimal (xxxx) the 4 first hex decimal, in order to clone EM4100 u need 10 HEXDECIMAL digits. its a shame that u cannot capture EM4100 in ESPRFIDTOOL.

and one thing buggy is that u need to ignore the parity bit and even parity like the first bit and the last bit should be ignored to get the correct of HEX DECIMAL. i have been studied this like 3 days in a row.

Unable to default unit

I changed the settings of the unit to connect to another network, it did not connect to the network and now the device is undetectable via WIFI. I have attempted to factory default the unit using the jumpers as detailed in the "Read Me" I have the version without the button only having the 4 jumpers. any assistance on this would be appreciated as I was using this for checking outputs from custom data maps on readers.

Unable to flash self-compiled source

Hi, I am attempting to test some modifications to the code (will PR when ready). However, I have been unable to get any image that I compile to run successfully. When I compile even master (unchanged) from this repo, the resulting flash attempt results in a "bricked" RFID Tool. I can use esptool.py to flash the last release bin and it works without issue. I assume the settings in my Arduino IDE are not accurate, but in spite of tweaking these settings a bunch of times, I can't seem to get something that works. Was hoping you could provide more information on what settings you are using to compile the official releases. I'm currently using Arduino IDE 1.8.15. I am using the board definition "NodeMCU 1.0 (ESP-12E Module)" from https://arduino.esp8266.com/stable/package_esp8266com_index.json.

Leaving all other settings as default (though I've also tried tweaking the FS/OTA settings).

One thing I've noticed, the last official bin from this repo looks like this when I look at the image with esptool.py:

python esptool.py image_info esprfidtool.bin
esptool.py v3.0
Image version: 1
Entry point: 4010f29c
1 segments

Segment 1: len 0x00568 load 0x4010f000 file_offs 0x00000008 []
Checksum: 2d (valid)

Whenever I generate an image it has two segments:

python esptool.py image_info esprfidtool.ino.nodemcu.bin
esptool.py v3.0
Image version: 1
Entry point: 4010f494
2 segments

Segment 1: len 0x00d84 load 0x4010f000 file_offs 0x00000008 []
Segment 2: len 0x00028 load 0x3fff20b8 file_offs 0x00000d94 [DRAM]
Checksum: c9 (valid)

ESP RFID Tool no longer capturing successful card swipes.

The ESP RFID Tool was able to read several test cards from the HID multiCLASS reader to a UHPPOTE controller. The successful reads/captures can be observed below. However, the ESP RFID Tool is unable to read the same cards, also observed below. Would gladly welcome any troubleshooting ideas...

37 bit card,7 bit preamble,Binary:0000000 0010110010110111001000110010011011111,HEX:596E464DF
37 bit card,7 bit preamble,Binary:0000000 0010110010110111001000110010011011111,HEX:596E464DF
37 bit card,7 bit preamble,Binary:0000000 0010110010110111001000110010011011111,HEX:596E464DF
37 bit card,7 bit preamble,Binary:0000000 0010110010110111001000110010011011111,HEX:596E464DF
37 bit card,7 bit preamble,Binary:0000000 0010110010110111001000110010011011111,HEX:596E464DF
32 bit card,12 bit preamble,Binary:000000100001 00111101010001110011110111101100,HEX:213D473DEC
Unknown 2 bit card,Binary:10
Unknown 1 bit card,Binary:1
Unknown 1 bit card,Binary:1
Unknown 1 bit card,Binary:1
Unknown 2 bit card,Binary:11
Unknown 1 bit card,Binary:1
Unknown 6 bit card,Binary:111111
Unknown 2 bit card,Binary:11
Unknown 1 bit card,Binary:1
Unknown 17 bit card,Binary:00000000000000000
Unknown 17 bit card,Binary:00000000000000000
Unknown 17 bit card,Binary:00000000000000000
Unknown 17 bit card,Binary:00000000000000000

Hex conversion in log view is wrong

Log entry:

34 bit card,10 bit preamble,Binary:0000001001 0000001000110101100101000000100101,HEX:2408D65025

This is full wiegand data, but card number is not 2408D65025, correct card number can be calculated, if we eliminate first and last bit from card number part:

  • 0000001000110101100101000000100101 -> 00000100011010110010100000010010
  • 00000100011010110010100000010010 -> 046B2812

Unable to contribute due to legacy toolchain 'DynamicJsonBuffer is a class from ArduinoJson 5'

Hello
I've tried to follow the guide and add depdendencies:


    ArduinoJson library 5.13.1 by Benoit Blanchon
        https://github.com/bblanchon/ArduinoJson
    ESP8266FtpServer.h
        https://github.com/exploitagency/esp8266FTPServer/tree/feature/bbx10_speedup

Added the first lib directly from Arduino IDE, and the second via exported ZIP file of above URL. This resulted in compilation error:

In file included from /Users/User/src/ESP-RFID-Tool/Source Code/esprfidtool/esprfidtool.ino:605:
/Users/User/src/ESP-RFID-Tool/Source Code/esprfidtool/api.h:43:11: error: DynamicJsonBuffer is a class from ArduinoJson 5. Please see https://arduinojson.org/v7/upgrade-from-v5/ to learn how to upgrade to ArduinoJson 7
   43 |   DynamicJsonBuffer jsonAPIbuffer(bufferSize);

So my question is are those custom library variants really needed, can we make anything that software will be more maintanable ? I'm Arduino newbie but is there no way to add those dependencies as a reference to Sketch file instead of encouraging developer to manually do so ? This way this could could still be contributed

Started burning at 18V

See title. I'm assuming the module that started burning is the step-down converter. Had 3x4 battery packs with 1,5V batteries connected in series.

Board gets quite hot overall even when running with 12V - probably due to the WiFi module and the small board not being able to dissipate heat.

Just wanted to bring it up, as I think it should be mentioned in the README.md - in case someone plans to build this to carry in e.g. their backpack.

rfid-tool-fire

192.168.4.1 filenotfound after update

I am new to the ESPKEY.
Initial setup via 192.168.1.1 went good. Scanned a few cards successfully. I tried to load the latest firmware but after reboot, the device creates an access point ESPKey-xxxxxx where x=mac and this time up address 192.168.4.100
When I try to open the index at 192.168.4.1
I get a window that says "file not found"

Question - How do I reload a good config as a reset or default only loads the config I updated.

Do I need a programming device connected via serial to reflash?

Thankyou

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.