Author Topic: -no-fstack-protector & Code::Blocks  (Read 8912 times)

Offline lacao

  • Single posting newcomer
  • *
  • Posts: 3
-no-fstack-protector & Code::Blocks
« on: April 25, 2008, 11:05:46 pm »
Hello,

I just want to know under Code::Blocks (Windows XP Pro SP2) I can disable the stack protection with the -no-stack-protector, under Linux with GCC I will run:
gcc -no-fstack-protector main.c -o main.o
but with Code::Blocks and Windows, I don't know how to do that :s

If anyone knows this...

Sorry for my english speaking ;)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: -no-fstack-protector & Code::Blocks
« Reply #1 on: April 25, 2008, 11:22:08 pm »
you can add it at :
- compiler level : compiler and debugger settings of CB
- compiler options of your project
- compiler options of your target
Your choice.

For example : Project build options ; choose your target : compiler settings : Other options : there you paste your option. Things pasted in there are added to the command invocation of gcc.

Offline lacao

  • Single posting newcomer
  • *
  • Posts: 3
Re: -no-fstack-protector & Code::Blocks
« Reply #2 on: April 25, 2008, 11:45:55 pm »
Thanks for your reply :)
I have already intend this two last solutions, but i don't see where I can make at the compiler level.

Is it possible -no-fstack-protector could not be given to the compiler as option, or something like that? because Code::Blocks says me :
mingw32-gcc.exe unrecognized option '-no-fstack-protector'

I have checked under linux with the man of gcc and the syntaxe options is good, and works under linux with gcc, so is it possible mingw don't know this option?

Still sorry for my english ... :(

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: -no-fstack-protector & Code::Blocks
« Reply #3 on: April 26, 2008, 05:58:20 am »
Did you Try -fno-stack-protector  ?

What version of GCC?

Tim S
« Last Edit: April 26, 2008, 06:01:16 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: -no-fstack-protector & Code::Blocks
« Reply #4 on: April 26, 2008, 08:34:23 am »
What version of GCC?
Tim S
Hi Tim,

you are a little faster than me.
That was my question too.

I'm not sure, but afaik the stack-protection commandline is implemented since gcc 4.1.

Offline lacao

  • Single posting newcomer
  • *
  • Posts: 3
Re: -no-fstack-protector & Code::Blocks
« Reply #5 on: April 26, 2008, 11:57:52 am »
I have tried -fno-stack-protector too. :(
But it could be the version of gcc like you said stahta01 and jens because the stack protector was implemented in gcc 4.1, and when I 'am in the directory of mingw and i type gcc -v in command line (under windows) the result is:
gcc version 3.4.5 (mingw-vista special)

But is it possible the stack protector was implemented event though it's a older version ?

In reality I'm learning the stack overflow with Code::Blocks & OllyDbg, and when I overwrite EIP to put the address of my shellcode, a part of the shellcode (not totally)  is executed but on an instruction of the shellcode this doesn't works, and make the program stop. The shellcode works because I have tried it with a function pointer and it works.

Is there some others securitys have been implemented, like the stack protector in mingw?
 
I know it's a newbie problem but it make some days i block on that... :(

If you want another information to resolve the problem tell me.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: -no-fstack-protector & Code::Blocks
« Reply #6 on: April 28, 2008, 09:35:16 am »
Well, that option is only available in gcc 4.3 4.2 and later.
« Last Edit: April 28, 2008, 09:37:23 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."