I'm new to the subject of computer security, and I came across this table
char *
isdn_net_newslave(char *parm)
{
char *p = strchr(parm, ',');
isdn_net_dev *n;
char newname[10];
if (p) {
/* Slave-Name MUST not be empty */
if (!strlen(p + 1))
return NULL;
strcpy(newname, p + 1);
*p = 0;
/* Master must already exist */
if (!(n = isdn_net_findif(parm)))
return NULL;
/* Master must be a real interface, not a slave */
if (n->local->master)
return NULL;
/* Master must not be started yet */
if (isdn_net_device_started(n))
return NULL;
return (isdn_net_new(newname, n->dev));
}
return NULL;
}
I want to get a root shell by exploiting strcpy()
or strchr()
.
I have some troubles exploiting this with C, though it's got a strcpy()
and strchr()
inside it, because this is my first buffer overflow exploitation.
My Questions:
I don't know about ASLR well. How does it disturb the buffer overflow with a C script? I don't want to disable it, I'm looking at practical exploitation.
How to manipulate the variable newname
?
And how to target this exact piece of code? Actually this code starts at Line 2639 in original code.
Please help me with this! Thank you!
Original Code: