Skip to content

Undesired access to file system by bip_utils #141

Open
@Anynomouss

Description

I have a very strange issue with bip_utils, which I think I do not remember having in the past.
When running bip_utils on Windows Subsystems for Linux (Ubuntu20.04, also Ubuntu 22.04, both systems wide and clean virtual Python environments), bip-utils "Unlock drive" pop-ups from bitclocker, meaning that bip_utils or some component thereof is trying to access the filesystem. This is strange behavior and because there is a slight chance it is an exploit I am reporting it.

It is also mighty irritating since I am running Python scripts that utilize bip-utils in parellel triggering huge amounts of pop ups and notifications from Bitlocker, so many that I run out of RAM because of the number of pop-ups. Below is some example code, I narrowed it down to lines of code that trigger this strange behavior.


import binascii # for conversion between Hexa and bytes
from bip_utils import (P2PKHAddrEncoder, Bip32Slip10Secp256k1, Bip44, Bip49, Bip84, Bip86, Bip44Coins,Bip49Coins, Bip84Coins, Bip86Coins, Bip44Changes, Bip38Decrypter, Bip38Encrypter, CoinsConf,
                       ElectrumV1WordsNum, ElectrumV1MnemonicGenerator, ElectrumV1SeedGenerator, ElectrumV1, ## Electrum V1 dependencies only
                       ElectrumV2WordsNum, ElectrumV2MnemonicTypes, ElectrumV2MnemonicGenerator, ElectrumV2SeedGenerator, ElectrumV2Standard, ## Electrum V2 dependencies only
                       IPrivateKey, WifPubKeyModes, WifEncoder,WifDecoder,Bip32KeyData,Bip32KeyDeserializer)

from pybip39 import Mnemonic, Seed 
import csv
import os
import sys


mnemonics = sys.stdin.readlines() 

csvwriter = csv.writer(sys.stdout, delimiter=' ',lineterminator='\n') #os.linesep
mnemonic = Mnemonic() # This is slow =, so do only ones
for words in mnemonics:
    words = words.strip()
    try:
        #seed_bytes = mnemo.to_seed(words)
        mnemonic.validate(words)
        seed = Seed(mnemonic.from_phrase(words), "")
        seed_bytes = bytes(seed)
    except:
        continue
    #csvwriter.writerow([words])
    
    ## Any of the lines below trigger these pop ups meaning there is an attempt to access the file system
    bip32_ctx_m = Bip32Slip10Secp256k1.FromSeedAndPath(seed_bytes, 'm') # Derive at master level
    bip49_mst_ctx = Bip49.FromSeed(seed_bytes, Bip49Coins.BITCOIN)
    bip86_mst_ctx = Bip86.FromSeed(seed_bytes, Bip86Coins.BITCOIN)

The input of the test script is many lines with on each line a single mnemonic with words separated by pace. Save the script above as test_parallel_error.py and run it on any Windows Subsystems for Linux command shell to reproduce this behavior:

printf "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" {1..800000} | parallel --pipe -j 8--blocksize 10000 --spreadstdin python test_parallel_error.py

It should trigger these popups as long as you have at least one drive connected that is locked and encrypted with Bitlocker. Bitlocker popups are however only the symptom, the real question is why any part of bip utils is trying to get access to the file system in the first place.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions