HackTheBox – Debugging Interface Write-up

Dear readers,

Today’s post is on a hardware challenge created on 10th April 2021 which is rated as very easy. I would say it is very easy if you have at least some hardware knowledge on signals once you know what software to use and how to use the software. I needed to go to the discussion forum to get hints on what software to use and the features to use in the software before I was able to debug and obtain the flag. Without further ado, let’s go into the write-up.

Fig 1. Debugging Interface hardware challenge in HackTheBox

File provided

In this challenge, only a single file is provided which is debugging_interface_signal.sal. You can download the file here.

Software needed

To read the given file, we will require a logic analyzer software. As the file is in .sal extension, we should use Saleae‘s logic analyzer to analyze the file. Download the software and install it then you are ready for some analysis work!

Analyzing the file

Once you open up the file in the logic analyzer, it should look like Fig 4a.

Fig 4a. Outlook of opening debugging_interface_signal.sal in the logic analyzer

You can press on the hotkey, ‘=’, to zoom-in or ‘-‘ to zoom-out. Zoom-in until you can see the highs and lows of the graph but not too zoomed-in such that you can see more highs and lows of different duration. Once you have done so, click on the Analyzers tab on the most right panel shown with the ‘1F‘ icon and then click on the ‘Async Serial‘ (see the red boxes on Fig 4b).

Fig 4b. Select Async Serial analyzer in the Analyzers panel

The default settings will appear (see Fig 4c). Click on the Save button.

Fig 4c. Default Async Serial settings

Looking at the graph, you will notice that there are a lot of framing errors with a brunch of hexadecimal values. Based on the information on asynchronous serial communication, we will know that each data being sent are in ASCII and there is a start and stop bit. Therefore, let’s convert the values into ASCII first by clicking on the additional options in the blue box and then select Ascii in the red box as shown in Fig 4d.

Fig 4d. Converting values into ASCII

Once you converted it into ASCII, you will notice that the values are much more readable (see Fig 4e).

Fig 4e. ASCII values being shown as the data instead of the default hexadecimal values

Now it is time for us to solve the framing error. If you have taken some hardware modules in school on signals such as UART, etc, this should be easy to understand for you. A framing error occurs when the bit being read is too fast or too slow. If they are being read too quickly or too slowly, they will give different values. An example show on Fig 4f is a graph read at normal interval shown on the red dotted line. This gives a result of 01010 in binary. However, if we increase the read of bit rate by 2 times, it will read two times faster, causing it to read with more intervals shown on the red dotted line in Fig 4g. This gives a result of 0011001100 instead.

Fig 4f. Graph read at normal interval
Fig 4g. Graph read at two times faster than the original the bit rate

If we look at the graph, we can see that the bit rate is too low as our setting at Fig 4c is reading only 8 bits but there are definitely more than 8 bits being read and treated as only 8 bits being read in Fig 4h. To be exact, 31 bits were being read as 8 bits. That’s why the analyzer warns us that there is a framing error.

Fig 4h. 31 bits were being read as 8 bits due to slow bit rate causing framing error

If we point our mouse’s cursor at the graph at the shortest interval (the first low is already an example of the shortest interval), we will see that each shortest interval is 32.02 microseconds (see Fig 4i).

Fig 4i. The shortest interval of the graph is 32.02 microseconds

To calculate the actual bit rate, we should:

Bit rate (bit/s) = 1 second / (32.02 x 10^(-6)) seconds = 31,230.480949406621 = 31,230

There is no decimal place in number of bits to read so we will just truncate away the decimal number. If we do not get the flag, we will then round up to 31,231 if needed. For now, let’s stick to 31,230 bit/s.

Going back to the setting (see Fig. 4j), it will bring us back to the setting window to adjust out bit rate. Changed the value from 9600 to 31,230 (see Fig 4k). Then click on the save button.

Fig 4j. Open the setting window to change the bit rate
Fig 4k. Edit the bit rate to 31,230 bits/s

Once you saved it, you will notice that the framing error is gone and proper words are being shown on the right panel (see Fig 4l).

Fig 4l. Messages formed after solving the framing error

Flag obtained

Select on the terminal tab as shown on the blue box in Fig 5. Scroll down the messages and you will see the flag sent in the last message.

Fig 5. Flag shown in the terminal tab

Flag: HTB{d38u991n9_1n732f4c35_c4n_83_f0und_1n_41m057_3v32y_3m83dd3d_d3v1c3!!52}

I hope this post has been helpful to you. Feel free to leave any comments below. You may also send me some tips if you like my work and want to see more of such content. Funds will mostly be used for my boba milk tea addiction. The link is here. 🙂

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.