L-1 Identity Solutions PIER™ 2.3 Software Analysis

updated 24 min read #biometrics #reverse engineering

Contents

Introduction#

This is the second of three posts about the SecuriMetrics / L-1 Identity Solutions PIER™ 2.3 handheld iris scanner. Part 1 is the hardware teardown, part 3 runs the software from this card in an emulator. This post covers everything on the 256 MB CompactFlash card: how the device boots, which operating system it runs, what the application does, how it is configured, how it stores iris templates, and which network services it offers.

All findings come from a read-only image of the card and from reading the code. Apart from booting the card in plain QEMU, I did not run anything for this post; running the application is the subject of part 3. The card still contains enrolment records and iris templates of real people. I only describe their structure here. For copyright and privacy reasons, I will not publish the image.

The CompactFlash image#

To get the image, I removed the card from the device, put it into a card reader and made a bit-exact copy with dd (in my case the card was /dev/sdb; check with lsblk):

# dd if=/dev/sdb of=/root/pier.img

The card has a classic MBR partition table with one active FAT16 partition:

$ sfdisk -l pier.img
Disk pier.img: 245 MiB, 256901120 bytes, 501760 sectors
Units: sectors of 1 * 512 = 512 bytes

Device     Boot Start    End Sectors   Size Id Type
pier.img1  *       32 501247  501216 244.7M  6 FAT16

The partition starts at sector 32, i.e. at byte offset 32 × 512 = 16384. You do not need root or a loop mount to read it; mtools can access the partition directly:

