Skip to main content

Tracking users, malware and data leaks via the USB serial numbers on flash drives, smart phones and MP3 players

 I don't write on the forensics side of security much, but I thought this was an interesting topic that I'd not seen covered much before. While I was doing my research on USB hardware key loggers I learned quite a bit about USB devices that I did not know before. Besides Vendor IDs and Product IDs, some devices also have a serial number associated with them.
The “Serial Number Descriptor” string is optional, but a fair number of devices such as thumb drives, removable USB hard drives, PDAs and cell phones have them. This started me thinking: How could this data be used in a security or forensics context? I can think of a few scenarios off the top of my head: 
Ω       A USB flash drive is found with contraband on it, but none of the suspects claim to own it. If the serial number of the USB flash drive is found in one of suspects' Windows registry this is possible evidence as to who it belongs to.  
Ω       Malware has been spreading though your network, and you think thumb drives are the vector. Using the serial number you could search the network for computers where a known infected drive was used to give you an idea as to which workstations you will have to do clean up on. It may also lead you to know who brought the malware into the network (Patient Zero), or who been the biggest Typhoid Mary.  
Ω        You suspect some data has been stolen from a department server, and you found a suspicious MP3 player’s serial number in the Windows server's registry. MP3 players can be used as generic storage devices. By searching the network for other boxes where that same MP3 player has been plugged-in you may find that the only other box it's ever been use on is Bob's. This makes Bob a likely suspect.
        I'm guessing you could come up with other scenarios where tracking a USB device’s serial number could be useful. We can see the potential, but how do we get this data, and how do we automate using it? There are two main spots you can pull this information from on a Windows XP/Vista/7 system:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR
        I cover both of these registry keys in more detail in my article 'Forensically interesting spots in the Windows 7, Vista and XP file system and registry' which you can find here:

http://www.irongeek.com/i.php?page=security/windows-forensics-registry-and-file-system-spots

        Looking at these registry values directly is kind of cumbersome. A nicer way to look at this data is with NirSoft's freeware tool USBDeview which you can download from:

http://www.nirsoft.net/utils/usb_devices_view.html 


        USBDeView gives the user a ton of information about what devices are currently plugged-in, and what ones have been plugged-in before but are not currently present.

        Ok, now we know where on a Windows box this information is stored, but is there an automated way to find it and search our network for other locations where the same USB device has been used? Some organizations may have an asset tracking database that would be searchable for this information, but many of us don't have such a system in place. I was thinking of coding up something for the task, but I'm quite lazy. Then I remembered that most of Nir's tools have the ability to be used from across the network. Sure enough, USBDeview also had this option, all I had to do to connect to a remote Windows box and look though its registry for USB devices was to issue this simple command:
            USBDeview /remote \\SomeComputer
          Now keep in mind, I had to be logged in with an account that had access to that machine, and certain services have to be accessible. Nir has a nice blog post on what it takes for his tools to work from across the network:

http://blog.nirsoft.net/2009/10/22/how-to-connect-a-remote-windows-7vistaxp-computer-with-nirsoft-utilities/

        That solves the problem of dumping information from one machine, but what about a whole network? Well, it seems USBDview has an option for taking a list of machines from a text file and grabbing the USB device list from all of them. The syntax is pretty simple:
 
        USBDeview /remotefile boxes.txt  
where boxes.txt is a list of computer names/IPs in UNC format. For example:
\\192.168.1.13
\\192.168.1.14
\\skynet
\\cthulhu
  
        It takes a bit of time for the results to return, so be patient. Once we get the report, we can sort by the 'Serial Number' field, look for repeating serial number by eye, and then scroll over to the 'Computer Name' field to see what computers that particular USB device has been used on. For my screen shots I've reordered the columns to put the fields I'm most interested in first. The 'Created Date' and 'Last Plug/Unplug Date' fields are also usefully for figuring out a time line (really handy for finding a malware Patient Zero or Typhoid Mary based on when a user was logged on last). As you can see from the first screen shot, I have two different thumb drives from Patriot Memory that have been plugged into both my Skynet and Cthulhu workstations, but none of the other boxes I scanned:


        From the 2nd screen shot you can see that my IronKey and my former roommate’s Android Phone have only ever been plugged into my workstation named Cthulhu: 


        This sort of information can be erased, but local attackers rarely think of the tracks that their USB devices leave behind. I cover erasing USB track in more detail in the anti-forensics video which I will link to at the end of this article.

        Now you may be thinking: sorting and looking though the table for matching USB serial numbers by hand may be fine for when you only have four workstations, but what if you have a lot more? Luckily, Nir implemented the ability to save his tool's output to many different file formats, including CSV (Comma Separated Values). Pretty much any database tool (MS Access for example) can import a CSV file, and from there you are just a few SQL queries away from finding the devices you are seeking. For example, if I wanted to look though the output for just the serial number 07850DA305FC an SQL query similar to this one may help:
