title: How do I make this simple shellcode c program compile from terminal?
body: <p>I am trying to compile this using the terminal on ubuntu 12:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  #include &lt;stdlib.h&gt;
  
  main()
  
  {
      /*declare argument array*/
      char *args[2];
  
      args[0] = “/bin/bash”;
      args[1] = NULL;
  
      execve(args[0], args, NULL);
  
      exit(0);
  }
  </code></pre>
  
  <p>I found this example on <a href="http://www.securitytube.net/video/235" rel="nofollow">http://www.securitytube.net/video/235</a> which also happened to be the one Aleph One used in 'Smashing the Stack for Fun and Profit'. I am aware that much has changed since then. In more simple examples I have used:</p>
  
  <p>gcc -ggdb -mpreferred-stack-boundary=2 -fno-stack-protector filename filename.c</p>
  
  <p>Other times I may include the static utility. It has worked up until I have tried to compile the C code above. The message I receive from the terminal is:</p>
  
  <pre><code>ss@ss-laptop:~$ gcc -static -mpreferred-stack-boundary=2 -fno-stack-protector -o shell         shell.c
  shell.c: In function ‘main’:
  shell.c:9:2: error: stray ‘\342’ in program
  shell.c:9:2: error: stray ‘\200’ in program
  shell.c:9:2: error: stray ‘\234’ in program
  shell.c:9:15: error: expected expression before ‘/’ token
  shell.c:9:15: error: stray ‘\342’ in program
  shell.c:9:15: error: stray ‘\200’ in program
  shell.c:9:15: error: stray ‘\235’ in program
  ss@ss-laptop:~$
  </code></pre>
  
  <p>I understand that this is a very simple example and that this error is probably caused by current standard security measures in linux but I would like to get around them to practise with this example and more in the future. If anyone can help, it would be 'smashing'.</p>
  
  <p>cheers</p>