<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pentagrid AG (Posts about Raspberry Pi)</title><link>https://www.pentagrid.ch/</link><description></description><atom:link href="https://www.pentagrid.ch/en/categories/raspberry-pi.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 Pentagrid AG </copyright><lastBuildDate>Wed, 17 Jun 2026 19:14:50 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Shreddy2 – The Raspberry Pi storage scrub station for USB thumb drives</title><link>https://www.pentagrid.ch/en/blog/shreddy2-the-raspberry-pi-storage-scrub-station-for-usb-thumb-drives/</link><dc:creator>Pentagrid AG</dc:creator><description>&lt;p&gt;"Delete early, delete often" is the slightly adapted slogan reminding to
minimize data leakage via lost or stolen USB thumb drives by frequently
cleaning them. Are you tired of being focused to not accidentally erase the
wrong USB device on your local computer when formatting an USB stick? To
simplify the process, we implemented an USB eraser station software, which
runs on a Raspberry Pi and that cleans USB sticks. Therefore, shreddy,
ready, go!&lt;/p&gt;
&lt;!-- TEASER_END --&gt;
&lt;section id="disclaimer"&gt;
&lt;h2&gt;Disclaimer&lt;/h2&gt;
&lt;p&gt;First of all, sensitive information should not be stored on mobile USB sticks
without any protection, especially when there is the risk of losing it. It is
always a good idea to encrypt data before storing it or to use an USB stick
that supports encryption that you trust, or even better, that has been
verified. Nevertheless, a lot of data is still stored on USB sticks and if it
is not deleted regularly, there will be a pile of information that even if
single files are less sensitive, the large quantity of files could reveal a lot
about internal activities or personal matters. Therefore, deleting files on a
USB stick from regularly mitigates the impact in the event of loss.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="deleting-data-on-flash"&gt;
&lt;h2&gt;Deleting data on Flash&lt;/h2&gt;
&lt;p&gt;USB sticks are built from Flash memory and deleting files does not really
remove the data. File contents could be recovered on the file system layer,
especially on &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Undeletion"&gt;FAT file systems&lt;/a&gt; that
are widely used on USB sticks, as long as file contents are not overwritten.
But even then, corrupt file residues could still contain enough extractable
information. Back in the days, files on magnetic discs were overwritten with
secure deletion tools that wrote data multiple times over files to make
recoverability unlikely. While this works for magnetic discs, this does not
work with Flash storage. The &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Flash_memory_controller"&gt;Flash memory controller&lt;/a&gt; tries to spread
write operations over Flash memory to ensure an equal utilisation of memory
cells. This method is called wear levelling and extends a storage media’s
lifespan. This wear levelling makes it impossible to just overwrite a single
file to remove its content, because several regions within the Flash memory may
have been overwritten, but not the location where the original file content was
stored. Furthermore, the Flash memory controller reserves extra storage that is
used when memory cells degrade too much and fail. If file content was written
to such a now inaccessible location, it cannot be overwritten anymore without
low-level access to the Flash memory.&lt;/p&gt;
&lt;p&gt;So, what is the correct way to clean an USB memory stick? &lt;a class="reference external" href="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-88r1.pdf"&gt;NIST SP 800-88 Rev. 1
“Guidelines for Media Sanitization”&lt;/a&gt;
recommends the following procedure for erasing USB Removable Media (including
so-called Pen Drives, Thumb Drives, Flash Memory Drives, Memory Sticks, etc.):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Overwrite media by using organizationally approved and tested overwriting
technologies/methods/tools. The Clear pattern should be at least two
passes, to include a pattern in the first pass and its complement in the
second pass. Additional passes may be used.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But NIST also adds as a note: “For most cases where Purging is desired, USB
removable media should be Destroyed.” That is the recommendation to be on the safe side.&lt;/p&gt;
&lt;p&gt;However, for less critical data and piles of data a simple overwrite approach
with multiple passes may be sufficient. Since single file overwriting does not
work due to how Flash memory is managed, a full overwrite approach reduces the
risk of residues significantly. &lt;a class="reference external" href="https://www.usenix.org/legacy/event/fast11/tech/full_papers/Wei.pdf"&gt;Wei et al observed in their practical
recoverability tests&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;In most cases, overwriting the entire disk twice was sufficient to sanitize
the disk, regardless of the previous state of the drive. There were three
exceptions: about 1% (1 GB) of the data remained on Drive A after twenty
passes. We also tested a commercial implementation of the four-pass
5220.22-M standard on Drive C. For the sequential initialization case, it
removed all the data, but with random initialization, a single fingerprint
(remark: test data previously spread over the medium) remained.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In other words, there is no real correct way of secure data deletion other than
encrypting the data and deleting the key or physically destroying the medium.
Don't tell us you haven't been warned. Nevertheless, we created a tool if you
would like to try to erase data.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="software"&gt;
&lt;h2&gt;Software&lt;/h2&gt;
&lt;p&gt;We implemented a software in python that uses the py-udev library to listen for
events caused by plugged in USB storage devices. Storage media are then
overwritten in three passes: The first and second pass use the &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Badblocks"&gt;badblocks
command&lt;/a&gt; to write the complementary
patterns 0x00 and 0xff. The badblocks command is not intended to be used for
wiping, but does this as a side effect when looking for bad blocks. The tool is
used here, because it allows specifying an explicite write pattern. Overwriting
the block device in a third pass is implemented via invoking the &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Shred_(Unix)"&gt;shred command&lt;/a&gt; in random mode. Overwriting the
memory with random data should increase  the effort for searching for
extractable residues. Afterwards, the software creates a new FAT32 file system.
For this, the program relies on &lt;code class="docutils literal"&gt;parted&lt;/code&gt; and &lt;code class="docutils literal"&gt;mkfs&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The software can be installed on a Raspberry Pi that is placed in an office in
a trustworthy environment. People can plug in their used USB sticks and come
back later to pick it up, which might be a security problem on its own. Again,
you have been warned.&lt;/p&gt;
&lt;a class="reference external image-reference" href="https://www.pentagrid.ch/images/202112_Screenshot_shreddy2.png"&gt;
&lt;img alt="Screenshot of the telnet status page" class="align-center" src="https://www.pentagrid.ch/images/202112_Screenshot_shreddy2.thumbnail.png"&gt;
&lt;/a&gt;
&lt;p&gt;The software implements two methods to signal the status. In a networking mode,
the eraser station has network connectivity and you can request status
information via &lt;code class="docutils literal"&gt;netcat&lt;/code&gt; or &lt;code class="docutils literal"&gt;telnet&lt;/code&gt; (cf. screenshot above). Since the networking mode
allows a possibly compromised Raspberry Pi to extract the USB stick contents
and to exfiltrate data to an attacker, the Raspberry Pi could alternatively put
into a metal case to block radio interfaces and to furthermore operate it
without Ethernet. The second status signalling method is an USB busylight
attached to the Raspberry Pi. As long as there is an erase operation running,
the busylight shows red, a red flashing reports an error, and a green light
means all plugged-in USB sticks were processed. When idling and there is no USB
memory stick inserted, the busylight saves power and is off. The software
currently supports Kuando busylights via the &lt;a class="reference external" href="https://github.com/nitram2342/pyBusylight"&gt;pyBusylight Python library&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The source code is available on &lt;a class="reference external" href="https://github.com/pentagridsec/shreddy2"&gt;Github&lt;/a&gt;, where there is also the
installation guide.&lt;/p&gt;
&lt;/section&gt;</description><category>Flash</category><category>Information Disclosure</category><category>Operational Security</category><category>Raspberry Pi</category><category>Tools</category><guid>https://www.pentagrid.ch/en/blog/shreddy2-the-raspberry-pi-storage-scrub-station-for-usb-thumb-drives/</guid><pubDate>Mon, 20 Dec 2021 05:12:21 GMT</pubDate></item></channel></rss>