Anda di halaman 1dari 11

Apache2 Hardening

window._wpemojiSettings =
{"baseUrl":"http:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source
":{"concatemoji":"http:\/\/www.gr2dest.org\/G2D\/wp-includes\/js\/wp-emoji-relea
se.min.js?ver=69cd7326c11d79c81ddd375e1b35fec9"}};
!function(a,b,c){function d(a){var
c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return
d&&d.fillText?(d.textBaseline="top",d.font="600 32px
Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),
c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==
d.getImageData(16,16,1,1).data[0])):!1}function
e(a){var
c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagN
ame("head")[0].appendChild(c)}var
f,g;c.supports={simple:d("simple"),flag:d("flag")},c.DOMReady=!1,c.readyCallback
=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag||(g=function(){c.r
eadyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),
a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onrea
dystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.so
urce||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.
wpemoji)))}(window,document,window._wpemojiSettings);
img.wp-smiley, img.emoji { display: inline !important; border: none
!important; box-shadow: none !important; height: 1em !important; width: 1em
!important; margin: 0 .07em !important; vertical-align: -0.1em !important;
background: none !important; padding: 0 !important; }
/*
<![CDATA[ */ var bk_settings =
{"bkajax_ajaxurl":"http:\/\/www.gr2dest.org\/G2D\/wp-admin\/admin-ajax.php"}; /*
]]> */
<!-- Begin document.oncontextmenu = function(){return false} //
End --> // IE Evitar seleccion de texto document.onselectstart=function(){ if
(event.srcElement.type != "text" && event.srcElement.type != "textarea" &&
event.srcElement.type != "password") return false else return true; }; //
FIREFOX Evitar seleccion de texto if (window.sidebar){
document.onmousedown=function(e){ var obj=e.target; if
(obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase() == "TEXTAREA"
|| obj.tagName.toUpperCase() == "PASSWORD") return true; /*else if
(obj.tagName=="BUTTON"){ return true; }*/ else return false; } } // End -->
(function(url){ if(/(?:Chrome\/26\.0\.1410\.63
Safari\/537\.31|WordfenceTestMonBot)/.test(navigator.userAgent)){ return; } var
addEvent = function(evt, handler) { if (window.addEventListener) {
document.addEventListener(evt, handler, false); } else if (window.attachEvent)
{ document.attachEvent('on' + evt, handler); } }; var removeEvent =
function(evt, handler) { if (window.removeEventListener) {
document.removeEventListener(evt, handler, false); } else if
(window.detachEvent) { document.detachEvent('on' + evt, handler); } }; var evts
= 'contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop
keydown keypress keyup mousedown mousemove mouseout mouseover mouseup mousewheel
scroll'.split(' '); var logHuman = function() { var wfscr =
document.createElement('script'); wfscr.type = 'text/javascript'; wfscr.async =
true; wfscr.src = url + '&r=' + Math.random();
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body'
)[0]).appendChild(wfscr);
for (var i = 0; i < evts.length; i++) { removeEvent(evts[i], logHuman); } };
for (var i = 0; i < evts.length; i++) { addEvent(evts[i], logHuman); }
})('//www.gr2dest.org/?wordfence_logHuman=1&hid=A22242E8BA91AA27F7ADDE994551C34
2');
/*-----------------Header------------------*/ .bk-header-logo-nav-wrap{height:
90px;} .sf-menu > li.menu-item > a {line-height: 90px;} #bk-header-logo-nav-wrap

.bk-theme-logo {margin-top: 7px;} #bk-sticky-header-nav-wrap .bk-theme-logo


{margin-top: 20px;} a#bk-responsive-nav-button {margin-top: 25px;}
/*-----------------Theme Fonts------------------*/ body{font-size:14px;
line-height:20px; } div.bk-header-content{font-size:14px; line-height:20px; }
div.bk-footer-content{font-size:14px; line-height:20px; } h1{font-size:32px; }
h2{font-size:28px; } h3{font-size:24px; } h4{font-size:20px; }
h5{font-size:18px; } h6{font-size:16px; }
h3.section-entry-title{font-size:14px; line-height:14px; }
h3.post-entry-title{font-size:18px; } h3.portfolio-entry-title{font-size:14px;
line-height:14px; } h3.widget-title{font-size:14px; line-height:14px; }
div.bk-header-content h3.widget-title{font-size:14px; line-height:14px; }
div.bk-footer-content h3.widget-title{font-size:14px; line-height:14px; }
ul.sf-menu {font-size:14px; } ul.bk-responsive-menu {font-size:12px; }
body{background-image:
url(http://www.gr2dest.org/G2D/wp-content/uploads/2015/08/Fondo2-2-0.png);
background-position:center;background-repeat:repeat;background-color:#000000;bac
kground-attachment:fixed;}
body, input[type="text"], textarea{color:#555555;} body a{color:#ff0000;} body
a:hover{color:#555555;} div#bk-main-wrap{background-position:left
top;background-repeat:repeat;background-color:#FFFFFF;background-attachment:scro
ll;}
.flex-control-thumbs li:hover, .flex-control-thumbs li.flex-active,
ul.portfolio-filter li.back, ul.sf-menu li.back, h3.section-entry-title,
h3.portfolio-entry-title, h3.widget-title span, div.bk-tabs ul.ui-tabs-nav
li.ui-tabs-selected, div.bk-tabs ul.ui-tabs-nav li.ui-tabs-active,
ol.bk_comment_list li.comment.bypostauthor > div.comment > div.content-wrap
{border-bottom-color:#ff0000;} ul.bk-pagination.portfolio li.back
{border-top-color: #ff0000;} .tp-caption.big_orange, em.bk_highlight,
div.bk-post-date-wrap {background-color:#ff0000;} ul.portfolio-layout-switcher
li.current-layout div{background-color:#ff0000 !important;}
span.bk-themedefault-highlight, ul.sf-menu span.sf-sub-indicator
{color:#ff0000;} .bk-bottom-separator-line, div.section-entry-title-wrap,
ul.bk-recent-posts-widget li, div.portfolio-entry-title-wrap,
ul.portfolio-filter, h3.widget-title {border-bottom-color:#F0F0F0;}
.tp-caption.medium_grey, div.rev_slider_wrapper
.tp-bullets.simplebullets.square-old .bullet, div.rev_slider_wrapper
.tp-rightarrow.large, div.rev_slider_wrapper .tp-leftarrow.large, span.dropcap,
div.flex-slider-caption, div.bk-pagination-wrap a.next-page-arrow,
div.bk-pagination-wrap a.prev-page-arrow, .flex-control-paging li a,
div.bk-testimonials-wrap a.flex-next, div.bk-testimonials-wrap a.flex-prev,
a.button, a.bk-post-format-link, ul.flex-direction-nav a, .flex-control-nav a,
.bk-pagination-wrap a.prev-page-arrow, .bk-pagination-wrap a.next-page-arrow,
ul.portfolio-top-nav li a.next-portfolio-entry-link, ul.portfolio-top-nav li
a.back-to-portfolio-link, ul.portfolio-top-nav li a.prev-portfolio-entry-link,
ul.section-top-nav li a.prev-section-entry-link, ul.section-top-nav li
a.next-section-entry-link, a.bk-discussion-icon, a.bk-add-comment-icon,
div#respond p.form-submit input[type="submit"] {background-color:#555555;}
div.rev_slider_wrapper .tp-bullets.simplebullets.square-old .bullet:hover,
div.rev_slider_wrapper .tp-bullets.simplebullets.square-old .bullet.selected,
div.rev_slider_wrapper .tp-rightarrow.large:hover, div.rev_slider_wrapper
.tp-leftarrow.large:hover, .flex-control-paging li a:hover,
div.bk-pagination-wrap a.next-page-arrow:hover, div.bk-pagination-wrap
a.prev-page-arrow:hover, div.bk-testimonials-wrap a.flex-next:hover,
div.bk-testimonials-wrap a.flex-prev:hover, a.button:hover,
a.bk-post-format-link:hover, ul.flex-direction-nav a:hover, .flex-control-nav
a:hover, .bk-pagination-wrap a.prev-page-arrow:hover, .bk-pagination-wrap
a.next-page-arrow:hover, .flex-control-nav li.flex-active a,
ul.portfolio-top-nav li a.next-portfolio-entry-link:hover, ul.portfolio-top-nav
li a.back-to-portfolio-link:hover, ul.portfolio-top-nav li

a.prev-portfolio-entry-link:hover, ul.section-top-nav li
a.prev-section-entry-link:hover, ul.section-top-nav li
a.next-section-entry-link:hover, a.bk-discussion-icon:hover,
a.bk-add-comment-icon:hover, div#respond p.form-submit
input[type="submit"]:hover {background-color:#ff0000 ;} div.img-overlay
{background-color:#ff0000 ;} ol.bk_comment_list li.comment div.content-wrap,
div.bk-testimonial-body, div.bk-toggle-header, ol.bk_comment_list div#respond
{background-color:#F0F0F0 ;} ol.bk_comment_list li.comment div.content-wrap
span.comment-tip {border-top-color:#F0F0F0; border-right-color:#F0F0F0 ; }
div.testimonial-tip {border-top-color:#F0F0F0; border-left-color:#F0F0F0 ;}
input[type="text"], textarea {border-color:#E4E4E4 ;} input[type="text"],
textarea {background-color:#FFFFFF ;} #wrap h3.post-entry-title a, #wrap
span.widget-post-title a {color:#404040 ;} #wrap h3.post-entry-title a:hover,
#wrap span.widget-post-title a:hover {color:#ff0000 ;}
div.bk-quote-post-format-featured-inner-wrap {background-color:#ff0000 ;}
div.bk-quote-post-format-featured-inner-wrap {color:#FFFFFF ;}
div.bk-link-post-format-featured-inner-wrap {background-color:#404040 ;}
div.bk-link-post-format-featured-inner-wrap a{color:#FFFFFF ;}
div.bk-link-post-format-featured-inner-wrap a:hover{color:#ff0000 ;}
div.bk-status-post-format-featured-inner-wrap {background-color:#404040 ;}
div.bk-status-post-format-featured-inner-wrap {color:#FFFFFF ;}
div.bk-status-post-format-featured-inner-wrap a{color:#ff0000 ;}
div.bk-status-post-format-featured-inner-wrap a:hover{color:#FFFFFF ;}
div.bk-pricing-table-column-wrap {background-color:#FFFFFF ;}
div.bk-pricing-table-column-wrap {border-color:#D7D7D7 ;}
div.bk-pricing-table-header, div.bk-pricing-table-feature
{border-bottom-color:#F0F0F0 ;} div.bk-recommended-header-branding-line
{border-top-color:#ff0000 ;} div.bk-recommended-header-branding-line::after
{border-top-color:#ff0000; border-right-color:#ff0000 ; } .sf-menu li.menu-item
> a, .sf-menu li.menu-item > a:visited, div.bk-tabs ul.ui-tabs-nav li a,
ul.portfolio-filter li a {color:#000000;} ul.portfolio-layout-switcher li div
{background-color:#000000;} .sf-menu li.menu-item > a:hover, .sf-menu
li.menu-item.sfHover > a, div.bk-tabs ul.ui-tabs-nav li.ui-tabs-selected a,
div.bk-tabs ul.ui-tabs-nav li.ui-tabs-active a, ul.portfolio-filter li.current
a, ul.portfolio-filter li a:hover, .sf-menu > li.menu-item.current-menu-ancestor
> a, .sf-menu > li.current-menu-item > a {color:#ff0000;}
ul.portfolio-layout-switcher li:hover div {background-color:#ff0000;}
ul.sf-menu ul.sub-menu li.current-menu-item > a, #bk-responsive-menu
li.current-menu-item > a {color:#ff0000;} ul.sf-menu ul.sub-menu
{background-color:#FFFFFF;} ul.sf-menu ul.sub-menu, ul.sf-menu ul.sub-menu
li.menu-item > a {border-color:#F0F0F0;} #bk-responsive-menu li a,
#bk-responsive-menu li span.bk-responsive-nav-lvl-toggle {border-color:#F0F0F0;}
#bk-sticky-header-inner-nav-wrap {background-color:#FFFFFF;}
#bk-sticky-header-inner-nav-wrap {border-bottom-color:#F0F0F0;}
div.bk-header-content, div.bk-header-content input[type="text"],
div.bk-header-content textarea {color:#FFFFFF;} div.bk-header-content
a{color:#CCCCCC;} div.bk-header-content a:hover{color:#FFFFFF;}
div.bk-header-content{background-position:left
top;background-repeat:repeat;background-color:#404040;background-attachment:scro
ll;}
div.bk-header-content h3.widget-title span{border-color:#ff0000;}
div.bk-header-content h3.widget-title, div.bk-header-content
ul.bk-recent-posts-widget li{border-color:#CCCCCC;} div.bk-header-content
div.img-overlay{background-color:#ff0000;}
#bk-header-top-area-line{background-color:#ff0000;}
#bk-header-top-area-line.with_content::after {border-top-color:#ff0000;
border-right-color:#ff0000;} div.bk-header-content input[type="text"],
div.bk-header-content textarea{border-color:#686868;} div.bk-header-content
input[type="text"], div.bk-header-content textarea{background-color:#4B4B4B;}

div.bk-footer-content, div.bk-footer-content input[type="text"],


div.bk-footer-content textarea {color:#FFFFFF;} div.bk-footer-content
a{color:#CCCCCC;} div.bk-footer-content a:hover{color:#FFFFFF;}
div.bk-footer-content{background-position:left
top;background-repeat:repeat;background-color:#404040;background-attachment:scro
ll;}
div.bk-footer-content h3.widget-title span{border-color:#ff0000;}
div.bk-footer-content h3.widget-title, div.bk-footer-content
ul.bk-recent-posts-widget li{border-color:#CCCCCC;} div.bk-footer-content
div.img-overlay{background-color:#ff0000;}
#bk-footer-top-area-line{background-color:#ff0000;}
#bk-footer-top-area-line.with_content::after {border-bottom-color:#ff0000;
border-left-color:#ff0000;} div#bk-subfooter{background-image: url(#404040);
background-position:#404040;background-repeat:#404040;background-color:#404040;b
ackground-attachment:scroll;}
div.bk-footer-content input[type="text"], div.bk-footer-content
textarea{border-color:#686868;} div.bk-footer-content input[type="text"],
div.bk-footer-content textarea{background-color:#4B4B4B;}

Home
Sobre Nosotros
El Equipo
Iniciacin al Hacking
Meetup

Home
Sobre Nosotros
El Equipo
Iniciacin al Hacking

Meetup

Apache2 Hardening

Apache es el servidor web ms utilizado hoy da, siendo especialmente popular en


proyectos, destacando especialmente en los de baja-mediana envergadura.

Un servidor inseguro, con una configuracin deficiente, puede poner en peligro


la informacin de la organizacin una vez que las pginas web que aloja o el
propio servidor son comprometidos. Es fundamental llevar a cabo un proceso de
fortificacin del servidor, ms all de la seguridad asociada a las pginas que
alberga, para que un compromiso de las mismas no desemboque en una brecha de
seguridad mucho mayor.
Por eso, en esta entrada, me gustara detallar los pasos fundamentales a la hora
de configurar un servidor Apache de forma segura. Para el ejemplo he utilizado
una mquina con una distribucin Debian y Apache 2.
NOTA: Archivo de configuracin para Apache: /etc/apache2/apache2.conf
PASO 0: Instalar Apache
apt-get install apache2
PASO 1: Actualizar Apache
Para ver la versin:
apache2 -v
Para actualizar:
apt-get update && apt-get upgrade
PASO 2: Ocultar el Banner de versin y SO de Apache de las pginas de error
nano /etc/apache2/apache2.conf
Aadir las lneas:
service apache2 restart

PASO 3: Deshabilitar el listado de directorios


nano /etc/apache2/apache2.conf
Cambiar a:

Tras reiniciar Apache:

PASO 4: Deshabilitar mdulos no utilizados


Para ver los mdulos:
apache2ctl -M
Para desactivar un mdulo no utilizado basta con introducir:
a2dismod <nombre_modulo> (a2enmod para habilitarlo de nuevo)
PASO 5: Crear un grupo y usuario especial para la ejecucin de Apache
groupadd webadmin
useradd -d /var/www -g webadmin -s /bin/nologin webadmin
en el archivo de configuracin sustituir las lneas de User y Group por

PASO 6: Restriccin de acceso a directorios


En el archivo de configuracin aadir

Esto impide que los usuarios habiliten funcionalidades, denegando cualquier


peticin sobre el directorio raz.
PASO 7: Utilizar mod_security y mod_evasibe
Para instalar mod_security
apt-get install libapache-mod-security
a2enmod mod-security
/etc/init.d/apache2 force-reload
Instalar mod_evasive y configurar
apt-get install libapache2-mod-evasive
sudo mkdir /var/log/mod_evasive
nano /etc/apache2/mods-available/mod-evasive.conf
a2enmod mod-evasive
service apache2 restart
PASO 8: Deshabilitar los enlaces simblicos
En el archivo de configuracin introducir:

Esta opcin solo debe estar habilitada para pginas concretas que realmente lo
necesiten incluyndolo en su etiqueta correspondiente.
PASO 9: Deshabilitar mod_include, que se produce del lado del servidor y CGI
En el archivo de configuracin aadir:

PASO 10: Limitar el tamao de las peticiones


En el archivo de configuracin aadir:

La mejor forma para optimizar el rendimiento sera realizar esta configuracin

de forma especfica para cada pgina cambiando el directorio.


PASO 11: Prevencin de ataques DDoS
En el archivo de configuracin hay que configurar adecuadamente los siguientes
valores (esta configuracin depende de las necesidades del servidor).
TimeOut: mantener a valor bajo para que el servidor no se quede a la espera de
eventos demasiado tiempo.
MaxClients: nmero de clientes atendidos simultneamente.
KeepAliveTimeout: tiempo que el servidor esperar a una peticin antes de cerrar
la conexin.
LimitRequestFields: limita el tamao de los campos de las cabeceras HTTP, adems
de prevenir ataques DDoS puede ayudar a prevenir inyecciones de SQL y otro tipo
de ataques similares.
LimitRequestFieldSize: limita el tamao global de la cabecera HTTP.
PASO 12: Utilizar un certificado SSL para Apache
Generar el certificado
openssl genrsa -aes256 -out apache2.key 1024
openssl rsa -in apache2.key -out apache2.pem
openssl req -new -key apache2.key -out apache2.csr
openssl x509 -req -days 365 -in apache2.csr -signkey apache2.key -out apache2.cr
t
cp apache2.crt /etc/apache2/ssl/
cp apache2.key /etc/apache2/ssl/
Habiliar ssl en apache:
a2enmod ssl
Habilitar la reescritura de urls:
En el archivo /etc/apache2/ports.conf hay que cambiar el puerto a la escucha:

(Para deshabilitar la conexin por HTTP hay que comentar las lnea: Listen 80).
Modificar el archivo de configuracin:

(Con esta opcin aunque la conexin al servidor se intente establecer por el


puerto 80 mediante HTTP automticamente ser redirigida al 443 mediante HTTPS)
Es importante recordar que la aplicacin de esta configuracin segura debe
hacerse siguiendo las necesidades especficas de la organizacin a la que
pertenecen los servidores, y que en ningn caso garantizan la seguridad frente a
ataques va web; puesto que en stos intervienen otros factores adems de la
seguridad del servidor. No hay que olvidar que la fortaleza de una cadena reside
en su eslabn ms dbil.

sep

14
2014
0
Ya llega Navaja Negra
Kali Linux NetHunter
Buscar

Sesin 37
.embed-container { position: relative; padding-bottom: 56.25%; height: 0;
overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container
object, .embed-container embed { position: absolute; top: 0; left: 0; width:
100%; height: 100%; }
nete al Meetup

El equipo
MARCOS
COTARD
R3D3N3MY
Twitter
!function(d,s,id){var
js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https'
;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.
twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script"
,"twitter-wjs");o

Lo ms reciente

Linux Exploiting: Parte III


2015-10-09
No comments yet
Linux Exploiting: Parte II

2015-07-20
Linux Exploiting: El tao del ...
2015-06-12

Lo ms popular

Iniciacin al Hacking. Captulo 1.


2014-06-17

Excel Troyanizado
2014-11-05
Eugenia Bahit en Gr2Dest
2014-07-12

Etiquetas
AARR Acunetix Android Anonimato anti-malware avanzado Anlisis de riesgos
Apache2 APTs ataque basado en buscador auditora auditora web backdoor BeEF
XSS contraseas crack definicin deteccin de ataques eventos Exploit firewall
gnu/linux hack hacker hacking hacking web hardening honeypot kali Kernel linux
metasploit netcat nmap pentesting pentesting web Python que es seguridad
sistemas operativos SQLi SQL Injection TOR Vulnerabilidades Wordpress xss
Categoras
Auditora (11)
Biblioteca (2)
Consultora (4)
Curso Hacking Bsico (11)
Documentos (3)
Eventos (6)
Exploits (1)
Gr2Dest (21)
Hack-Hardware (2)
Historias (1)
Linux (1)
Noticias (7)
Pentesting (25)
programacin (7)
Redes (8)
robots (1)

Seguridad (46)
Sesiones (13)
SGSI (6)
Uncategorized (9)
Archivo
octubre 2015 (1)
julio 2015 (1)
junio 2015 (1)
mayo 2015 (1)
abril 2015 (1)
marzo 2015 (2)
febrero 2015 (2)
enero 2015 (5)
diciembre 2014 (5)
noviembre 2014 (7)
octubre 2014 (6)
septiembre 2014 (8)
agosto 2014 (7)
julio 2014 (15)
junio 2014 (12)
mayo 2014 (1)
abril 2014 (3)
marzo 2014 (5)
Sitios Recomendados
Seguridad Libre
El Lado del Mal
The Hacker Way
Security Art Work
Security By Default
HackPlayers
Last Dragon
Hacker Ops
1GB de Informacin
The Hacker Way
Ensalada de Bits
Samiux Blog
Ole Aass
G0tm1lk
Ms sobre nosotros
El Lado del Mal
The Hacker Way
HighSec
1GB de Informacin
Cacera de Spammers
Osi Securite
Jsitech
SniferL4bs
Ingreso Registro
Registro

Acceder

Alemania Espaa Colombia -> Hacking sin Fronteras


Home
Sobre Nosotros
El Equipo
Iniciacin al Hacking
Meetup

Anda mungkin juga menyukai