SELECT Myoutput.*
FROM Myoutput WHERE Myoutput.[serial] = '07850DA305FC' ;
        To dump your findings to a CSV you could take the results from the GUI, select all of the records (Ctrl-A), then choose the save icon and pick CSV from the drop down, but there is an easier way if you just intent to import the results into a database for sorting and searching. You can tell USBDeview to dump the output to a file without ever bringing up the GUI with this simple command:
USBDeview /remotefile boxes.txt /scomma myoutput.csv
        With a little automation you could make regular reports. I'm still interested in finding better ways to track this sort of information, so if you know of any good free or open source asset management systems that log USB serial numbers, or are interested in coding something to help automate these types of searches, please let me know.

        If you’re interested in just covering your tracks when it comes to USB serial numbers, check out my anti-forensics video:

http://www.irongeek.com/i.php?page=videos/anti-forensics-occult-computing

it's about three hours and seven minutes long, but covers a lot more than just USB devices. I hope you have enjoyed the article, and feel free to follow me on Twitter @Irongeek_ADC .
Links at a glance:
USBDeview
http://www.nirsoft.net/utils/usb_devices_view.html

What it takes for Nir's tools to work from across the network
http://blog.nirsoft.net/2009/10/22/how-to-connect-a-remote-windows-7vistaxp-computer-with-nirsoft-utilities/

Forensically interesting spots in the Windows 7, Vista and XP file system and registry
http://www.irongeek.com/i.php?page=security/windows-forensics-registry-and-file-system-spots

Anti-Forensics video
http://www.irongeek.com/i.php?page=videos/anti-forensics-occult-computing


Comments

Popular posts from this blog

Почему инженеры электросвязи становятся продажниками

Давно предупреждал инженеров электросвязи - если вы не развиваетесь, то рано или поздно превратитесь либо в дворника, либо в ассенизатора. О чем не предупреждал, каюсь, - так это о том, что локальный апокалипсис наступит прямо сейчас. Взять, например, сетевых инженеров  Ростелекома, которые бодро так искали, кого ещё подключить к интернету последние пару недель в Сочи и в Адлере. Скажете, инженеров заставляют работать продажниками - произвол и несправедливость? Лично я в этом совершенно не уверен. Чтобы было сразу понятно, о чем речь, готов проиллюстрировать свою мысль как работодатель. Мы ведь имеем здесь потенциальный конфликт в отношениях между работником и Ростелекомом , верно? И пока возмущенная общественность твердо стоит на стороне работника, предлагаю посмотреть чуть шире — не со стороны работодателя даже, а так, сбоку. Давайте возьмем, например, меня — типичного работодателя. Так случилось, что на меня работает некоторое количество весьма лояльных и толковых людей, ч

Как работает банк со своими корреспондентами по SWIFT

