[π] Challenge Blockchain Hype - Wrong RSA-Module in pyc
See original GitHub issueπ Bug report
Description
The file announcement_encrypted.md, which is part of the challenge βBlockchain Hypeβ is not decryptable as the file /ftp/encrypt.pyc contains the wrong value for N. This is likely due to a mismatch between the sourcefile test/files/encrypt.py and the compiled file ftp/encrypt.pyc
Is this a regression?
No, the file hasnβt been modified since being added as part of bffa158b5c961d6e19b127150e91ec64924db73c
π¬ Minimal Reproduction
Download the file encrypt.pyc using null-byte-injection. Run it through a python decompiler. Uncompyle6 returned:
# uncompyle6 version 3.7.0
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.17 (default, Apr 15 2020, 17:20:14)
# [GCC 7.5.0]
# Embedded file name: encrypt.py
# Compiled at: 2020-05-20 18:58:36
confidential_document = open('announcement.md', 'r')
N = 36239973541558932215768154398027510542999295460598793991863043974317503405132258743580804101986195705838099875086956063357178601077684772324064096356684008573295186622116931603804539480260180369510754948354952843990891989516977978839158915835381010468654190434058825525303974958222956513586121683284362090515808508044283236502801777575604829177236616682941566165356433922623572630453807517714014758581695760621278985339321003215237271785789328502527807304614754314937458797885837846005142762002103727753034387997014140695908371141458803486809615038309524628617159265412467046813293232560959236865127539835290549091L
e = 65537
encrypted_document = open('announcement_encrypted.md', 'w')
for char in confidential_document.read():
encrypted_document.write(str(pow(ord(char), e, N)) + '\n')
encrypted_document.close()
# okay decompiling encrypt.py
It is not possible to decrypt the content of announcement_encrypted.md using this value N. Encryption works fine using the value for N from test/files/encrypt.py. The decrypt.py and decrypt._bruteforce.py contain the correct N as well. If I compile encrypt.py diff shows that the newly generated encrypt.pyc differs from ftp/encrypted.pyc. If I decompile the newly compiled encrypt.pyc again using uncompyle6 I get the correct value for N.
π₯ Exception or Error
N/A
π³ Your Environment
Docker Image: bkimminich/juice-shop:latest
Additional Information
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
@bkimminich Yes, this is indeed the wrong encrypted file, not sure how this went through. Thanks @timmar2000 for pointing out and fixing it. π
This thread has been automatically locked because it has not had recent activity after it was closed. π Please open a new issue for regressions or related bugs.