$ export MTOOLS_SKIP_CHECK=1
$ minfo -i pier.img@@16384 ::      # boot sector: OEM "MSDOS331", 8 sectors/cluster, 2 FATs
$ mdir -/ -i pier.img@@16384 ::    # recursive listing
$ mcopy -s -p -m -i pier.img@@16384 ::/* ./fs/   # copy everything out, keeping dates

Alternatively, mount it read-only as a loop device:

# mount -o ro,loop,offset=16384 /root/pier.img /mnt

The file system holds 159 files in 7 directories, all with 8.3 file names [wikipedia.org]. The application, its configuration files and the screen bitmaps sit in the root directory.

DirectoryContents
\ (root)Boot files, application executables (PV11.EXE, PR156.EXE … PR167.EXE), DLLs, FPGA bitstream, configuration files, 40 screen bitmaps
BACKUPFactory default configuration. Copying these files to the root resets the device
DATAThe two database files RECFIL1K.F02 (records) and MASTER1K.F02 (IrisCodes), plus UPDATED.TXT/XUPDATED.TXT (updated=1)
DOSUtilities of General Software’s Embedded DOS-ROM (FDISK, FORMAT, HIMEM, ROMDRIVE.SYS, a packet driver …)
HTMLPhar Lap’s MicroWeb sample files and a small “live video” demo page
IMAGESEmpty. Target directory when the operator saves eye images (c:\images\<name><n>.bmp)
TMPEmpty. The application doesn’t reference it; temporary files go to a RAM disk (D:)
UTILFactory tools: Realtek EEPROM programmer and configuration, MAC-address tools, PCI tool, PKZIP
text Complete file listing (size in bytes, FAT timestamp)
240X320.BMP                77878  1980-01-01  0:00
ADVASCRN.BMP               77878  2005-10-31 13:57
AUTOEXEC.BAT                1624  2008-05-06  8:17
AUTOEXEC.FPY                 640  2003-01-01  0:00
AUTOEXEC.HD                  640  2003-01-01  0:00
BACKUP/8139C.CFG            4481  2003-01-01  0:00
BACKUP/CMSETUP.I2C          3177  2003-01-01  0:00
BACKUP/MFGONCE.BAT           106  2003-01-01  0:00
BACKUP/NET.INI              1134  2004-01-29 15:00
BACKUP/NET.INS              1134  2004-01-29 15:00
BACKUP/NET.MFG              1134  2004-01-29 15:00
BACKUP/NETDIG.INI           1134  2004-01-29 15:00
BACKUP/NETVID.INI           1134  2004-01-29 15:00
BACKUP/STRTONCE.BAT          118  2003-01-01  0:00
BACKUP/STRTONCE.CMD           74  2003-01-01  0:00
BACKUP/WATTCP.CFG            287  2003-01-28  0:00
BACKUP/WATTCP.MFG            287  2003-01-01  0:00
BACKUP/X8139C.CFG           4481  2003-01-01  0:00
CMSETUP.I2C                 3177  2003-01-01  0:00
COMMAND.COM                64009  2004-01-19 18:03
DATA/MASTER1K.F02        1009664  2008-01-03 12:59
DATA/RECFIL1K.F02         126208  2008-01-03 12:59
DATA/UPDATED.TXT              11  2005-09-14 14:02
DATA/XUPDATED.TXT             11  2005-11-07 13:04
DEMOAI.DLL                 20480  2003-01-01  0:00
DISKMON.BIN                31650  2008-05-06  8:17
DISKMON.STD                31638  1980-01-01  0:00
DISKS24.BIN                31638  2003-11-30 17:40
DLLTABLE.DLL                1584  2003-01-01  0:00
DOS/ANSI.SYS                4674  2003-01-01  0:00
DOS/ATTRIB.EXE             11011  2003-01-01  0:00
DOS/CHKDSK.EXE             22379  2003-01-01  0:00
DOS/COMMAND.COM            64009  2003-01-01  0:00
DOS/DELTREE.EXE            10547  2003-01-01  0:00
DOS/DISKCOMP.EXE           12771  2003-01-01  0:00
DOS/DISKCOPY.EXE           13633  2003-01-01  0:00
DOS/DISKVIEW.EXE           11037  2003-01-01  0:00
DOS/DOS.SYS                40132  2003-01-01  0:00
DOS/EMM386.EXE              2904  2003-01-01  0:00
DOS/FDISK.EXE              23775  2003-01-01  0:00
DOS/FIND.EXE               11365  2003-01-01  0:00
DOS/FORMAT.EXE             23779  2003-01-01  0:00
DOS/GETKB.EXE               9707  2003-01-01  0:00
DOS/HIMEM.SYS               7696  2003-01-01  0:00
DOS/INSTBOOT.EXE           73229  2003-01-01  0:00
DOS/INTERSVR.EXE           15271  2003-01-01  0:00
DOS/LABEL.EXE              10087  2003-01-01  0:00
DOS/LOADHIGH.EXE           12849  2003-01-01  0:00
DOS/MEM.EXE                16933  2003-01-01  0:00
DOS/MODE.EXE               13663  2003-01-01  0:00
DOS/MORE.EXE                9523  2003-01-01  0:00
DOS/POWER.SYS               2434  2003-01-01  0:00
DOS/RAMDISK.SYS             6224  2003-01-01  0:00
DOS/ROMCLONE.SYS            2242  2003-01-01  0:00
DOS/ROMDRIVE.SYS            3298  2003-01-01  0:00
DOS/RTSPKT.COM             33648  2003-01-01  0:00
DOS/SERDRIVE.SYS            7970  2003-01-01  0:00
DOS/SETNET.EXE             10021  2003-01-01  0:00
DOS/SHARE.EXE               8427  2003-01-01  0:00
DOS/SORT.EXE               10809  2003-01-01  0:00
DOS/SYS.EXE                15031  2003-01-01  0:00
DOS/TREE.EXE               10327  2003-01-01  0:00
DOS/VDISK.SYS               3344  2003-01-01  0:00
DOS/VDRIVE.SYS              5586  2003-01-01  0:00
DOS/XCOPY.EXE              21537  2003-01-01  0:00
DOS.SYS                    40132  2004-01-19 18:03
DOSBOOT.EXE                47533  2003-01-01  0:00
E1STSCRN.BMP               77878  2008-05-06  8:17
E2NDSCRN.BMP               77878  2008-05-06  8:17
ENRLSCRN.BMP               77878  2005-10-31 13:57
ENRTSCRN.BMP               77878  2005-10-31 13:57
F.BAT                         19  2003-01-01  0:00
FTP.CMD                       76  2003-01-01  0:00
FTP.EXE                    54995  2003-01-01  0:00
HELP1.BMP                  77878  2003-12-08 15:16
HELPF1.BMP                 77878  1980-01-01  0:00
HELPF2.BMP                 77878  1980-01-01  0:00
HELPF3.BMP                 77878  1980-01-01  0:00
HELPF4.BMP                 77878  1980-01-01  0:00
HELPF5.BMP                 77878  1980-01-01  0:00
HELPF9.BMP                 77878  1980-01-01  0:00
HELPFN.BMP                 77878  1980-01-01  0:00
HELPMENU.BMP               77878  1980-01-01  0:00
HLPMENU2.BMP               77878  1980-01-01  0:00
HTML/HTMLTEST.C            23761  2003-01-01  0:00
HTML/HTMLTEST.DLL          21520  2003-01-01  0:00
HTML/IMAGE.JPG             20670  2003-01-01  0:00
HTML/INDEX.HTM               365  2003-01-01  0:00
HTML/PAUSE.GIF               991  2003-01-01  0:00
HTML/PLAY.GIF               1010  2003-01-01  0:00
HTML/SEARCH.HTM              689  2003-01-01  0:00
HTML/STOP.GIF                974  2003-01-01  0:00
HTML/XIMAGE.HTM              998  2003-01-01  0:00
HTML/YIMAGE.HTM             1310  2003-01-01  0:00
HTMLTEST.DLL               19440  2003-01-01  0:00
IRIS2PI.DLL               106496  2003-01-01  0:00
ISB8VERY.BIT               97732  1980-01-01  0:00
IVAJPEG.DLL               114688  2003-01-01  0:00
MACHINE.INI                  429  2005-10-31 17:00
MAINSCRN.BMP               77878  2008-05-06  8:17
MATRIX1.BMP                77878  1980-01-01  0:00
MATRIX2.BMP                82678  1980-01-01  0:00
MFGDONE.BAT                  171  2003-02-06  0:00
MLOGO240.BMP               77878  2005-10-31 13:57
MLOGO241.BMP               77878  2008-05-06  8:17
MLOGO242.BMP               77878  2008-05-06  8:17
NET.INI                      727  2004-02-10 17:42
NET.INS                     1134  2004-01-29 15:00
NET.MFG                     1134  2004-01-29 15:00
NET157.INI                   741  2004-02-10 17:42
NET164.INI                  2501  2008-05-05 16:02
NET167.INI                  2875  1980-01-04  1:48
NETDIG.INI                  1134  2004-01-29 15:00
NETVID.INI                  1134  2004-01-29 15:00
ONLDEBUG.DLL               36624  2003-01-01  0:00
PING.EXE                   38274  2003-01-01  0:00
PR156.EXE                1405248  2004-02-10 17:42
PR156B.EXE               1406176  2004-02-10 17:42
PR157.EXE                1421440  2004-02-10 17:42
PR164.EXE                1629648  2005-10-31 13:57
PR167.EXE                1650944  2008-05-06  8:17
PV11.EXE                 1406176  2004-02-10 17:42
PV11M157.ZIP              696839  2004-01-29 16:30
PV11UTIL.DLL               20480  2003-01-01  0:00
RCOGSCRN.BMP               77878  2005-10-31 13:57
RCOTSCRN.BMP               77878  2005-10-31 13:57
RUNIT.BAT                     24  2003-01-01  0:00
RUNNOW.BAT                    36  2003-01-01  0:00
RUNWAIT.BAT                   34  2003-01-01  0:00
SEBAD.BMP                  77878  2005-10-31 13:57
SECRSCRN.BMP               77878  2008-05-06  8:17
SECUSCRN.BMP               77878  2005-10-31 13:57
SEENAUTO.BMP               77878  2005-10-31 13:57
SEENROLL.BMP               77878  2005-10-31 13:57
SEGOOD.BMP                 77878  2005-10-31 13:57
SEMAIN.BMP                 77878  2008-05-06  8:17
SETMSCRN.BMP               77878  2005-10-31 13:57
SETRSCRN.BMP               77878  2008-05-06  8:17
SETSSCRN.BMP               77878  2005-10-31 13:57
SETUSCRN.BMP               77878  2005-10-31 13:57
SLOGO160.BMP               39478  1980-01-01  0:00
SLOGO240.BMP               77878  2005-10-31 13:57
SLOGO241.BMP               77878  2008-05-06  8:17
SLOGO242.BMP               77878  2008-05-06  8:17
SLOGO256.BMP               77878  1980-01-01  0:00
START0.BAT                   138  2008-05-06  8:17
STRTDONE.BAT                  57  2005-10-31 13:53
STRTONCE.BAT                  57  2005-10-31 13:53
UTIL/8139C.CFG              4446  2005-10-31 13:54
UTIL/PCITOOL.EXE           29628  2003-01-01  0:00
UTIL/PG8139.EXE            28972  2003-01-01  0:00
UTIL/PGEM.BAT                 24  2003-01-01  0:00
UTIL/PKUNZIP.EXE           29378  2003-01-01  0:00
UTIL/PKZIP.EXE             42166  2003-01-01  0:00
UTIL/SETMAC.EXE             9513  2003-01-01  0:00
UTIL/SETMACS.EXE            9577  2004-01-19 15:55
UTIL/X8139C.CFG             4481  2003-01-01  0:00
WATTCP.CFG                   287  2003-01-28  0:00
WATTCP.MFG                   287  2003-01-01  0:00

The timestamps tell a small story. The oldest files are dated 2003; dates of 1980 mean that the device’s clock was not set. The newest application, PR167, and its screens were copied onto the card on 6 May 2008. The database files were last written on 3 January 2008.

Boot chain#

The BIOS does not boot Phar Lap ETS directly: there is a small DOS in between.

  1. BIOS. A General Software BIOS in a socketed flash chip (CpuBIOS=Gsw112103 in MACHINE.INI).
  2. Embedded DOS-ROM. The BIOS boots DOS.SYS and COMMAND.COM from the CF card. Both are General Software’s Embedded DOS-ROM 6.22 (“Copyr(C)1990-1996 General Software, Inc.”), not MS-DOS. Its banner is the “Starting Embedded DOS-ROM…” at the top of the boot log below.
  3. AUTOEXEC.BAT. It sets the path, runs a one-time first-boot script if there is one, and calls START0.BAT.
  4. DOSBoot. START0.BAT runs dosboot diskmon.bin -appname PR167.EXE -nowaithost. DOSBOOT.EXE is Phar Lap’s loader (“DOSBoot: 10.0 – Copyright (C) 1986-2000 Phar Lap Software, Inc.”).
  5. ETS Monitor. DISKMON.BIN is the ETS Monitor 10.0, Phar Lap’s loader and debugging interface. It takes the machine out of DOS into 32-bit protected mode and loads the application from the disk.
  6. PR167.EXE. The application is a Win32 PE executable with the ETS kernel linked in (embedded kernel libraries, TCP/IP stack, file system). It doesn’t run under DOS; if you start it there, it prints “This program runs under TNT Embedded Kernel”.
bat START0.BAT
if not exist PR167.EXE goto start0b
dosboot diskmon.bin -appname PR167.EXE -nowaithost
goto done
:start0b
dosboot diskmon.bin
:done

PR167 also contains its own BIOS flasher (BIOSUPD). It expects a 256 KB image and a chip with JEDEC manufacturer ID 0xBF (SST). If c:\biosupd.bix exists at boot, it compares the file with the flash chip, programs it (saving the old BIOS as c:\oldbios.bin), deletes the file and reboots.

Plain QEMU boots the card image up to the ETS Monitor; it can’t emulate the PIER’s own hardware, so the application stops there. QEMU writes to the image, so always boot a copy, never your only dump.

text Boot log in plain QEMU
# qemu-system-i386 -drive format=raw,file=pier.img -m 128M -nographic

Starting Embedded DOS-ROM...

[C:\]prompt $p$g
C:\>rem c:\dos\getkb.exe 1 "1 for optional startup modes, 0 or kbhit is standard: "
C:\>rem if errorlevel 1 goto strttest
C:\>path c:\;c:\dos
C:\>if exist net.std copy c:\backup\net.ini net.ini
C:\>if exist net.std del net.std
C:\>if exist strtdone.bat goto start0b
C:\>goto start0b

C:\>if exist start0.bat call start0
C:\>call start0

C:\>if not exist PR167.EXE goto start0b

C:\>dosboot diskmon.bin -appname PR167.EXE -nowaithost
DOSBoot: 10.0 -- Copyright (C) 1986-2000 Phar Lap Software, Inc.
QEMU window showing the ETS Monitor 10.0 banner
ETS Monitor 10.0 running in plain QEMU

AUTOEXEC.BAT also contains a hidden factory menu (commented out by default):

bat AUTOEXEC.BAT (excerpt)
rem c:\dos\getkb.exe 1 "1 for optional startup modes, 0 or kbhit is standard: "
rem if errorlevel 1 goto strttest
...
:strttest
ask STRTMODE=Enter 1=stripped, 2=with packet, 3=mfg, 4=remfg...
...
:start3r
ask VIDMODE=Enter 1=analog video, 2=digital video...

The “manufacturing” path copies special configuration files (NET.MFG, NETVID.INI for an analogue camera, NETDIG.INI for the digital OV7120) into place. On the very first boot, STRTONCE.BAT programs the Ethernet chip’s MAC address from the device’s serial number (setmacs <serial>, then pg8139 /pci) and then renames itself to STRTDONE.BAT so that it never runs again.

Phar Lap ETS#

Phar Lap ETS® is a real-time operating system for x86 that implements a subset of the Win32 API, so developers can write and debug with Microsoft’s tools. Phar Lap Software [wikipedia.org] was founded in April 1986 and became known for DOS extenders. In September 2000 it was acquired by VenturCom, which renamed itself Ardence [wikipedia.org] in 2004. Citrix bought Ardence in 2006, and in 2008 former Ardence managers founded IntervalZero [wikipedia.org] and took over the embedded products (RTX and ETS). ETS was for a long time the operating system of National Instruments’ LabVIEW Real-Time targets, until NI ended support for it in favour of NI Linux Real-Time.

Ardence’s 2006 product sheet describes ETS like this:

  • “Smallest Operational Footprint: <500KB with I/O, graphics, and TCP/IP”
  • “Fully Win32 API Compliant: No need to use code wrappers for API mapping”. Elsewhere the same sheet says ETS “supports a robust subset of the Win32 API”.
  • “Real-time File System: High speed media access with FAT16 and FAT32 support”
  • “Complete IA32 X86 CPU Support: 386, 486, Pentium … Xeon, as well as AMD CPUs”
  • “Integrated Winsock Compliant Real-time TCP/IP Stack”
  • Deployable “in either monolithic or split kernel/application models”
ETS hierarchical component diagram: application on Win32 API, file system, TCP/IP, DLL loader, ETS kernel, ETS Monitor, BIOS, x86 hardware
ETS hierarchical component diagram (© 2006 Ardence, Inc.)

The PIER uses the monolithic model. The kernel, TCP/IP stack, FAT file system, FTP and HTTP servers and the application are link-located (Phar Lap’s LinkLoc) into one 1.6 MB executable. Even the kernel configuration, RTOS.INI, is embedded as a PE section. It sets up the second serial port (COM2, 9600 baud, 8N1). The only things loaded at run time are a few DLLs.

Phar Lap ETS – Real-time Operating System (Product Information) [pdf]

The application#

The card holds six versions of the application. Their PE linker timestamps show roughly four years of development:

FilePE timestampNote
PV11.EXE6 Feb 2004Oldest; also packed in PV11M157.ZIP
PR156.EXE, PR156B.EXE, PR157.EXE3–6 Feb 2004
PR164.EXE27 Sep 2004
PR167.EXE6 Dec 2007Started by START0.BAT

The comments in the configuration files list new options “for v160”, “v161”, “v162”, “v164” and “v166”, and PR167 itself reports “PV11 (release) v1.67, 06-Dec-2007” on its debug serial port (COM2) at startup. (MACHINE.INI still says SoftwareVersion=1.57.) In the setup menu, SelApp lets the operator choose which executable starts on the next boot (once or permanently) by rewriting START0.BAT. The menu knows 17 builds, PV11 to PR167 with “W” variants, but only six of them are on my card. It switches the whole application, not just the iris recognition algorithm.

Toolchain and modules#

PR167 was built with Microsoft Visual C++ 6.0 (its library paths point to …\Microsoft Visual Studio\VC98\LIB) against Phar Lap’s embedded libraries in c:\pharemb\lib. The shipped executable still contains its CodeView debug information, including the names of all object files. Leaving the debug information in a production build is unusual, and it makes the program structure easy to see:

  • User interface: HHMENU (handheld menu), IRISMENU, TSMENU (touch screen), ADMENU, PROCKEYP (keypad), LCDIO32, EPSON, OPTREX
  • Iris workflow: XENROLL, XRECOG, XSELECT, GETICODE, IMGPROC, BAYER, plus EYELIDSP, EYENESS, IRISLOCA, PUPCENTR, FFOCUS from an image library (iimglib.lib)
  • Security: SECURITY, AES, D3DES, BLOWFISH
  • Networking: RTL8139 (own Ethernet driver), FTPUTIL, WEBSERVE, Phar Lap FTPSERVE/HTTPSERV
  • Hardware and maintenance: BIOSUPD (BIOS flasher), I2CUTIL, PCIUTILS, DMAINTS, VPXAPI/VPXMENU

The iris engine itself is a separate DLL. IRIS2PI.DLL (PE timestamp 17 April 2000) exports exactly three functions, _TWOPI_ENROLL@52, _TWOPI_FOCUS@4 and _TWOPI_RECOG@64, which PR167 loads with LoadLibrary/GetProcAddress. This matches L-1’s marketing name, the “L-1 Daugman 2Pi algorithm”. IVAJPEG.DLL is the Independent JPEG Group’s libjpeg 6b (27 March 1998), used to save images as greyscale JPEG.

Screens#

The user interface is a set of 240 × 320 pixel, 8-bit bitmaps with text drawn on top. After power-on the device beeps and shows a splash screen. The card contains several variants: “Manufacturing Version” screens (MLOGO24x.BMP) and customer screens (SLOGO24x.BMP), each for the PIER 2.3 (128 MB) and the PIER 2.4 (256 MB). So one card image serves both models.

Splash screen: SecuriMetrics logo, 'Manufacturing Version', Pier 2.3, 128M, patent list
Splash screen MLOGO241.BMP (Manufacturing Version, PIER 2.3, 128 MB)
Splash screen: SecuriMetrics logo, Pier 2.4, 256M, list of eight US patents
Splash screen SLOGO242.BMP (PIER 2.4, 256 MB) with the list of patents

The splash screen lists eight US patents:

  • 5,291,560: Daugman’s iris recognition patent, assigned to IriScan; Google Patents lists it as expired
  • 5,953,440 and 5,978,494 (Sensar): focus measurement and choosing the best enrolment image
  • 6,028,949: verifying that an eye is present
  • 6,252,977 (Sensar): imaging eyes through eyeglasses
  • 6,289,113 (Iridian): handheld iris imaging apparatus
  • 6,532,298 (Iridian): portable authentication device using iris patterns
  • 6,753,919 (Iridian): fast focus assessment

The main menu offers recognition (F3 or touch), enrolment (F4), help (F7), setup (F8) and status (F9). The status menu shows a summary, battery, free disk, network, equipment and software information, and can beep or halt the device.

Main menu with F3 Recog, F4 Enroll, F7 Help, F8 Setup, F9 Status and a large RECOG button
Main menu (MAINSCRN.BMP)

The help system was never finished. Only HELP1.BMP contains an actual overview. The bitmaps for the individual help pages (HELPF1.BMP to HELPF9.BMP, HELPFN.BMP, HELPMENU.BMP, HLPMENU2.BMP) are all the same orientation test card. That is why every help link on my device led nowhere.

Help overview screen listing function keys
Help overview (HELP1.BMP)
Placeholder test image with the words TOP, LEFT, RIGHT and BOTTOM
What every help page actually shows (HELPF1.BMP)

The setup screen sets date, time and network address, saves images, runs chkdsk, selects the application (SelApp), reboots the device and opens the security menu. To use DHCP, you enter 255.255.255.253 as the IP address. The firmware itself says: “Note: 255.255.255.253 means USE DHCP during manual specification”. A manufacturing variant of the screen (SETMSCRN.BMP) adds “Manuf” functions: serial number, A/D calibration, “Disable Mfg Mode”.

Setup screen with Date, Time, Network, SaveFlag, Reboot, SelApp, ChkDsk, Security
Setup screen (SETSSCRN.BMP)
Manufacturing setup screen with Date, Time, Network, SaveFlag, ClearData, Reboot, SelApp, ChkDsk, Manuf
Manufacturing setup screen (SETMSCRN.BMP)

The security screen can clear the database, enter a master key, encrypt the database and reload it. The 2008 version of the screen adds “Restrict Login”.

Security screen with Clear Database, Enter Master Key, Encrypt Database, Reload Database, Restrict Login
Security screen (SECRSCRN.BMP, 2008)

To enrol, the operator previews the eye with F2/F5 (or a touch), holds the key to acquire images and then types in the person’s data. The device can then ask for the second eye. The “Advanced” menu (F7) can run recognition or enrolment on the acquired images and save them to disk. Behind the scenes the software reports quality values: iris and pupil centre and radius, the number of usable code bits, the percentage of visible iris, focus and a quality score. Part 3 shows the whole flow in the emulator, with the quality checks and the match screen.

Enroll menu: Click F2/F5 or Touch for Preview, Hold to Acquire, F1/F6 to Exit, F7 for Advanced
Enroll menu (ENRLSCRN.BMP)
Advanced menu with options to recognise or enrol acquired images and save images to disk
Advanced menu (ADVASCRN.BMP)

Recognition works the same way. On a match, the device shows the stored name, eye and ID and the Hamming distance (hd=); the firmware also has a “Time=… secs” output, which the match screen in the emulator did not show.

Recog menu: Click F2/F5 or Touch for Preview, Hold to Acquire, F1/F6 to Exit, F7 for Advanced
Recognition menu (RCOGSCRN.BMP)

The user interface is simple and has no complex graphics, which is surely good for the intended use. Except for the big grey button and “touch to preview”, the touchscreen is hardly used; almost everything goes through the keypad. The software feels like a console program that later got a display. Many test and debug menus still print to a console (“Swapping to host console”). Weird, but functional.

Configuration#

The application reads its settings from an INI file in the root directory. There are several generations: NET.INI, NET157.INI, NET164.INI and NET167.INI, with the factory defaults in BACKUP. NET167.INI documents the newer options in comments:

ini NET167.INI (excerpt, network address redacted)
TCPaddress=10.x.x.x
Autostart=3
UseDigitalCamera=7120
bitFileName=isb8very.bit
logoFileName=slogo240.bmp
;if 0, don't automatically save images
hhSaveImages=0
;New for v161 for host/pier sync using ftp files
hhDataUpdate=1
;New value for v162
; 0: disables tethered mode
; 1: enables tethered mode
; 2: enables tethered mode and completely disables keypad if untethered
hhTetheredMode=1
;New value for v162
; 0: for no secure login (like all previous versions)
; 1: for non-encrypted secure login, non-encrypted iriscodes
; 2: for encrypted secure login, non-encrypted iriscodes
; 3: for encrypted secure login, encrypted iriscodes
hhSecureLogin=0
;New value for v162
; 0: use old format for status.txt
; 1: use XML format
hhUseXML=1
;New value for v162, default is shadow if unspecified
szPassword=shadow
;New valuess for v166, default if unspecified is hhLongCodes=1
; 0: short codes, 64 byte record, masterfi.f02, recfile.f02
; 1: long codes, 128 byte record, master1k.f02, recfil1k.f02
; 2: dual short codes, 128 byte record, masterfd.f02, recfiled.f02
; 3: dual long codes, 128 byte record,  maste1kd.f02, recfi1kd.f02
hhLongCodes=1
hhRestrictedLogin=0

MACHINE.INI is a hardware profile: model B1-001, ElanSC520 at 133 MHz, SanDisk flash, the three board part numbers, BIOS Gsw112103, camera 7120 with an 18 MHz clock and a 16 mm lens, LEDs at 780 and 860 (nm), a 4.4 Ah battery and Phar Lap 10.0. The camera registers are set from CMSETUP.I2C. Its comments are a little development diary, with edits from 1999 to 2002.

The FPGA is loaded from ISB8VERY.BIT. Its Xilinx bitstream header is readable with xxd:

00000010: 7063 695f 746f 705f 726f 7574 6564 2e6e  pci_top_routed.n
00000020: 6364 0062 000b 3273 3130 3074 7131 3434  cd.b..2s100tq144
00000030: 0063 000b 3230 3033 2f31 312f 3231 0064  .c..2003/11/21.d
00000040: 0009 3038 3a35 353a 3034 0065 0001 7d74  ..08:55:04.e..}t

What hhTetheredMode=1 means in practice is shown in part 3: enrolments made on the device are not stored on the card.

The database#

DATA holds two files that belong together:

FileSizeStructure
RECFIL1K.F02126,208 bytes986 records × 128 bytes: person data
MASTER1K.F021,009,664 bytes986 records × 1,024 bytes: iris templates

This is not a database in the modern sense, but a flat file of fixed-size C structs. In standalone mode, new enrolments are appended (appendrecfilerecord); in tethered mode the device stores nothing (part 3). There is no index; to identify someone, the device has to compare the new code against every stored template. The two files have the same number of records, and the record number is the link between them; there is no explicit pointer field. In the emulator, one enrolment adds one record to each file, and the match screen reports the record index.

I analysed the record layout statistically, looking only at the character class of each byte and never at the content. Each 128-byte record looks like this:

OffsetLengthContent
016Name (ASCII, padded with 0xFF)
1616Name (ASCII, padded with 0xFF)
321Eye, L or R
3310x00
3430Free-text comment, NUL-terminated, padded with 0xFF; the last byte is 0xF0 in every record
6464ID: a 38-character GUID in braces, padded with 0x00

The application asks for a numeric ID between 1 and 999,999 when you enrol on the device. The records on my card contain GUIDs instead, which suggests they were created on a host PC and loaded onto the PIER. That fits the tethered mode my card was set to.

The 1,024-byte template records can be compared with Daugman’s description of the IrisCode: 2,048 bits (256 bytes) of phase information plus an equal number of mask bits. That makes 512 bytes, and the error message “error 512 bytes codes” in the firmware fits. A byte-entropy profile of the file shows four similar 256-byte segments per record. How exactly the “long code” is laid out in its 1 KB, I have not worked out.

Here is a parser for the record file. By default it only prints the record count and field lengths, so you can check a dump without displaying the personal data of the people in it:

python RECFIL1K.F02 parser
#!/usr/bin/env python3
# RECFIL1K.F02: fixed 128-byte records
#   0..15  name field A (16 bytes, 0xFF padded)
#  16..31  name field B (16 bytes, 0xFF padded)
#  32      eye ('L' or 'R'), 33 = 0x00
#  34..63  comment (30 bytes, NUL terminated, 0xFF padded)
#  64..127 ID (64 bytes, GUID string, 0x00 padded)
import struct
import sys

REC = struct.Struct("16s16s2s30s64s")

def clean(b: bytes) -> str:
    return b.split(b"\x00", 1)[0].replace(b"\xff", b"").replace(b"\xf0", b"").decode("ascii", "replace")

def main(path: str, show: bool) -> None:
    data = open(path, "rb").read()
    count = len(data) // REC.size
    print(f"{count} records, {len(data) % REC.size} trailing bytes")
    for i in range(count):
        a, b, eye, comment, rid = REC.unpack_from(data, i * REC.size)
        fields = [clean(a), clean(b), clean(eye), clean(comment), clean(rid)]
        if show:
            print(i, *fields, sep="\t")
        else:
            print(i, *(len(f) for f in fields), sep="\t")

if __name__ == "__main__":
    main(sys.argv[1], "--show" in sys.argv[2:])

Anyone who has the card can read it this way. No password, no key, nothing.

Network services#

Remote mode. In tethered mode (hhTetheredMode=1, the setting on my card), the application opens four TCP servers for the host software. Port 899 (in the code) is the main channel for commands and images; 898, 900 and 901 are helper channels. The host connects to the device, not the other way round. All four use short ASCII commands that end with a carriage return; the first letter selects the command. A reply starts with that letter, followed by Y on success or N and an error code on failure; images and files follow as binary data. The commands cover camera images (raw, BMP and JPEG), focus and JPEG quality, reading enrolment records by index, a watchdog and shutdown. A text interpreter (_hhCommands) can, among other things, press keys on the device: HK<code> sets the variable _fakekeypad.

One oddity: the four channels write their port numbers into the socket address without converting them to network byte order, while the HTTP server does it correctly. Unless the ETS stack compensates, the ports on the wire are 33283, 33539, 33795 and 34051 instead of 898–901. The vendor’s own client code in the same binary makes the same mistake, so the two would still find each other. I found this by reading the code and haven’t confirmed it on a network yet.

FTP server. PR167 includes Phar Lap’s FTP server library and announces itself as “PV11 FTP Server”. It gives access over unencrypted FTP to the flash drive C:, i.e. the whole card including the database, and on request to the RAM disk D:. Since software version 1.61, a host PC can synchronise the database with the PIER “using ftp files” (hhDataUpdate=1). In tethered mode, the device writes its status, including the enrolment quality values, as XML to d:\status.txt, presumably for the host software to fetch.

HTTP server. The application also links Phar Lap’s MicroWeb HTTP server, a C library (HTTPSERV.LIB, WEBSERVE.OBJ). The files in HTML are mostly Phar Lap samples: HTMLTEST.C is the “HTML-on-the-fly” demo (“Copyright (C) 1996 Phar Lap Software, Inc.”), and INDEX.HTM/SEARCH.HTM are sample pages with links to AltaVista, Lycos and HotBot. According to the code it listens on TCP port 80. The one PIER-specific file is XIMAGE.HTM/YIMAGE.HTM, “Live Video Demonstration v1.00”. It is a JavaScript slideshow that keeps reloading /grab1.jpg … /grab10.jpg from the device, so a live camera view in the browser built from single JPEG frames, not an MJPEG stream. I have not checked whether the HTTP server is actually started on a production unit.

FTP client scripts. F.BAT runs the DOS FTP client with FTP.CMD, which logs in to 192.168.0.220 as anonymous and downloads iv11bkup.zip. No boot script calls F.BAT, so the device does not update itself from FTP at boot. The factory first-boot script in BACKUP\STRTONCE.BAT goes the other way and uploads wattcp.cfg to the same host.

The device also answers ICMP echo requests (“ping”) through the ETS TCP/IP stack, and PING.EXE for DOS is on the card.

Security#

Setup password. The setup menu is protected by a password. The default is shadow. It is written in plain text in NET164.INI and NET167.INI (“default is shadow if unspecified”), and it is also compiled into the executable as the initial value of the variable _szPassword. Right next to it in the binary is the initial value of a second variable, _szRestrictedPassword, which belongs to the “restricted login” feature. I won’t print it.

Remote mode. With hhSecureLogin=0 and hhRestrictedLogin=0, as on my card, none of the four remote-mode channels asks for a password, and nothing is encrypted. From the code, anyone on the same network can grab camera images, read enrolment records, press keys on the device, change camera settings and switch it off.

FTP login. The only credential in the FTP files is root, the password of the anonymous login in the client script FTP.CMD, which connects from the PIER to a host. I found no credentials for the device’s own FTP server on the card.

Encryption. The software supports encryption. The security menu can encrypt the database with a master key, and offers AES, 3DES and Blowfish (“F3=AES F4=3DES F5=Blowfish”). Since version 1.62, hhSecureLogin controls whether the login and the IrisCodes are encrypted. On my card, as shipped, hhSecureLogin=0, which the comment describes as “no secure login (like all previous versions)”. The database files are not encrypted: the names in the record file are plain ASCII.

Trivia#

  • The corporate chain. In 2003 SecuriMetrics called itself “an Iridian Technologies Systems Integrator/Value Added Reseller and licensee of Iridian’s core technology”. In February 2006 Viisage bought SecuriMetrics for $28 million in cash, plus up to $13 million in earn-outs. In August 2006 it bought Iridian, “the company responsible for the initial development and commercialization of iris recognition technology”, for $35 million. Two weeks later Viisage and Identix merged into L-1 Identity Solutions.
  • The Matrix. Two bitmaps on the card, MATRIX1.BMP and MATRIX2.BMP, show green “digital rain” in the style of the film. The firmware uses them in an LCD test routine called “matrix display”.
  • IVA. The web demo’s home link points to http://ivap11/, the application family is called PV11, and the firmware prints “>IVA Corp Proprietary”. I could not find out reliably who “IVA Corp” was.
  • Successors with the same problems. The PIER’s successor, the HIIDE (contract announced in February 2005), was also built by SecuriMetrics. In August 2021 The Intercept reported that the Taliban had seized HIIDE devices. In December 2022 the Chaos Computer Club bought four SEEK II and two HIIDE 5 devices at an online auction and found unencrypted biometric data of 2,632 people on them. The only protection was “a well-documented standard password”. Neither story involves the PIER, but it is the same pattern as on my card, almost 15 years later.

Conclusion#

The software is the more interesting half of the device. It is a carefully layered PC-style stack: an embedded BIOS and DOS start a real-time Win32 kernel, which runs a single big application with its own drivers, FTP and web servers, three ciphers and a BIOS flasher. It is clearly the result of years of iteration, from the 1999 camera settings to the PR167 build from December 2007.

Security, however, was optional, and on my device it was off. The encryption existed, but hhSecureLogin was 0. The setup password is a published default in a text file and in the binary. Nearly a thousand enrolment records and iris templates sit in plain files on a removable card. Anyone who gets hold of such a device can read everything with a card reader and a short Python script. That was true in 2008, and as the CCC showed in 2022, it was still true for the devices that came after it.

Disclaimer: All information in this article should be used responsibly. I have not published the card image or any personal data from it.

Sources#

cd ~/projects