| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
The following code will be running as root (as a suid executable).
1. Does the following code contain any obvious vulnerabilities?
(If you're wondering, it's for a userland ping.)
void send_fd(int dest_sock, int sendme) { struct msghdr msg = {0}; char buf[CMSG_SPACE(sizeof(sendme))];
msg.msg_control = buf; msg.msg_controllen = sizeof(buf);
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = msg.msg_controllen = sizeof(buf);
*((int *) CMSG_DATA(cmsg)) = sendme;
if (sendmsg(dest_sock, &msg, 0) < 0) exit(1); }
int main(int args, char *argv[]) {
struct protoent *proto = getprotobyname("icmp");if(!proto) exit(1);
int sendme = socket(AF_INET, SOCK_RAW, proto->p_proto);
if(sendme < 0) exit(1);
send_fd(0, sendme);
exit(0); }
Attachment:
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.