Hello forum,

i know that it is possible to retrieve process information (about the sending process) over a unix domain socket using getsockopt in association with the SO_PEERCRED option.

Code:
getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);
the ucred structure cred has three components uid, gid and pid of the sender process.

Is there a possibility to fake this information. For example to fake the uid, gid or pid that the getsockopt-call will returned the faked one.

The classic way of credential passing (described in R.Stevens), with SCM_CREDENTIALS, allows passing credentials with the sendmsg, recvmsg calls. In this way it is possible to change the pid, gid and uid. But it seems that the change of this three id's doesn't have any effect for the getsockopt-SO_PEERCRED-call.

It would be very nice if someone could help me (maybe with a little code-snippet )
Thank you very much
jeyte