Posts Tagged ‘ruby’

ruby: stack level too deep

Wednesday, May 19th, 2010

I have been working on a ruby script that sends the payloads from Metasploit to a certain server in order to save a trace of the actual payload. I need these traces to test the effectiveness of snort against the attacks in Metasploit. However some payloads are kinda big and I ran into the following error:

ruby: stack level too deep (SystemStackError)

I found a simple solution for this problem here. A simple increase of the stack size of the shell solved the problem. The following command shows the stack size of the shell:

ulimit -a
stack size (kbytes, -s) 8192

I simply increased this to 25000 which was a bit bigger than the largest payload I have generated out of Metasploit:

ulimit -s 25000

I have no idea what the consequences are but at least my script is running now :). Keep in mind that the stack size only increases for the active shell. It has no influence on other shells or newly created shells.