lock
I get overflow even if I input just an "a"
Anonymous
huh?
Mihail
lock
no
lock
$./md5crypt
[=] Password: d
Violación de segmento
lock
(Violacion de Segmento) = (Segmentation Fault) in spanish
Mihail
but how are you sure it's exactly fgets where the segfault is?
Mihail
can we see md5crypt and hexencode?
lock
cause I wrote a printf after it to test and I don't
lock
get the output
Anonymous
that code works well though
Mihail
did you flush?
lock
no
Mat
Mihail
well do that
Mat
Use a debugger 😂
Mihail
so the printf and then fflush(stdout);
Anonymous
I have had to delete these lines
Anonymous
it doesn't seem there's something wrong with fgets
Mihail
yeah the fgets usage is correct so it's not that
Mihail
and if you flush stdout after that printf you had added you'd see the text would print
Anonymous
we need md5crypt and hexencode functions
Mihail
lock
main.c
lock
/ RETO 08 /
#include <openssl/md5.h>
#include <stdio.h>
#include "md5.h"
#include "hex.h"
int main() {
char pass[30];
char *out;
char *out2;
printf("[=] Password: ");
fflush(stdout);
fgets(pass, sizeof(pass), stdin); // err
out = md5crypt(pass);
out2 = hexencode(out);
if(strcmp(out2, "E492931E5DAA29C4B1FE5B4A924567DB") == 0) {
printf("[+] Access granted, use the password as flag!\n");
exit(1);
} else {
printf("[-] Try again!\n");
}
return 0;
}
Mihail
pastebin if it's long
lock
hex.c
lock
/ Hex Encoder Function /
unsigned char hexencode(unsigned char str[200]) {
int i,j;
unsigned char strH[400];
memset(strH,0,sizeof(strH));
for(i=0,j=0;i<strlen(str);i++,j+=2) {
sprintf((char*)strH+j,"%02X",str[i]);
}
strH[j]='\0';
return strH;
}
Anonymous
and still you have a buffer overflow in your program if you pass that long md5 value from the condition
lock
md5.c
lock
/ MD5 Encrypt /
#include <openssl/md5.h>
unsigned char md5crypt(unsigned char password[30]) {
unsigned char hash[MD5_DIGEST_LENGTH];
MD5(password, sizeof(password), hash);
return hash;
}
Anonymous
use pastebin please
lock
okay
lock
ill upload wait
Mihail
nvm leave it
lock
hxxps://pastebin.com/d4bb4pqR
lock
main.c
lock
hxxps://pastebin.com/G9U0WgSQ
lock
hex.c
lock
hxxps://pastebin.com/bBTTV0JG
lock
md5.c
Anonymous
it's hexencode
Anonymous
the loop
lock
And what's the problem?
Anonymous
seems like you don't know the difference between arrays and pointers
lock
no 😂
lock
I know what an array is
klimi
You need basics dude
lock
but not a pointer
klimi
Like what a computer is
klimi
And how it works
Anonymous
And what's the problem?
and it's triggered because md5crypt returns null, which you're trying to pass in hexencode
Anonymous
And what's the problem?
md5crypt is most likely written the wrong way, which probably triggers segmentation fault. you should rewrite the function
professor
Anonymous
the program doesn't even reach the part where there should be a new issue
professor
if you try to insert 32 into 30 you will likely get a segmentation fault 32 md5 + nullterminator the last digit or alphabet from md5 is overflow :)
John
Hi could someone help me with a program in c. I could tell the details if you pm me please?
Mihail
Artöm
John
Could I paste some code here?
Anonymous
Preferably use pastebin.
John
its not a lot
Anonymous
Go ahead then.
John
Rip didn't let me post it
Anonymous
"https://pastebin.com/ecBDxTVA I have a question about the \"null\" whats like the opposite of it so I can make a windows with the eula pop up"
John
Thank you! ^
John
a window*
John
Did you understand my question or do I have to be more specific?
Anonymous
Sorry, you'll probably be requested to provide more details
Anonymous
That piece of code doesn't tell anything
John
What's the opposite of null? This is a dumb question I know so basically I have a problem with my program where when I open it it says there is an unhandled exception
Artöm
John
Nevermind I got it
lock
lock
I inserted just one byte
professor
It doesn’t matter if out2 is having pass variable to stored its value = overflow
psy4
n1coc4cola
Someone know some Qt5 IMAP libraries?
n1coc4cola