DEV Community

mibii
mibii

Posted on

Story - how Slope wallet developers stole 10 mil $

Crypto Catastrophe: A $10 Million Lesson in Wallet Security
Hey fellow devs and crypto enthusiasts! Today, I'm sharing a hair-raising tale from the wild west of cryptocurrency that'll make you think twice about your wallet security. Buckle up, because this story's got it all - hackers, millions in stolen funds, and a wake-up call for the entire crypto community.
Picture this: It's August 2022, and thousands of Solana users are about to have a very bad day. A popular wallet called "Slope," downloaded straight from the Google Play store, turns out to be a wolf in sheep's clothing. The result? Over 10 million bucks in Solana cryptocurrency, gone in a flash.
The Hack That Shook Solana

Image description

Let's cut to the chase:

The "hackers" weren't external actors - they were the Slope wallet developers themselves. Talk about a wolf in sheep's clothing!
These scammer-developers created a wallet where the "randomly" generated seed phrases were anything but random.
The wallet-generated seed phrases contained zero entropy and were completely predetermined by the Slope team.
This treachery affected not just direct Slope users, but anyone who used their Slope-generated seed phrase in other wallets like Trust Wallet or Phantom. (Remember folks: never reuse seed phrases across wallets or countries!)
Once the scam was uncovered, Slope got booted from the Play store faster than you can say "rug pull," but for the victims? Too little, too late. No compensation, just a harsh lesson learned.

The Million-Dollar Question: How Did They Pull It Off?

It's both simple and devious. The Slope wallet developers created a system where they knew every seed phrase their wallet would generate. It's like they were handing out house keys, but keeping copies for themselves. When the time was right, they used these predetermined phrases to swipe over $10 million in Solana crypto.

The Lesson We All Need to Learn

Here's the kicker, folks: You can't trust a wallet's generated passwords if you don't know where the randomness (we call it entropy) comes from. In the case of Slope, that "random" seed phrase was about as unpredictable as the sunrise, pre-programmed by the scammer developers themselves.

Even folks using the same seed phrase in other wallets like Trust Wallet or Phantom got hit. (Pro tip: never reuse seed phrases across wallets or countries!)
Slope got booted from the Play store faster than you can say "blockchain," but for the victims? Too little, too late. No compensation, just a harsh lesson learned.

Taking Control: Be Your Own Entropy Master

But don't worry, I've got your back. Today, we're gonna dive into creating your very own seed phrase generator. Why trust someone else when you can trust yourself, right?
The Secret Sauce: User-Generated Entropy
We're talking about using your own actions - mouse moves, key presses, the works - to create true randomness. It's like being your own cryptographic superhero!

Show Me the Code!

Alright, code ninjas, here's a NodeJS snippet that'll let you generate a mnemonic phrase using your own entropy:

const bip39 = require('bip39');
const readline = require('readline');

// Variables to store collected entropy
let collectedEntropy = '';
let entropyLength = 256; // Number of bits of entropy

// Create a readline interface for user input
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

// Function to generate random bytes based on collected entropy
function customRandomBytes(size) {
  while (collectedEntropy.length < size * 2) {
    // Wait until enough entropy is collected
  }

  const randomBytes = collectedEntropy.slice(0, size * 2);
  collectedEntropy = collectedEntropy.slice(size * 2);

  return Buffer.from(randomBytes, 'hex');
}

// Prompt the user to start entropy collection
console.log('Press any keys to start creating entropy...');
rl.input.once('keypress', () => {
  console.log('Collecting entropy...');

  // Listen for key presses to collect entropy
  rl.input.on('keypress', (character, key) => {

      collectedEntropy += character.charCodeAt(0).toString(16);
      if (collectedEntropy.length >= entropyLength * 2) {
        console.log('Enough entropy collected.');
        rl.close();

        // Generate mnemonic using customRandomBytes function
        const mnemonic = bip39.generateMnemonic(entropyLength, customRandomBytes);
        console.log('Generated mnemonic:', mnemonic);
      }

  });
});

// Start listening for key presses
rl.input.setRawMode(true);
rl.resume();

Enter fullscreen mode Exit fullscreen mode

Now, let's break down how to use this code, step by step, so even beginners can create their own secure seed phrase:

Set Up Your Environment:

Make sure you have Node.js installed on your computer.
Create a new directory for your project and navigate to it in the terminal.

Initialize Your Project (create a package.json file.):

npm init -y
Enter fullscreen mode Exit fullscreen mode

Install Dependencies ( BIP39 library.):

npm install bip39
Enter fullscreen mode Exit fullscreen mode

Create Your Script:

Make a new file, let's call it seedGenerator.js.
Copy and paste the provided code snippet into this file.

Run the Script:

In your terminal, run

node seedGenerator.js.
Enter fullscreen mode Exit fullscreen mode

Generate Entropy:

The program will prompt you to "Press any keys to start creating entropy..."
Once you press a key, it'll start collecting entropy.
Keep pressing random keys until you see "Enough entropy collected."

Get Your Seed Phrase:

The program will output your generated mnemonic phrase.
Write this down and keep it safe! This is your new, secure seed phrase.

Remember, the security of your crypto stash starts with a solid seed phrase. By understanding entropy and using tools you trust (like the one you just made!), you're taking a huge step in protecting your digital assets.
Stay sharp, stay secure, and may your investments always moon! 🚀

Top comments (0)