Итак, наш банк имеет открытые корреспондентские счета в США (CITIBANK N.A. NEW YORK), в Европе (VTB BANK DEUTSCHLAND AG), в России (Промсвязьбанк Москва и Собинбанк Москва). Соответственно, все расследования по платежам происходят через эти банки согласно  установленным корреспондентским отношениям с использованием соответствующих форматов SWIFT MT-195/295, MT-196/296, MT-199/299 и MT-192/292 Кроме прямых корреспондентских отношений с банками, нашим банком установлены отношения и с другими финансовыми организациями через процедуру обмена ключами, что даёт возможность использовать SWIFT-форматы МТ-195, МТ-196 и МТ-199 для проведения процедуры расследования по стандартным платежам и платежам с покрытием: - DEUTSCHE BANK TRUST COMPANY AMERICAS USA - COMMERZBANK AG Germany - CITIBANK N.A. London - CITIBANK N.A. Brussels - BANQUE DE COMMERCE ET DE PLACEMENTS S.A. Geneva - NORVIK BANKA JSC  LV - ABLV BANK AS  LV В среднем процедура расследования занимает от 3 до 14 дней (е

Как найти реального заливщика

Своего первого реального заливщика, который показал мне как можно скачать деньги в интернет с банковских счетов, я нашел случайно, когда еще трудился в Укртелекоме сменным инженером немного подрабатывая продавая трафик налево , но потом этот человек отошел от дел в связи со слишком уж скользкой ситуацией в данной сфере, и я решил поискать партнера на форумах, разместив рекламу на трёх электронных досках объявлений. Честно говоря поначалу даже был готов сразу закинуть 500 000 гривен в Гарант, но потом призадумался, а стоит ли? Ко мне начал обращаться народ обращается разных категорий 1. Дебильная школота, которая что-то любит повтирать про свою серьезность и просит закинуть 10 000 USD им на Вебмани в качестве аванса  2. Реальные мэны, которые  льют сразу большую сумму по SWIFT  без разговоров про гарантии и прочую шнягу, но после того, как им отдаёшь нал, они сразу пропадают, суть данных действий я так и не понял. зачем пропадать, если всё прошло гладко? 3. Мутные личност

М9 - точка обмена трафиком • Московский INTERNET EXCHANGE • MSK-XI

Вот так всё начиналось Изначально был всего один провайдер - Релком. Не было конкурентов - не было проблем. Рунет еще делал свои первые шаги, и все русскоязычные ресурсы были сосредоточены в одном месте. Позже Релком развалился на Релком и Демос, стали появляться другие провайдеры. Рунет тем временем подрос и... распался на множество отдельных сетей-сегментов, контролируемых разными провайдерами. Разумеется, конечные пользователи имели доступ ко всем ресурсам рунета, но прямого взаимодействия между провайдерами не было. Поэтому трафик шел с сервера одного провайдера по огромной петле через Америку, потом Германию, и только потом возвращался на сервер другого провайдера. Имела место неоправданная потеря и в скорости, и в деньгах. Пока трафик был незначительным, это мало кого волновало, но интернет бурно развивался, трафик по рунету стремительно увеличивался, и в один прекрасный день крупные провайдеры Москвы (по сути, Демос и Релком) сели друг напротив друга и решили, что им надо нал

Чем рискуют дропы и нальщики принимая заливы на свои карты

Зам.начальника управления Следственного департамента МВД Павел Сычев рассказал о криминальном бизнесе «нальщиков» - Глава Банка России Эльвира Набиуллина заявила о снижении объемов теневого оборота в конце 2013 года. Что показывает ваша статистика по выявлению незаконных операций? - В последние годы объем денежных средств, выведенных в теневой сектор, увеличивался, и криминогенная обстановка ухудшалась. Проблема находится в поле зрения президента -  в декабрьском послании Федеральному Собранию, он призвал избавить нашу финансовую систему от разного рода «отмывочных контор» и так называемых «прачечных». Оперативники уже получили ориентировку на более активное выявление этих преступлений. П о уголовным делам, расследованным МВД только в первом полугодии 2013 года, проходит 145 млрд рублей, обналиченных и незаконно выведенных заграницу. Это неуплаченные налоги, незаконный бизнес, хищения, взятки. Финансовый доход посредников от этих операций составил 8 млрд рублей. Расследовано 89

Залив на карту без предоплаты по SWIFT или SEPA

В последнее время наблюдается такая ситуация, что нальщиков и дропов на рынке много, а адекватных заливщиков , можно сказать, совсем нет. Например, один мой хороший знакомый, имеющий свой собственный офшор, работает с заливщиками на условиях партнерства, предоставляя им трафик и взамен получая 20% от поведенных транзакций на свой счет в офшорном банке. Мне он рассказал по большому секрету, как такое ему удается, а начинал он как и все с малого - продажи дебетовых карт и игре на рынке FOREX . Просто так искать Заливщиков на различных форумах, посвящённых обналу и отмыванию денег - достаточно муторное и нудное занятие, потому как после общения с десятым по счету заливщиком, начинаешь понимать, что просто так на карты и счета никто лить не будет. Однако моему другу попался один довольно интересный вариант - Заливщик предложил сделать перевод в размере 375 000 EUR по SEPA  в день предоставления готового к работе счета и активной системы Multihomed AS . Остальные предлож