69 lines
5.8 KiB
Text
69 lines
5.8 KiB
Text
---
|
|
title: The Bitcoin Piñata - no candy for you
|
|
author: hannes
|
|
tags: mirageos, security, bitcoin
|
|
abstract: More than three years ago we launched our Bitcoin Piñata as a transparent security bait. It is still up and running!
|
|
---
|
|
|
|
## History
|
|
|
|
On February 10th 2015 David Kaloper-Meršinjak and Hannes Mehnert
|
|
[launched](https://mirageos.org/announcing-bitcoin-pinata) (read also [Amir's
|
|
description](http://amirchaudhry.com/bitcoin-pinata)) our [bug bounty
|
|
program](https://en.wikipedia.org/wiki/Bug_bounty_program) in the form of our
|
|
[Bitcoin Piñata](http://ownme.ipredator.se) MirageOS unikernel. Thanks again to
|
|
[IPredator](https://ipredator.se) for both hosting our services and lending us
|
|
the 10 Bitcoins! We [analysed](https://mirageos.org/blog/bitcoin-pinata-results) a
|
|
bit more in depth after running it for five months. Mindy recently wrote about
|
|
[whacking the Bitcoin
|
|
Piñata](https://somerandomidiot.com/blog/2018/04/17/whacking-the-bitcoin-pinata/).
|
|
|
|
On March 18th 2018, after more than three years, IPredator, the lender of the Bitcoins, repurposed the 10 Bitcoins for other projects. Initially, we thought that the Piñata would maybe run for a month or two, but IPredator, David, and I decided to keep it running. The update of the Piñata's bounty is a good opportunity to reflect on the project.
|
|
|
|
The 10 Bitcoin in the Piñata were fluctuating in price over time, at peak worth 165000€.
|
|
|
|
From the start of the Piñata project, we published the [source code](https://github.com/mirleft/btc-pinata), the virtual machine image, and the versions of the used libraries in a git repository. Everybody could develop their exploits locally before launching them against our Piñata. The Piñata provides TLS endpoints, which require private keys and certificates. These are generated by the Piñata at startup, and the secret for the Bitcoin wallet is provided as a command line argument.
|
|
|
|
Initially the Piñata was deployed on a Linux/Xen machine, later it was migrated to a FreeBSD host using BHyve and VirtIO with [solo5](https://github.com/solo5/solo5), and in December 2017 it was migrated to native BHyve ([using `ukvm-bin` and solo5](/Posts/Solo5)). We also changed the Piñata code to accomodate for updates, such as the [MirageOS 3.0 release](https://mirageos.org/blog/announcing-mirage-30-release), and the discontinuation of floating point numbers for timestamps (asn1-combinators 0.2.0, x509 0.6.0, tls 0.9.0).
|
|
|
|
## Motivation
|
|
|
|
We built the Piñata for many purposes: to attract security professionals to evaluate our [from-scratch developed TLS stack](https://mirageos.org/blog/introducing-ocaml-tls), to gather empirical data for our [Usenix Security 15 paper](https://www.usenix.org/conference/usenixsecurity15/technical-sessions/presentation/kaloper-mersinjak), and as an improvement to current bug bounty programs.
|
|
|
|
Most bug bounty programs require communication via forms and long wait times for
|
|
human experts to evaluate the potential bug. This evaluation is subjective,
|
|
intransparent, and often requires signing of non-disclosure agreements (NDA),
|
|
even before the evaluation starts.
|
|
|
|
Our Piñata *automates* these parts, getting rid of wait times and NDAs. To get
|
|
the private wallet key that holds the bounty, you need to successfully establish
|
|
an authenticated TLS session or find a flaw elsewhere in the stack, which allows
|
|
to read arbitrary memory. Everyone can track transactions of the blockchain and
|
|
see if the wallet still contains the bounty.
|
|
|
|
Of course, the Piñata can't prove that our stack is secure, and it can't prove
|
|
that the access to the wallet is actually inside. But trust us, it is!
|
|
|
|
## Observations
|
|
|
|
I still remember vividly the first nights in February 2015, being so nervous that I woke up every two hours and checked the blockchain. Did the Piñata still have the Bitcoins? I was familiar with the code of the Piñata and was afraid there might be a bug which allows to bypass authentication or leak the private key. So far, this doesn't seem to be the case.
|
|
|
|
In April 2016 we stumbled upon an [information disclosure in the virtual network
|
|
device driver for Xen in MirageOS](/Posts/BadRecordMac). Given enough
|
|
bandwidth, this could have been used to access the private wallet key. We
|
|
upgraded the Piñata and released the [MirageOS Security Advisory
|
|
00](https://mirageos.org/blog/MSA00).
|
|
|
|
We analysed the Piñata's access logs to the and bucketed them into website traffic and bounty connections. We are still wondering what happened in July 2015 and July 2017 where the graph shows spikes. Could it be a presentation mentioning the Piñata, or a new automated tool which tests for TLS vulnerabilities, or an increase in market price for Bitcoins?
|
|
|
|
![Piñata access](/static/img/pinata_access_20180403.png) ![Piñata access cumulative](/static/img/pinata_access_cumulative_20180403.png)
|
|
|
|
The cumulative graph shows that more than 500,000 accesses to the Piñata website, and more than 150,000 attempts at connecting to the Piñata bounty.
|
|
|
|
You can short-circuit the client and server Piñata endpoint and observe the private wallet key being transferred on your computer, TLS encrypted with the secret exchanged by client and server, using `socat -x TCP:ownme.ipredator.se:10000 TCP:ownme.ipredator.se:10002`.
|
|
|
|
If you attempted to exploit the Piñata, please let us know what you tried! Via
|
|
<strike>[twitter](https://twitter.com/h4nnes)</strike>
|
|
[hannesm@mastodon.social](http://mastodon.social/@hannesm) or via eMail.
|
|
|
|
Since [the start of 2018](/Posts/DNS) we are developing robust software and systems at [robur](http://robur.io). If you like our work and want to support us with donations or development contracts, please get in touch with `team@robur.io`. Robur is a project of the German non-profit [Center for the cultivation of technology](https://techcultivation.org). Donations to robur are tax-deductible in Europe.
|