Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since the <code>suid</code> bit on executables only changes the effective UID (EUID) the executable will run as, and not the real UID (RUID) which <code>getuid()</code> returns, and in addition to the restriction on <code>suid</code> interpreted scripts (any executable beginning with "<code>#!</code>"), some shells like <code>bash</code> as an extra safety measure will set the EUID back to the RUID in this case, you will need to use the call <code>setuid(0)</code> in the C code before executing the script.</p> <p>See the <code>man</code> pages of the <code>setuid</code>, <code>seteuid</code>, <code>getuid</code>, and <code>geteuid</code> to learn the exact semantics of the real and effective UIDs.</p> <p>(<em>WARNING</em>) Of course, this is an appropriate point to mention that the restriction on <code>suid</code> scripts in many Unix systems, shells and interpreters, are there for a reason, which is that if the script is not very careful about sanitizing its input and the state of environment when it is executed, they are dangerous and can be exploited for security escalation. So be very careful when doing this. Set the access to your script and wrapper as strict as you can, only allow this very specific script which you intend to be executed, and clear the environment within your C program before starting the script, setting environment variables such as <code>PATH</code> to contain exactly what is necessary in the right order and no directories that are writable to others.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload