exploitable function
hi, if this code is setuid root, is exploitable:
if(argc==2){
if(!strcmp("-show_release",argv[1]))
{
printf("%s\n", VERSION);
exit(1);
}
}Quoted 9 lines · xlp
hi, if this code is setuid root, is exploitable:
if(argc==2){ if(!strcmp("-show_release",argv[1])) { printf("%s\n", VERSION); exit(1); } }
It's not.
Elias
Signature · 1 line
http://gnewtellium.sourceforge.net MP3 is not a crime.
A message that is not in the archive (sent off-list or not yet received): 20020625163329.C27404@nietzsche
Quoted 1 line · xlp
anyway, it should no use strcmp, it should use strncmp ?
strcmp() compares, it doesn't copy stuff. It's quite safe.
Quoted 2 lines
by the way, where can i find a exploitable function and try to code epxloit proof for education and practice?
strcpy() is the number-one danger.
Elias
Signature · 1 line
http://gnewtellium.sourceforge.net MP3 is not a crime.
Quoted 4 lines · Elias Athanasopoulos
Quoted 2 lines
by the way, where can i find a exploitable function and try to code epxloit proof for education and practice?
strcpy()is the number-one danger.
But note that strncpy() isn't much better, for two reasons:
1. If the source is longer than the size of the buffer, there won't be a terminating NUL in the result.
2. If a string is too long, simply truncating it to a fixed length is seldom the correct response, and may have security implications. It's usually preferable to treat this situation as a fatal error, and terminate the program.
Signature · 1 line
Glynn Clements <[email protected]>
Quoted 1 line · Glynn Clements
But note that
strncpy()isn't much better, for two reasons:
Yes. Better use strdup(). In binutils we use xstrdup() in most of the cases and str[n]cpy() carefully.
Elias
Signature · 1 line
http://gnewtellium.sourceforge.net MP3 is not a crime.