<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Wireshark on Monish Kumar&#39;s Blog</title>
        <link>https://itsmonish.pages.dev/tags/wireshark/</link>
        <description>Recent content in Wireshark on Monish Kumar&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-us</language>
        <lastBuildDate>Sat, 26 Apr 2025 17:51:33 +0530</lastBuildDate><atom:link href="https://itsmonish.pages.dev/tags/wireshark/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Forensics - Keyboard Junkie</title>
        <link>https://itsmonish.pages.dev/blog/huntress-ctf-2024/forensics-keyboard-junkie/</link>
        <pubDate>Sat, 26 Apr 2025 17:51:33 +0530</pubDate>
        
        <guid>https://itsmonish.pages.dev/blog/huntress-ctf-2024/forensics-keyboard-junkie/</guid>
        <description>&lt;h1 id=&#34;keyboard-junkie&#34;&gt;Keyboard Junkie
&lt;/h1&gt;&lt;h2 id=&#34;challenge-statement&#34;&gt;Challenge Statement
&lt;/h2&gt;&lt;p&gt;Author: @JohnHammond&lt;/p&gt;
&lt;p&gt;My friend wouldn&amp;rsquo;t shut up about his new keyboard, so&amp;hellip;&lt;/p&gt;
&lt;p&gt;Attachment: &lt;a class=&#34;link&#34; href=&#34;https://itsmonish.pages.dev/others/huntressctf-2024/keyboard-junkie/keyboard_junkie&#34; &gt;keyboard_junkie&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;solution&#34;&gt;Solution
&lt;/h2&gt;&lt;p&gt;Running file command on the attachment reveals it to be a PCAP file. Opening it with a wireshark, a packet analyzer, we can observe USB capture data.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/huntressctf-2024/keyboard-junkie/1.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;usb descriptor&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;On top of the capture we can even see the request and response of USB device descriptor. This is what happens when you connect a USB input device to a host. The host requests the descriptor for what type of device it is and the device responds. Based on the response we can conclude that, the device is a Keyboard.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/huntressctf-2024/keyboard-junkie/2.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;urb in&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;We can also observe a lot of URB (USB Request Block) interrupts in the capture. These are keystrokes recorded by the keyboard. We can&amp;rsquo;t directly see what was typed in as it is not that simple with keyboard. Keystrokes maybe a simple keypress, or a combination of control keys and others. So they have a representation format of their own. This has been explained to good detail in &lt;a class=&#34;link&#34; href=&#34;https://05t3.github.io/posts/Dissecting-USB-Traffic/#decoding-hid-data&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;this&lt;/a&gt; blog.&lt;/p&gt;
&lt;p&gt;To extract the keystroke data, I used &lt;code&gt;tshark&lt;/code&gt; to extract the captured data. This is how the data actually looks like:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/huntressctf-2024/keyboard-junkie/3.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;usb capdata&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Now we need to decode this data. We can do it ourselves but I thought someone might have already put together a script for this. A quick internet search later, I found a page on &lt;a class=&#34;link&#34; href=&#34;https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-methodology/pcap-inspection/usb-keystrokes&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;hacktricks.xyz&lt;/a&gt; about usb pcap inspection and and how we can decode it using &lt;a class=&#34;link&#34; href=&#34;https://github.com/TeamRocketIst/ctf-usb-keyboard-parser&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;ctf-usb-keyboard-parser&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I then just cloned the repo, put the commands for extraction and execution in &lt;a class=&#34;link&#34; href=&#34;https://itsmonish.pages.dev/others/huntressctf-2024/keyboard-junkie/solve.sh&#34; &gt;solve.sh&lt;/a&gt;. Executing them yielded the flag.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/huntressctf-2024/keyboard-junkie/4.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;flag&#34;
	
	
&gt;&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
