Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spoilers] Unable to sign transaction with other private key #14

Open
joleeee opened this issue Jun 17, 2022 · 4 comments
Open

[Spoilers] Unable to sign transaction with other private key #14

joleeee opened this issue Jun 17, 2022 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@joleeee
Copy link
Contributor

joleeee commented Jun 17, 2022

I'm on compromised, and I've found some private keys, but I'm not sure it's possible to sign and "broadcast" transaction inside solidity

Is the intended solution to just vm.prankStart() with the public address? so vm.prankStart(vm.addr(privkey))

@nicolasgarcia214
Copy link
Owner

Could you give me more details of what you are trying to do?

@nicolasgarcia214 nicolasgarcia214 added the help wanted Extra attention is needed label Jun 24, 2022
@joleeee
Copy link
Contributor Author

joleeee commented Jun 24, 2022

I found the private keys using the hex encoded base64 encoded hex string, but im unable to use them to sign transactions as that's not something you can do in solidity, and foundry/ds-test doesnt have any way to do it either, im quite certain. Instead i just pranked as the addresses the private keys corresponds to.

Is that the intended way to solve this challenge, it feels quite hacky?

joleeee@ca831d8#diff-8004eac9b4f173d074e60af7c5392a2712de47d034835039d8a2b9571860b9f1R77-R79

@iFrostizz
Copy link

I guess that asserting that the public key that is one of the trusted sources from the private keys you found is "enough" as a proof that you found it and it's fair to use the vm.startPrank(address) afterwards

https://github.com/iFrostizz/damn-vulnerable-defi-foundry/blob/aa8fcddd5d654a5ba82f900a5e965a776fae6043/test/Levels/compromised/Compromised.t.sol#L79-L98

A better solution would be to sign and send the transaction but I don't know if it's feasible with the cheatcodes

@JustBeYou
Copy link

You can use vm.addr(privateKey) to get the corresponding address. Then you can use startPrank/startBroadcast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants