{"id":1258,"date":"2015-01-28T14:40:50","date_gmt":"2015-01-28T20:40:50","guid":{"rendered":"https:\/\/www.lastdragon.net\/?p=1258"},"modified":"2015-01-28T14:40:50","modified_gmt":"2015-01-28T20:40:50","slug":"parchando-la-vulnerabilidad-de-ghost-_nss_hostname_digits_dots-en-centos-7-glibc","status":"publish","type":"post","link":"https:\/\/www.lastdragon.net\/?p=1258","title":{"rendered":"Parchando la vulnerabilidad de Ghost ( _nss_hostname_digits_dots ) en CentOS 7 ( Glibc )"},"content":{"rendered":"<p>Hoy de nuevo todo el mundo ha amanecido con la psicosis de que hay una vulnerabilidad muy grave en GNU\/Linux, si la hay pero como las anteriores son mas amarillismo.<\/p>\n<p>El problema esta en la librer\u00eda glibc en la funci\u00f3n <strong>_nss_hostname_digits_dots()<\/strong> , es  muy dif\u00edcil de explotar aunque hay aplicaciones que lo permiten remotamente, sin embargo es mucho mas f\u00e1cil actualizar las librer\u00edas glibc que explotarlas, en cosa de 20 segundos puedes sin problemas terminar con este asunto del ghost<\/p>\n<p>Si tienes un GNU\/Linux CentOS 7 lo \u00fanico que se debe hacer es escribir el comando.<\/p>\n<p><code>yum install glibc-2.17-55.el7_0.5<\/code><\/p>\n<p>Y eso es todo, lo mismo para versiones anteriores de CentOS 6 y anteriores asi como para otras distros como debian o ubuntu que en lugar de yum usan apt-get<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.lastdragon.net\/misarchivos\/ghost.jpg\" alt=\"Glibc Linux Ghost\" width=\"425\" height=\"350\" \/><br \/>\n<a href=\"https:\/\/www.lastdragon.net\/misarchivos\/ghost.jpg\">Ver mas grande<\/a><\/p>\n<p>Recuerda. Que no te espanten con vulnerabilidades en el software libre esto se arregla en cuesti\u00f3n de segundos, ni que dependi\u00e9ramos de compa\u00f1\u00edas como cof, cof, Microsoft cof cof Apple. <\/p>\n<p>Por ultimo, aunque la mayoria de los servicios no son afectados por esta vulnerabilidad, si eres muy paranoico de la seguridad, debes reiniciar tu servidor o computadora personal despu\u00e9s de actualizar las librer\u00edas, por que los programas que han cargado con la versi\u00f3n anterior, no volver\u00e1n a hacerlo si no hasta la siguiente vez que carguen en RAM, por lo que habr\u00e1n muchos programas en RAM aun usando la vieja librer\u00edas. La forma mas r\u00e1pida de que todo recargue con las nuevas librer\u00edas es un sencillo reinicio. <\/p>\n<p><strong>El siguiente c\u00f3digo en C puede ayudarte a probar si tu sistema es vulnerable o no<\/strong><\/p>\n<p><code>&nbsp;&nbsp;&nbsp; #include &lt;netdb.h&gt;<br \/>\n&nbsp;&nbsp;&nbsp; #include &lt;stdio.h&gt;<br \/>\n&nbsp;&nbsp;&nbsp; #include &lt;stdlib.h&gt;<br \/>\n&nbsp;&nbsp;&nbsp; #include &lt;string.h&gt;<br \/>\n&nbsp;&nbsp;&nbsp; #include &lt;errno.h&gt;<\/p>\n<p>&nbsp;&nbsp;&nbsp; #define CANARY \"in_the_coal_mine\"<\/p>\n<p>&nbsp;&nbsp;&nbsp; struct {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; char buffer[1024];<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; char canary[sizeof(CANARY)];<br \/>\n&nbsp;&nbsp;&nbsp; } temp = { \"buffer\", CANARY };<\/p>\n<p>&nbsp;&nbsp;&nbsp; int main(void) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; struct hostent resbuf;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; struct hostent *result;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; int herrno;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; int retval;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; \/*** strlen (name) = size_needed - sizeof<br \/>\n(*host_addr) - sizeof (*h_addr_ptrs) - 1; ***\/<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; size_t len = sizeof(temp.buffer) -<br \/>\n16*sizeof(unsigned char) - 2*sizeof(char *) - 1;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; char name[sizeof(temp.buffer)];<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; memset(name, '0', len);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; name[len] = '\\0';<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; retval = gethostbyname_r(name, &amp;resbuf,<br \/>\ntemp.buffer, sizeof(temp.buffer), &amp;result, &amp;herrno);<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; if (strcmp(temp.canary, CANARY) != 0) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; puts(\"vulnerable\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(EXIT_SUCCESS);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; if (retval == ERANGE) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; puts(\"not vulnerable\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(EXIT_SUCCESS);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; puts(\"should not happen\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; exit(EXIT_FAILURE);<br \/>\n&nbsp;&nbsp;&nbsp; }<\/p>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hoy de nuevo todo el mundo ha amanecido con la psicosis de que hay una vulnerabilidad muy grave en GNU\/Linux, si la hay pero como las anteriores son mas amarillismo. El problema esta en la librer\u00eda glibc en la funci\u00f3n _nss_hostname_digits_dots() , es muy dif\u00edcil de explotar aunque hay aplicaciones que lo permiten remotamente, sin&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1258","post","type-post","status-publish","format-standard","hentry","category-hackers-and-tools"],"_links":{"self":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/posts\/1258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1258"}],"version-history":[{"count":1,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/posts\/1258\/revisions"}],"predecessor-version":[{"id":1259,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=\/wp\/v2\/posts\/1258\/revisions\/1259"}],"wp:attachment":[{"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lastdragon.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}