Performing a dictionary attack on RSA/ECB with no padding
up vote
3
down vote
favorite
I have the exponent $e=2^{16}+1$ and modulus $n$ (154 digit number) of an RSA public key along with the ciphertext (64 bytes) encrypted using the same key with RSA/ECB and no padding.
I am required to decrypt the ciphertext and have two options:-
Find the prime factors of $n$, $p$ and $q$, to determine the private key which can then be used for decryption, or
Use a dictionary attack (~135k words)
The first option does not seem feasible to me considering how big the modulus is and so I think the second option is more likely.
My question then is, where would I begin with a dictionary attack on the above cipher text? My initial idea is to iterate through every word in the dictionary, encrypt it using the public key above and check to see if the cipher text contains the result, but words in the dictionary have lengths up to 30 so this would definitely take a while.
encryption rsa public-key ecb dictionary-attack
add a comment |
up vote
3
down vote
favorite
I have the exponent $e=2^{16}+1$ and modulus $n$ (154 digit number) of an RSA public key along with the ciphertext (64 bytes) encrypted using the same key with RSA/ECB and no padding.
I am required to decrypt the ciphertext and have two options:-
Find the prime factors of $n$, $p$ and $q$, to determine the private key which can then be used for decryption, or
Use a dictionary attack (~135k words)
The first option does not seem feasible to me considering how big the modulus is and so I think the second option is more likely.
My question then is, where would I begin with a dictionary attack on the above cipher text? My initial idea is to iterate through every word in the dictionary, encrypt it using the public key above and check to see if the cipher text contains the result, but words in the dictionary have lengths up to 30 so this would definitely take a while.
encryption rsa public-key ecb dictionary-attack
seclab.upenn.edu/projects/faas "is designed to allow anyone to factor 512-bit integers in as little as four hours using the Amazon EC2 platform for less than $100" also crypto.stackexchange.com/questions/3931/…
– dave_thompson_085
Dec 4 at 3:08
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I have the exponent $e=2^{16}+1$ and modulus $n$ (154 digit number) of an RSA public key along with the ciphertext (64 bytes) encrypted using the same key with RSA/ECB and no padding.
I am required to decrypt the ciphertext and have two options:-
Find the prime factors of $n$, $p$ and $q$, to determine the private key which can then be used for decryption, or
Use a dictionary attack (~135k words)
The first option does not seem feasible to me considering how big the modulus is and so I think the second option is more likely.
My question then is, where would I begin with a dictionary attack on the above cipher text? My initial idea is to iterate through every word in the dictionary, encrypt it using the public key above and check to see if the cipher text contains the result, but words in the dictionary have lengths up to 30 so this would definitely take a while.
encryption rsa public-key ecb dictionary-attack
I have the exponent $e=2^{16}+1$ and modulus $n$ (154 digit number) of an RSA public key along with the ciphertext (64 bytes) encrypted using the same key with RSA/ECB and no padding.
I am required to decrypt the ciphertext and have two options:-
Find the prime factors of $n$, $p$ and $q$, to determine the private key which can then be used for decryption, or
Use a dictionary attack (~135k words)
The first option does not seem feasible to me considering how big the modulus is and so I think the second option is more likely.
My question then is, where would I begin with a dictionary attack on the above cipher text? My initial idea is to iterate through every word in the dictionary, encrypt it using the public key above and check to see if the cipher text contains the result, but words in the dictionary have lengths up to 30 so this would definitely take a while.
encryption rsa public-key ecb dictionary-attack
encryption rsa public-key ecb dictionary-attack
edited Dec 3 at 13:23
asked Dec 3 at 13:08
2nce
254
254
seclab.upenn.edu/projects/faas "is designed to allow anyone to factor 512-bit integers in as little as four hours using the Amazon EC2 platform for less than $100" also crypto.stackexchange.com/questions/3931/…
– dave_thompson_085
Dec 4 at 3:08
add a comment |
seclab.upenn.edu/projects/faas "is designed to allow anyone to factor 512-bit integers in as little as four hours using the Amazon EC2 platform for less than $100" also crypto.stackexchange.com/questions/3931/…
– dave_thompson_085
Dec 4 at 3:08
seclab.upenn.edu/projects/faas "is designed to allow anyone to factor 512-bit integers in as little as four hours using the Amazon EC2 platform for less than $100" also crypto.stackexchange.com/questions/3931/…
– dave_thompson_085
Dec 4 at 3:08
seclab.upenn.edu/projects/faas "is designed to allow anyone to factor 512-bit integers in as little as four hours using the Amazon EC2 platform for less than $100" also crypto.stackexchange.com/questions/3931/…
– dave_thompson_085
Dec 4 at 3:08
add a comment |
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
If the public modulus was generated properly, option 2 (brute force dictionary search of candidate plaintext) will be faster. Option 1 (factoring a ≈512-bit RSA integer) is feasible, but can be quite compute-intensive even with the best known algorithm (GNFS). On the other hand, if random padding was used (as it should, and would be in any good practice), option 2 would not be feasible.
First things are to determine how exactly a dictionary word would be encrypted, including formatting of the ciphertext.
I think Python 3 might be acceptably fast just checking if pow(m,e,n)==c
where m
varies over the plaintexts appropriately converted to integer as in the encrption, and c
is the ciphertext appropriately converted back to integer. For (perhaps only slightly) better speed, write a compiled program using GMP.
1
Thanks a trillion, using pow() and converting the ciphertext back to an integer was just what I needed. I managed to successfully decrypt the word :)
– 2nce
Dec 3 at 13:49
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "281"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f64521%2fperforming-a-dictionary-attack-on-rsa-ecb-with-no-padding%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
If the public modulus was generated properly, option 2 (brute force dictionary search of candidate plaintext) will be faster. Option 1 (factoring a ≈512-bit RSA integer) is feasible, but can be quite compute-intensive even with the best known algorithm (GNFS). On the other hand, if random padding was used (as it should, and would be in any good practice), option 2 would not be feasible.
First things are to determine how exactly a dictionary word would be encrypted, including formatting of the ciphertext.
I think Python 3 might be acceptably fast just checking if pow(m,e,n)==c
where m
varies over the plaintexts appropriately converted to integer as in the encrption, and c
is the ciphertext appropriately converted back to integer. For (perhaps only slightly) better speed, write a compiled program using GMP.
1
Thanks a trillion, using pow() and converting the ciphertext back to an integer was just what I needed. I managed to successfully decrypt the word :)
– 2nce
Dec 3 at 13:49
add a comment |
up vote
4
down vote
accepted
If the public modulus was generated properly, option 2 (brute force dictionary search of candidate plaintext) will be faster. Option 1 (factoring a ≈512-bit RSA integer) is feasible, but can be quite compute-intensive even with the best known algorithm (GNFS). On the other hand, if random padding was used (as it should, and would be in any good practice), option 2 would not be feasible.
First things are to determine how exactly a dictionary word would be encrypted, including formatting of the ciphertext.
I think Python 3 might be acceptably fast just checking if pow(m,e,n)==c
where m
varies over the plaintexts appropriately converted to integer as in the encrption, and c
is the ciphertext appropriately converted back to integer. For (perhaps only slightly) better speed, write a compiled program using GMP.
1
Thanks a trillion, using pow() and converting the ciphertext back to an integer was just what I needed. I managed to successfully decrypt the word :)
– 2nce
Dec 3 at 13:49
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
If the public modulus was generated properly, option 2 (brute force dictionary search of candidate plaintext) will be faster. Option 1 (factoring a ≈512-bit RSA integer) is feasible, but can be quite compute-intensive even with the best known algorithm (GNFS). On the other hand, if random padding was used (as it should, and would be in any good practice), option 2 would not be feasible.
First things are to determine how exactly a dictionary word would be encrypted, including formatting of the ciphertext.
I think Python 3 might be acceptably fast just checking if pow(m,e,n)==c
where m
varies over the plaintexts appropriately converted to integer as in the encrption, and c
is the ciphertext appropriately converted back to integer. For (perhaps only slightly) better speed, write a compiled program using GMP.
If the public modulus was generated properly, option 2 (brute force dictionary search of candidate plaintext) will be faster. Option 1 (factoring a ≈512-bit RSA integer) is feasible, but can be quite compute-intensive even with the best known algorithm (GNFS). On the other hand, if random padding was used (as it should, and would be in any good practice), option 2 would not be feasible.
First things are to determine how exactly a dictionary word would be encrypted, including formatting of the ciphertext.
I think Python 3 might be acceptably fast just checking if pow(m,e,n)==c
where m
varies over the plaintexts appropriately converted to integer as in the encrption, and c
is the ciphertext appropriately converted back to integer. For (perhaps only slightly) better speed, write a compiled program using GMP.
edited Dec 3 at 18:35
answered Dec 3 at 13:37
fgrieu
77.4k7160326
77.4k7160326
1
Thanks a trillion, using pow() and converting the ciphertext back to an integer was just what I needed. I managed to successfully decrypt the word :)
– 2nce
Dec 3 at 13:49
add a comment |
1
Thanks a trillion, using pow() and converting the ciphertext back to an integer was just what I needed. I managed to successfully decrypt the word :)
– 2nce
Dec 3 at 13:49
1
1
Thanks a trillion, using pow() and converting the ciphertext back to an integer was just what I needed. I managed to successfully decrypt the word :)
– 2nce
Dec 3 at 13:49
Thanks a trillion, using pow() and converting the ciphertext back to an integer was just what I needed. I managed to successfully decrypt the word :)
– 2nce
Dec 3 at 13:49
add a comment |
Thanks for contributing an answer to Cryptography Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f64521%2fperforming-a-dictionary-attack-on-rsa-ecb-with-no-padding%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
seclab.upenn.edu/projects/faas "is designed to allow anyone to factor 512-bit integers in as little as four hours using the Amazon EC2 platform for less than $100" also crypto.stackexchange.com/questions/3931/…
– dave_thompson_085
Dec 4 at 3:08