Live presentation @ http://averageradical.github.io/compile/#/
Source of this presentation @ https://github.com/averageradical/compile
Open source doesn't necessarily mean it's more secure.
The Heartbleed Bug was in the wild for more than 2 years.
At the time, OpenSSL was a popular package and the vulnerability affected more than 15% of all secure websites.
Difficult to verify anything you download.
If attacker has server's TLS private key.
If attacker manipulates certificate authority.
Corollary: How do you know the Tor browser or Tails LiveCD you downloaded is legitimate?
“You can't trust code that you did not totally create yourself... No amount of source-level verification or scrutiny will protect you from using untrusted code. In demonstrating the possibility of this kind of attack, I picked on the C compiler. I could have picked on any program-handling program such as an assembler, a loader, or even hardware microcode. As the level of program gets lower, these bugs will be harder and harder to detect. A well installed microcode bug will be almost impossible to detect.” - Ken Thompson (Bell Labs, Unix, Go, UTF-8)
Compile in Linux. In general, easier, problems less likely.
If you're on Mac or Windows, run Linux in a Virtual Machine:
Many flavors of Linux. Compilation instructions vary.
I prefer Fedora+KDE. Examples:
Projects have license in README, COPYING or LICENSE file.
If no license, view website's terms (e.g. Github is impermissive).
Sources either ZIPs/Tarballs or in a repository (e.g. Github.com).
Project websites/READMEs often have instructions.
e.g., BitcoinArmory.com > Download > Building From Source
Optionally, verify signature (remember caveats from first slides).
Instructions usually on the website or in the source package.
In package, text file often called README, NOTES, or INSTALL.
Instructions often list dependencies you need to install (compiler, libraries, etc.).
Compilers depend on the type of code. GUI:
Compilers produce executables or binaries:
Dependencies needed for this presentation:
$ sudo yum update -y
$ reboot # If kernel was updated
$ sudo yum groupinstall -y "Development Tools" "Development Libraries"
$ sudo yum install -y gcc-c++ libtool swig pyqt4-devel python-psutil python-twisted wget protobuf-devel maven glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
$ wget -qO- 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' | tar -xzv && cd db*/build_unix
$ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/usr/local/
$ make
$ sudo make install
$ cd; wget -qO- https://www.openssl.org/source/openssl-1.0.1i.tar.gz | tar -xzv && cd o*
$ export CFLAGS="-fPIC"; ./config --prefix=/usr/local shared enable-ec enable-ecdh enable-ecdsa
$ make depend && make all
$ sudo make install
$ cd; git clone git://github.com/bitcoin/bitcoin.git; cd bitcoin
$ ./autogen.sh && ./configure LDFLAGS="-Wl,-rpath=/usr/local/lib64 -L/usr/local/lib/ -L/usr/local/lib64/" CPPFLAGS="-I/usr/local/include/"
$ make
$ sudo make install
$ mkdir ~/.bitcoin; wget -O ~/.bitcoin/bitcoin.conf https://raw.githubusercontent.com/averageradical/compile/gh-pages/example/bitcoin.conf
$ bitcoin-qt # or nohup bitcoind &
$ bitcoin-cli help
$ cd; git clone git://github.com/etotheipi/BitcoinArmory.git
$ cd BitcoinArmory
$ make
$ python ArmoryQt.py
Learning all the code takes time. Reverse engineer at first.
Recursive grep is a good place to start. Let's change the title:
$ grep -R "Bitcoin Wallet Management" *
Edit ArmoyQt.py, go to line 97, change it, and re-run.
$ cd; wget -qO- https://dl.google.com/android/android-sdk_r23.0.2-linux.tgz | tar xzv
$ android-sdk-linux/tools/android update sdk --no-ui --filter platform,platform-tool,tool,build-tools-20.0.0
$ git clone https://github.com/schildbach/bitcoin-wallet.git
$ cd bitcoin-wallet
$ sed -i 's/3.7.0/3.8.2/g' pom.xml
$ mvn clean install -Dandroid.sdk.path=/home/`whoami`/android-sdk-linux/
Questions: averageradical@gmail.com
Donations @ 1QDEf7xr33aHGPZUHg9WHQkyGLcYKXcv4i