How'd you do it?
This happens with other exploits too.
This section should also tell us any relevant information about the
environment; for example, if an exploit that used to work is failing,
tell us the victim operating system and service versions.
What should happen?
Should run without any errors
What happens instead?
[-] 10.x.x.x:139 - RangeError
[-] 10.x.x.x:139 - bignum too big to convert into `long'
[-] 10.x.x.x:139 - <internal:prelude>:76:in `__read_nonblock'
<internal:prelude>:76:in `read_nonblock'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/rex-core-0.1.12/lib/rex/io/stream.rb:72:in `read'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/ruby_smb-0.0.18/lib/ruby_smb/dispatcher/socket.rb:54:in `recv_packet'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/ruby_smb-0.0.18/lib/ruby_smb/client.rb:229:in `send_recv'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/ruby_smb-0.0.18/lib/ruby_smb/client/negotiation.rb:36:in `negotiate_request'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/ruby_smb-0.0.18/lib/ruby_smb/client/negotiation.rb:14:in `negotiate'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/ruby_smb-0.0.18/lib/ruby_smb/client.rb:186:in `login'
/usr/share/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue.rb:310:in `smb1_anonymous_connect_ipc'
/usr/share/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue.rb:166:in `smb_eternalblue'
/usr/share/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue.rb:118:in `block in exploit'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/core_ext/range/each.rb:7:in `each'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/core_ext/range/each.rb:7:in `each_with_time_with_zone'
/usr/share/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue.rb:114:in `exploit'
/usr/share/metasploit-framework/lib/msf/core/exploit_driver.rb:206:in `job_run_proc'
/usr/share/metasploit-framework/lib/msf/core/exploit_driver.rb:167:in `run'
/usr/share/metasploit-framework/lib/msf/base/simple/exploit.rb:136:in `exploit_simple'
/usr/share/metasploit-framework/lib/msf/base/simple/exploit.rb:161:in `exploit_simple'
/usr/share/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb:110:in `cmd_exploit'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:548:in `run_command'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:510:in `block in run_single'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:504:in `each'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:504:in `run_single'
/usr/share/metasploit-framework/lib/rex/ui/text/shell.rb:206:in `run'
/usr/share/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
/usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
/usr/bin/msfconsole:48:in `<main>'
Framework: 4.16.36-dev
Console : 4.16.36-dev
Get this with the version command in msfconsole (or git log -1 --pretty=oneline for a source install).
What OS are you running Metasploit on?
4.12.0-kali2-686
What OS were you targeting?
Windows Server 2008.
Something similar happens sometimes when i start the msfconsole.
Hmm, if Kali is showing an error on startup, sounds like maybe a QE issue with the latest Kali packages. Not seeing this with anything local. What is your error on startup?
I don't think we would see this if Kali was shipping Ruby 2.4 since integer behavior changed from 2.3 to 2.4, /shrug
Ah, this is also 32-bit Kali linux. Sounds like Ruby 32-bit doesn't support reading > 2 or 4GB at a time. Well, a workaround could be to just use 64-bit Kali instead. We stopped shipping 32-bit for most Metasploit versions a year or two ago to avoid problems like this, so it doesn't get a lot of testing.
I tried the exploit on 32-bit Kali but still didn't see the issue yet.
Yes I'm using Kali 32-bit and I can't use the 64-bit version.
This is what i got when i start msfconsole:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb:92:in `not_after=': bignum too big to convert into `long' (RangeError)
from /usr/share/metasploit-framework/lib/msf/core/payload/android.rb:92:in `sign_jar'
from /usr/share/metasploit-framework/lib/msf/core/payload/android.rb:123:in `generate_jar'
from /usr/share/metasploit-framework/lib/msf/core/payload/android.rb:38:in `generate'
from /usr/share/metasploit-framework/lib/msf/core/payload.rb:204:in `size'
from /usr/share/metasploit-framework/lib/msf/core/payload_set.rb:158:in `block (2 levels) in recalculate'
from /usr/share/metasploit-framework/lib/msf/core/payload_set.rb:102:in `each_pair'
from /usr/share/metasploit-framework/lib/msf/core/payload_set.rb:102:in `block in recalculate'
from /usr/share/metasploit-framework/lib/msf/core/payload_set.rb:98:in `each_pair'
from /usr/share/metasploit-framework/lib/msf/core/payload_set.rb:98:in `recalculate'
from /usr/share/metasploit-framework/lib/msf/core/modules/loader/base.rb:251:in `block in load_modules'
from /usr/share/metasploit-framework/lib/msf/core/modules/loader/base.rb:248:in `each'
from /usr/share/metasploit-framework/lib/msf/core/modules/loader/base.rb:248:in `load_modules'
from /usr/share/metasploit-framework/lib/msf/core/module_manager/loading.rb:119:in `block in load_modules'
from /usr/share/metasploit-framework/lib/msf/core/module_manager/loading.rb:117:in `each'
from /usr/share/metasploit-framework/lib/msf/core/module_manager/loading.rb:117:in `load_modules'
from /usr/share/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:41:in `block in add_module_path'
from /usr/share/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `each'
from /usr/share/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `add_module_path'
from /usr/share/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:50:in `block in init_module_paths'
from /usr/share/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:49:in `each'
from /usr/share/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:49:in `init_module_paths'
from /usr/share/metasploit-framework/lib/msf/ui/console/driver.rb:196:in `initialize'
from /usr/share/metasploit-framework/lib/metasploit/framework/command/console.rb:62:in `new'
from /usr/share/metasploit-framework/lib/metasploit/framework/command/console.rb:62:in `driver'
from /usr/share/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
from /usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
from /usr/bin/msfconsole:48:in `<main>'
I hit the exact same error on Kali Linux 32bit live USB, 2018.1. Turned out if I ran
sudo apt-get update
then
sudo apt-get install metasploit-framework
then ran
msfconsole, it worked like a charm.
@DataandGoliath Still happens to me on the latest version.
@esfomeado Fraid I don't have any tips for that. Best of luck.
@esfomeado
I had the same issue you had but I found a fix.
Completely remove metasploit install.
Then rerun apt-get install metasploit-framework.
@Bry-fi Already tried that and the problem still persists.
On my system the error message typically involved the first line in the dump saying this:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb:92:in not_after=': bignum too big to convert intolong' (RangeError)
After trying the install uninstall reinstall foolishness I finally edited the file:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb
I changed the following line:
cert.not_after = cert.not_before + 360024365*2 # 2 years
Clearly android payloads are probably not going to work after this. But I am only using a 32bit version of Kali because that is what is provided for the PWK course.
Thanks.
OK, so after a bunch of experimentation, rerunning msfconsole three or four times would generally fix the problem. Just a little heads up, in case it helps.
Thanks for the clues guys! Will have a PR up to fix it shortly. This was a timebomb that got set-off on Jan 1st 2018 (the Y2k38 Problem)
Note that 32-bit OSes will continue to break over time, the fixes above are still going to be temporary.
2038 might sound like a long time away, but it's not.
@rtaylor777 This worked flawlessly for me. Thanks!
I was getting the same error for a different exploit, but discovered that I had an extra space in the commands. Worth double checking.
@rtaylor777 your solution worked. Im also using the Kali PWK image for the coursework. your solution fits the logic of the error and worked perfectly.
Thanks!
Mr. DataandGoliath or whatever your name, thanks for discouraging a newbie...
It was my first contribution to some kind of forum...
But because of you I promise I will never upload anything again...
@rajmalhotra786 I don't think you understand the question posed. Firstly, this is a bug in metasploits "msfconsole" - not "msfvenom" or that sort of tool. Secondly, neither of these solve the problem - the "-o to >" solution only applies to msfvenom, so that doesn't help here, and the "service postgresql start" doesn't solve the problem either - I know on my particular trouble ticket, and probably a good few others, the postgresql service _was_ running. And finally, neither of these fix the underlying issue in the Metasploit Framework, just how msfvenom encodes them into an output file - which is completely unrelated on not one but two counts. So, no, it won't solve the problem.
On an unrelated note, the "SIMPLE...Right???" tone is _extremely_ condescending and is highly unpleasant to read, particularly in a detailed, serious technical discussion - especially considering how the advice you proposed as a simple cure-all was in fact completely and utterly useless.
Oh, and PS: You might want to look into better formatting options for your MSFVenom usage - for example, I think you'll want to prepend an R to that > to create a raw executable. However, I don't use MSFVenom a lot, mostly for this sort of reason, so take that with a grain of salt.
The "*" symbols aren't displaying correctly on the page to show that you need to add the * between each number for the fix for the PWK lab. Remove the spaces around the * symbol.
cert.not_after = cert.not_before + 3600 * 24 * 365 * 2 # 2 years
I was unable to run metasploit at first (What I did, is that I just started postgresql service and run the "msfconsole" command line on my kali linux 32 bits.
What I did to fix the issue : I just run "msfdb start" and then re-run "msfconsole".
I hope that this might be useful to someone.
FWIW, this does affect msfvenom as well, and even meterpreter scripts such as run hashdump. The fix listed above (patching dalvik.rb) does work, and sometimes re-running the executable or script will work.
Non-determinism, yay.
I did not change anything. I used @thesilvereagle solution which works perfectly for me.
Cheers..
refering to rtaylor777 answer which pointed me to another solution since it still didn't fully work,
I replaced the file at framework/master/lib/msf/core/payload/android.rb
to this file: https://raw.githubusercontent.com/rapid7/metasploit-framework/master/lib/msf/core/payload/android.rb
which solved the problem.
Thank you for @rtaylor777 ,I follow you advice and it works!
i have n9005 htle running nethunter and i face the same problem before but i fixed it changing android.rb line 87 (from 20 years to 18 and delete numper from the 4 digits like that cert.not_after = cert.not_before + 3602465*18 # 18 years
This post helps in the fix https://kb.help.rapid7.com/discuss/5b351dd0c6901e0003deb559
# The timestamp 0x78045d81 equates to 2033-10-22 00:00:01 UTC
cert.not_after = Time.at(0x78045d81 + rand(0x7fffffff - 0x78045d81))
Fixed it for me.
@rtaylor777 This worked perfectly for me as well using the OS PWK Kali image for the course. Rock on!
RE @busterb > Thanks for the clues guys! Will have a PR up to fix it shortly. This was a timebomb that got set-off on Jan 1st 2018 (the Y2k38 Problem)
What is the lowest version I could install in order to get this bug fix?
@rtaylor777 thanks mate, this works well for me.
finally !!! resolved , change the 20 years to 2 only....follow the below
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb
https://raw.githubusercontent.com/rapid7/metasploit-framework/master/lib/msf/core/payload/android.rb
On my system the error message typically involved the first line in the dump saying this:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb:92:innot_after=': bignum too big to convert intolong' (RangeError)After trying the install uninstall reinstall foolishness I finally edited the file:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rbI changed the following line:
cert.not_after = cert.not_before + 3600_24_365_20 # 20 years cert.not_after = cert.not_before + 3600_24_365_2 # 2 years
Clearly android payloads are probably not going to work after this. But I am only using a 32bit version of Kali because that is what is provided for the PWK course.
Thanks.
thank u so much rtaylor777
On my system the error message typically involved the first line in the dump saying this:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb:92:innot_after=': bignum too big to convert intolong' (RangeError)After trying the install uninstall reinstall foolishness I finally edited the file:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rbI changed the following line:
cert.not_after = cert.not_before + 3600_24_365_20 # 20 years cert.not_after = cert.not_before + 3600_24_365_2 # 2 years
Clearly android payloads are probably not going to work after this. But I am only using a 32bit version of Kali because that is what is provided for the PWK course.
Thanks.
Thank you very much @rtaylor777
it works correctly man!!
Most helpful comment
On my system the error message typically involved the first line in the dump saying this:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb:92:in
not_after=': bignum too big to convert intolong' (RangeError)After trying the install uninstall reinstall foolishness I finally edited the file:
/usr/share/metasploit-framework/lib/msf/core/payload/android.rb
I changed the following line:
cert.not_after = cert.not_before + 360024365*20 # 20 years
cert.not_after = cert.not_before + 360024365*2 # 2 years
Clearly android payloads are probably not going to work after this. But I am only using a 32bit version of Kali because that is what is provided for the PWK course.
Thanks.