|
328 | 328 | \label{ROOT_SETUID} |
329 | 329 |
|
330 | 330 | \begin{itemize} |
331 | | -\item \label{SUID_BIT} bity SUID a SGID se pou¾ívají u programù, které potøebují vìt¹í |
332 | | -pøístupová práva, ne¾ má u¾ivatel, jen¾ je spou¹tí. Pøíkladem je program |
333 | | -\texttt{passwd}, který musí aktualizovat soubory \texttt{/etc/passwd} a |
334 | | -\texttt{/etc/shadow}, kde ten první ne\-mù\-¾e bì¾ný u¾ivatel mìnit a druhý z |
335 | | -nich ani èíst. Dal¹í pøíklad je program \texttt{su}. Ten musí mít právo |
336 | | -libovolnì zmìnit u¾ivatelskou a skupinovou identitu, co¾ je privilegium |
337 | | -procesù s UID 0. |
338 | | - |
339 | | - |
340 | | -\item SUID a SGID programy by mìly být peèlivì naprogramovány, aby dovolily |
341 | | -pouze ty operace, pro které jsou urèeny, a neumo¾nily zneu¾ít jejich |
342 | | -privilegia pro neoprávnìné akce (napø. spu¹tìní rootovského shellu). Zku¹enost |
343 | | -ukazuje, ¾e tyto programy jsou jednou z nejèastìj¹ích pøíèin bezpeènostních |
344 | | -problémù UNIXových systémù. |
345 | | -\item základním pravidlem pro SUID programy je: \emsl{nepi¹te je} pokud to |
346 | | -není opravdu nezbytné. Je to typické místo pro generování bezpeènostních chyb |
347 | | -proto¾e dobøe, tj. bezpeènì, napsat slo¾itìj¹í SUID program není jednoduché. |
348 | | -\item \emsl{toto jsou pravidla pro zmìny:} |
| 331 | +\item \label{SUID_BIT} The SUID and SGID bits are used for programs that need |
| 332 | +bigger privileges thatn the user who executes them. One example is the |
| 333 | +\texttt{passwd} program that needs to update files \texttt{/etc/passwd} and |
| 334 | +\texttt{/etc/shadow}, where the ordinary user cannot modify the first and |
| 335 | +cannot write into the the second. Another example is the \texttt{su} program, |
| 336 | +which has to have the right to arbitrarily change user and group identity, |
| 337 | +which is a privilege of programs running with UID 0. |
| 338 | +\item Programs using the SUID and SGID bits should be carefully programmed |
| 339 | +to allow only such operations for which they were designed and prevent misuse |
| 340 | +of their privileges for non-authorized actions (root shell execution). |
| 341 | +Such programs used to be one of the most frequent causes of security problems |
| 342 | +in Unix systems. |
| 343 | +\item The basic rule for writing SUID/SGID programs is: \emsl{do not write |
| 344 | +them} if it is not absolutely necessary. This area is typical as security |
| 345 | +problem generator. It is not easy to produce correct (i.e. secure) SUID/SGID |
| 346 | +program, especially of higher complexity. |
| 347 | +\item \emsl{These are the rules for ID change:} |
349 | 348 | \begin{itemize} |
350 | | -\item be¾ný u¾ivatel nemù¾e zmìnit své RUID nebo uschované SUID (vyjímka je |
351 | | -pøi volání \texttt{exec}, viz strana \pageref{EXEC}) |
352 | | -\item proces mù¾e v¾dy zmìnit své EUID na to z RUID nebo z uschovaného UID. |
353 | | -Toto zaruèuje, ¾e v SUID programu je mo¾né libovolnì mìnit EUID mezi tím |
354 | | -pùvodním kterým proces získal práva vlastníka a mezi UID skuteèného u¾ivatele |
355 | | -který daný proces spustil. |
356 | | -\item \emsl{root mù¾e v¹echno}, a kdy¾ zmìní RUID, tak se zároveò zmìní i |
357 | | -uchované UID -- nemìlo by smysl mìnit jen jedno z nich kdy¾ kterékoli mù¾ete |
358 | | -pou¾ít pro nastavení EUID. |
| 349 | +\item ordinary user cannot change its RUID or saved UID (the \texttt{exec} is an |
| 350 | +exception to that, see page \pageref{EXEC}) |
| 351 | +\item the process can always change its EUID to that of RUID or saved UID. |
| 352 | +This guarantees that in SUID program it is possible to arbitrarily change EUID |
| 353 | +between the one that enabled the process to gain ownership rights and the |
| 354 | +UID of the real user that executed the process originally. |
| 355 | +\item \emsl{root can do everything}, and when it changes RUID, it will also |
| 356 | +change saved UID -- it does not make sense to change just one of them when |
| 357 | +either can be used to set EUID. |
359 | 358 | \end{itemize} |
360 | 359 | \end{itemize} |
361 | 360 |
|
|
0 commit comments