Best bitcoin mining app mac
34 commentsBitcoin hash rate formula
As regular readers will be aware, I do a lot of work within the Bitcoin community contributing code wherever I can.
Recently an interesting problem came up with the Bitcoinj library which has highlighted a particular weakness within Maven that I feel more developers should be aware of: Imagine that some malicious developer, Mallory, was able to gain write access to a Maven repository that you used as part of your development. Mallory knows from examining your pom.
In the case of the Bitcoinj library this could be to copy the unencrypted private keys back to his server. Mallory deletes the original artifact and replaces it with his own which has the same version number as the original but a different SHA1 and does not contain a valid signature. The short answer is that you can't. You might get lucky in that you won't download the artifact since you have a local copy of the release, but if you move to another machine then you'll be pulling down the malicious code.
By obtaining a list of known good artifacts and their SHA1 signatures it is possible to build up a list of "approved" artifacts and detect when any have changed from expectations. As long as you remain in control of your source code repository then you can be sure that your whitelist has not been tampered with.
Obviously, if Mallory got control of your source code then all bets are off. I have released a simple DigestRule for use with the Maven Enforcer Plugin to provide such a whitelist. You can choose how detailed you want it to be depending on your own security requirements, but bear in mind that every unchecked dependency is a way in for an attacker through the back door.
The configuration below shows how you would use the DigestRule in your own projects. Of course the values used below should be treated only as examples. In production you would get the list of URNs as a GPG signed configuration from the developers of the project that you were depending on. Clearly trying to manually create the list of URNs would be a painful process, particularly in a large project with many layers of transitive dependencies to explore.
Fortunately, the buildSnapshot flag will cause the plugin to examine all the resolved dependencies within your project and build a list of URNs that you can copy-paste with caution into your build. For maximum effect, the rules should be triggered during the verify phase so that all the dependencies that could affect the build will have been pulled in.
This has the useful side effect that as a developer you're not continuously checking yourself for every build - only when you're about to perform an install or deploy. You can try it out on itself by checking out the source code from GitHub:. The reactor will first build the Digest Enforcer Rules and then go on to build another artifact that depends on them working the Rule Tester project. This second project demonstrates how you would include Digest Enforcer Rules in your projects.
One of the design goals was to allow Bitcoinj to be deployed into Maven Central with sufficient support that any compromise to either it or its supporting libraries could be detected. Now your projects that include Bitcoinj will be able to build through Travis or your own equivalent once Bitcoinj arrives in Maven Central or another controlled repo. Trust has to begin somewhere so I'm going to provide some signed declarations for each version in the GitHub repo. These can be validated against my public key 59A81D7B.
Obviously, you can also compile this code yourself and obtain the same result. Why not try to verify the certificate for version 0. If you are at all concerned about dependency-chain attacks, or just want to be that little bit safer when building, then please take a look at the project and offer up some critique if it doesn't meet your standards.
The project is not tied to Bitcoinj so developers in secure environments such as research, military or government establishments may also want to consider this as an additional layer of protection to those already in place. It may even allow you to start using open source where once you were unable due to the dependency-chain risk saving your department vast amounts of money otherwise spent on validation fees.
Consider a small donation: Preventing Dependency Chain Attacks in Maven. July 3, Comments Tags: