Linux server.nvwebsoft.co.in 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar 20 15:54:52 UTC 2024 x86_64
Apache
: 162.240.12.249 | : 3.129.25.216
202 Domain
8.1.31
nbspublicschool
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
pam-devel-1.1.8 /
html /
[ HOME SHELL ]
Name
Size
Permission
Action
Linux-PAM_ADG.html
8.41
KB
-rw-r--r--
Linux-PAM_MWG.html
8.59
KB
-rw-r--r--
adg-author.html
3.02
KB
-rw-r--r--
adg-copyright.html
3.54
KB
-rw-r--r--
adg-example.html
3.59
KB
-rw-r--r--
adg-files.html
2.18
KB
-rw-r--r--
adg-glossary.html
3.21
KB
-rw-r--r--
adg-interface-by-app-expected....
61.01
KB
-rw-r--r--
adg-interface-of-app-expected....
8.26
KB
-rw-r--r--
adg-interface-programming-note...
2.55
KB
-rw-r--r--
adg-interface.html
4.9
KB
-rw-r--r--
adg-introduction-description.h...
3.29
KB
-rw-r--r--
adg-introduction-synopsis.html
2.62
KB
-rw-r--r--
adg-introduction.html
2.01
KB
-rw-r--r--
adg-libpam-functions.html
13.13
KB
-rw-r--r--
adg-libpam_misc.html
3.34
KB
-rw-r--r--
adg-overview.html
8.16
KB
-rw-r--r--
adg-porting.html
4.2
KB
-rw-r--r--
adg-security-conv-function.htm...
2.29
KB
-rw-r--r--
adg-security-library-calls.htm...
3.13
KB
-rw-r--r--
adg-security-resources.html
2.83
KB
-rw-r--r--
adg-security-service-name.html
4.43
KB
-rw-r--r--
adg-security-user-identity.htm...
5.38
KB
-rw-r--r--
adg-security.html
3.73
KB
-rw-r--r--
adg-see-also.html
2.16
KB
-rw-r--r--
mwg-author.html
3
KB
-rw-r--r--
mwg-copyright.html
3.52
KB
-rw-r--r--
mwg-example.html
1.96
KB
-rw-r--r--
mwg-expected-by-module-item.ht...
45.36
KB
-rw-r--r--
mwg-expected-by-module-other.h...
8.15
KB
-rw-r--r--
mwg-expected-by-module.html
4.02
KB
-rw-r--r--
mwg-expected-of-module-acct.ht...
6.05
KB
-rw-r--r--
mwg-expected-of-module-auth.ht...
10.73
KB
-rw-r--r--
mwg-expected-of-module-chautht...
7.8
KB
-rw-r--r--
mwg-expected-of-module-overvie...
6.28
KB
-rw-r--r--
mwg-expected-of-module-session...
6.98
KB
-rw-r--r--
mwg-expected-of-module.html
4.27
KB
-rw-r--r--
mwg-introduction-description.h...
3.88
KB
-rw-r--r--
mwg-introduction-synopsis.html
1.98
KB
-rw-r--r--
mwg-introduction.html
1.98
KB
-rw-r--r--
mwg-see-also.html
2.18
KB
-rw-r--r--
mwg-see-options.html
2.92
KB
-rw-r--r--
mwg-see-programming-libs.html
2.94
KB
-rw-r--r--
mwg-see-programming-sec.html
8.92
KB
-rw-r--r--
mwg-see-programming-syslog.htm...
4.63
KB
-rw-r--r--
mwg-see-programming.html
3
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : mwg-see-programming-sec.html
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>5.1. Security issues for module creation</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="Linux-PAM_MWG.html" title="The Linux-PAM Module Writers' Guide"><link rel="up" href="mwg-see-programming.html" title="Chapter 5. Programming notes"><link rel="prev" href="mwg-see-programming.html" title="Chapter 5. Programming notes"><link rel="next" href="mwg-see-programming-syslog.html" title="5.2. Use of syslog(3)"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.1. Security issues for module creation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mwg-see-programming.html">Prev</a> </td><th width="60%" align="center">Chapter 5. Programming notes</th><td width="20%" align="right"> <a accesskey="n" href="mwg-see-programming-syslog.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mwg-see-programming-sec"></a>5.1. Security issues for module creation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="mwg-see-programming-sec-res"></a>5.1.1. Sufficient resources</h3></div></div></div><p> Care should be taken to ensure that the proper execution of a module is not compromised by a lack of system resources. If a module is unable to open sufficient files to perform its task, it should fail gracefully, or request additional resources. Specifically, the quantities manipulated by the <span class="citerefentry"><span class="refentrytitle">setrlimit</span>(2)</span> family of commands should be taken into consideration. </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="mwg-see-programming-sec-who"></a>5.1.2. Who´s who?</h3></div></div></div><p> Generally, the module may wish to establish the identity of the user requesting a service. This may not be the same as the username returned by <code class="function">pam_get_user()</code>. Indeed, that is only going to be the name of the user under whose identity the service will be given. This is not necessarily the user that requests the service. </p><p> In other words, user X runs a program that is setuid-Y, it grants the user to have the permissions of Z. A specific example of this sort of service request is the <span class="command"><strong>su</strong></span> program: user <span class="command"><strong>joe</strong></span> executes <span class="command"><strong>su</strong></span> to become the user <span class="command"><strong>jane</strong></span>. In this situation X=<span class="command"><strong>joe</strong></span>, Y=<span class="command"><strong>root</strong></span> and Z=<span class="command"><strong>jane</strong></span>. Clearly, it is important that the module does not confuse these different users and grant an inappropriate level of privilege. </p><p> The following is the convention to be adhered to when juggling user-identities. </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p> X, the identity of the user invoking the service request. This is the user identifier; returned by the function <span class="citerefentry"><span class="refentrytitle">getuid</span>(2)</span>. </p></li><li class="listitem"><p> Y, the privileged identity of the application used to grant the requested service. This is the <span class="emphasis"><em>effective</em></span> user identifier; returned by the function <span class="citerefentry"><span class="refentrytitle">geteuid</span>(2)</span>. </p></li><li class="listitem"><p> Z, the user under whose identity the service will be granted. This is the username returned by <code class="function">pam_get_user()</code> and also stored in the <span class="emphasis"><em>Linux-PAM</em></span> item, <span class="emphasis"><em>PAM_USER</em></span>. </p></li><li class="listitem"><p> <span class="emphasis"><em>Linux-PAM</em></span> has a place for an additional user identity that a module may care to make use of. This is the <span class="emphasis"><em>PAM_RUSER</em></span> item. Generally, network sensitive modules/applications may wish to set/read this item to establish the identity of the user requesting a service from a remote location. </p></li></ul></div><p> Note, if a module wishes to modify the identity of either the <span class="emphasis"><em>uid</em></span> or <span class="emphasis"><em>euid</em></span> of the running process, it should take care to restore the original values prior to returning control to the <span class="emphasis"><em>Linux-PAM</em></span> library. </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="mwg-see-programming-sec-conv"></a>5.1.3. Using the conversation function</h3></div></div></div><p> Prior to calling the conversation function, the module should reset the contents of the pointer that will return the applications response. This is a good idea since the application may fail to fill the pointer and the module should be in a position to notice! </p><p> The module should be prepared for a failure from the conversation. The generic error would be <span class="emphasis"><em>PAM_CONV_ERR</em></span>, but anything other than <span class="emphasis"><em>PAM_SUCCESS</em></span> should be treated as indicating failure. </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="mwg-see-programming-sec-token"></a>5.1.4. Authentication tokens</h3></div></div></div><p> To ensure that the authentication tokens are not left lying around the items, <span class="emphasis"><em>PAM_AUTHTOK</em></span> and <span class="emphasis"><em>PAM_OLDAUTHTOK</em></span>, are not available to the application: they are defined in <code class="filename"><security/pam_modules.h></code>. This is ostensibly for security reasons, but a maliciously programmed application will always have access to all memory of the process, so it is only superficially enforced. As a general rule the module should overwrite authentication tokens as soon as they are no longer needed. Especially before <code class="function">free()</code>'ing them. The <span class="emphasis"><em>Linux-PAM</em></span> library is required to do this when either of these authentication token items are (re)set. </p><p> Not to dwell too little on this concern; should the module store the authentication tokens either as (automatic) function variables or using <code class="function">pam_[gs]et_data()</code> the associated memory should be over-written explicitly before it is released. In the case of the latter storage mechanism, the associated <code class="function">cleanup()</code> function should explicitly overwrite the <code class="varname">*data</code> before <code class="function">free()</code>'ing it: for example, </p><pre class="programlisting"> /* * An example cleanup() function for releasing memory that was used to * store a password. */ int cleanup(pam_handle_t *pamh, void *data, int error_status) { char *xx; if ((xx = data)) { while (*xx) *xx++ = '\0'; free(data); } return PAM_SUCCESS; } </pre><p> </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="mwg-see-programming.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="mwg-see-programming.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="mwg-see-programming-syslog.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Programming notes </td><td width="20%" align="center"><a accesskey="h" href="Linux-PAM_MWG.html">Home</a></td><td width="40%" align="right" valign="top"> 5.2. Use of <span class="citerefentry"><span class="refentrytitle">syslog</span>(3)</span></td></tr></table></div></body></html>
Close