Showing posts with label wordpress. Show all posts
Showing posts with label wordpress. Show all posts
Sunday, February 19, 2017
Fortificación de comunicación entre Wordpress y MySQL Evitar los ataques de NPM Network Packet Manipulation
Fortificación de comunicación entre Wordpress y MySQL Evitar los ataques de NPM Network Packet Manipulation
En varios artículos hemos hablado de cómo hacer ataques de Network Packet Manipulation a entornos de bases de datos. Hablamos de cómo ownear MySQL colocándonos en medio de la comunicación del cliente y el servidor. En otro artículo comentamos cómo hackear Wordpress con la misma técnica. Al final todo se basa en que el tráfico entre las aplicaciones web y el motor de base de datos puede ir sin cifrar, así es por defecto en la instalación de los motores de base de datos y es labor de los administradores configurar las protecciones y el cifrado.
En el artículo de hoy nos pondremos del lado del Blue Team y hablaremos de cómo fortificar tu Wordpress cifrando las comunicaciones entre éste y el motor de MySQL.
Punto 0. Mi Wordpress por defecto
Partimos del siguiente esquema:
Punto 1. Fortificando la conexión a MySQL con SSL
En este punto lo que vamos a hacer es preparar los tres componentes necesarios para que MySQL acepte conexiones bajo SSL. En primer lugar hay que consultar si la compilación de MySQL que se está utilizando permite utilizar SSL, si no fuera así habría que instalar una versión más nueva o compilarla con soporte a SSL.
Para verificar esto accedemos a MySQL con un cliente y ejecutamos la siguiente consulta show variables like %ssl%;. Si las variables have_openssl y have_ssl tienen como valor DISABLED significa que está soportado pero no activo. Si por el contrario encontramos el valor NO, significa que la compilación de MySQL no soporta SSL. Si aparece el valor YES, significa que está correctamente configurado y el servidor permite conexión bajo este mecanismo. Además, hay que ver las rutas de las variables ssl_ca, ssl_cert y ssl_key que indican la ruta de la CA, del certificado del servidor y de la clave de éste.
En este punto vamos a utilizar OpenSSL para generar la CA, el certificado y la clave. Para ello ejecutamos las siguientes instrucciones:
Ahora, reiniciamos el servicio de MySQL. Una vez el motor arranque y lea la configuración del fichero sabrá de dónde leer la información del certificado, la CA y la clave privada. Ahora, podremos conectarnos con un cliente MySQL a través de SSL. Como ejemplo rápido utilizamos el propio MySQL. La instrucción es la siguiente:
Si abrimos ahora WireShark y aplicamos el filtro de MySQL para ver el tráfico observaremos que ya no vemos nada. Sin embargo, si utilizamos un filtro tcp.dstport == 3306 veremos que hay conexión con dicho puerto de la máquina 192.168.56.106.
Las consultas están siendo cifradas, y por eso WireShark no reconoce contenido de los datos que se envían al motor de MySQL.
Punto 2. Configurar Wordpress para que cifre con SSL la conexión con MySQL
Ahora, hay que indicar en el fichero wp-config.php de WordPress que éste debe entender los flags de MySQL para SSL. Para ello, añadimos al fichero la instrucción define(MYSQL_CLIENT_FLAGS, MYSQL_CLIENT_SSL);, tal y como se puede ver en la imagen siguiente.
Ahora accedemos al sitio web de nuestro WordPress y las consultas a MySQL irán por un canal cifrado, tal y como puede verse en la imagen. En este momento los ataques de NPM (Network Packet Manipulation) ya no es válido, ya que no podemos detectar y manipular las cadenas de MySQL. Si probamos con WireShark veremos que solo accedemos a la conexión al MySQL, pero nada de las consultas, si que veríamos la conexión al puerto 3306, pero todo cifrado.
De esta forma estamos fortificando el intercambio de información entre el WordPress y la base de datos MySQL. También se puede forzar a que usuarios concretos sólo puedan hacer conexiones bajo SSL, lo cual es interesante para fortificar.
Más artículos sobre seguridad y fortificación en WordPress:
Escritor de los libros "Metasploit para Pentesters", "Ethical Hacking" y Pentesting con Powershell
![]() |
Figura 1: Fortificación de comunicación entre WordPress y MySQL |
En el artículo de hoy nos pondremos del lado del Blue Team y hablaremos de cómo fortificar tu Wordpress cifrando las comunicaciones entre éste y el motor de MySQL.
Punto 0. Mi Wordpress por defecto
Partimos del siguiente esquema:
- Máquina A con dirección IP 192.168.56.103 tiene instalada un Wordpress.Si analizamos las peticiones se puede ver como accediendo al WordPress, entre la máquina 192.168.56.103 y 192.168.56.106 se realizan una serie de consultas a la base de datos. Estos paquetes son susceptibles de ser manipulados.
- Máquina B con dirección IP 192.168.56.106 tiene instalado y configurado MySQL por defecto.
Figura 2: Trafico de WordPress a MySQL sin cifrar |
Punto 1. Fortificando la conexión a MySQL con SSL
En este punto lo que vamos a hacer es preparar los tres componentes necesarios para que MySQL acepte conexiones bajo SSL. En primer lugar hay que consultar si la compilación de MySQL que se está utilizando permite utilizar SSL, si no fuera así habría que instalar una versión más nueva o compilarla con soporte a SSL.
Para verificar esto accedemos a MySQL con un cliente y ejecutamos la siguiente consulta show variables like %ssl%;. Si las variables have_openssl y have_ssl tienen como valor DISABLED significa que está soportado pero no activo. Si por el contrario encontramos el valor NO, significa que la compilación de MySQL no soporta SSL. Si aparece el valor YES, significa que está correctamente configurado y el servidor permite conexión bajo este mecanismo. Además, hay que ver las rutas de las variables ssl_ca, ssl_cert y ssl_key que indican la ruta de la CA, del certificado del servidor y de la clave de éste.
Figura 3: variables de MySQL para configurar SSL |
En este punto vamos a utilizar OpenSSL para generar la CA, el certificado y la clave. Para ello ejecutamos las siguientes instrucciones:
- openssl genrsa 2048 > ca-key.pemCon esto tenemos creado el certificado y la clave privada de la CA. Nos pedirán que rellenemos varios datos como país, ciudad, dominio, e-mail, etcétera.
- openssl req sha1 new x509 nodes days 3600 key ca-key.pem > ca-cert.pem
- openssl req sha1 newkey rsa:2048 -days 730 -nodes -keyout server-key.pem > server-req.pemCon esto generamos la clave privada para el servidor. A continuación, exportamos la clave privada del servidor a tipo RSA con la ejecución del siguiente comando:
- openssl rsa -in server-key.pem -out server-key.pemPor último, generamos un certificado de servidor utilizado el certificado de la CA.
- openssl x509 -sha1 -req -in server-req.pem -days 730 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pemLos ficheros cacert.pem, server-cert.pem y server-key.pem deben estar en la ruta /etc/mysql. Aunque esto puede ser configurado en el fichero de configuración de MySQL /etc/mysql/my.cnf. Editando dicho fichero y buscando a partir del campo [mysqld] debemos descomentar la parte de SSL y asegurarnos de que las variables tienen la configuración adecuada, tal y como puede verse en la siguiente imagen.
Figura 4: Configuración del fichero my.cnf |
Ahora, reiniciamos el servicio de MySQL. Una vez el motor arranque y lea la configuración del fichero sabrá de dónde leer la información del certificado, la CA y la clave privada. Ahora, podremos conectarnos con un cliente MySQL a través de SSL. Como ejemplo rápido utilizamos el propio MySQL. La instrucción es la siguiente:
- mysql u [user] p ssl-ca=[ruta cacert].Para comprobar que la conexión se ha realizado a través de SSL podemos consultar la variable Ssl_Cipher.
Figura 5: Configuración de la conexión |
Si abrimos ahora WireShark y aplicamos el filtro de MySQL para ver el tráfico observaremos que ya no vemos nada. Sin embargo, si utilizamos un filtro tcp.dstport == 3306 veremos que hay conexión con dicho puerto de la máquina 192.168.56.106.
Figura 6: Tráfico cifrado entre WordPress y MySQL |
Las consultas están siendo cifradas, y por eso WireShark no reconoce contenido de los datos que se envían al motor de MySQL.
Punto 2. Configurar Wordpress para que cifre con SSL la conexión con MySQL
Ahora, hay que indicar en el fichero wp-config.php de WordPress que éste debe entender los flags de MySQL para SSL. Para ello, añadimos al fichero la instrucción define(MYSQL_CLIENT_FLAGS, MYSQL_CLIENT_SSL);, tal y como se puede ver en la imagen siguiente.
Figura 7: Configuración de WordPress |
Ahora accedemos al sitio web de nuestro WordPress y las consultas a MySQL irán por un canal cifrado, tal y como puede verse en la imagen. En este momento los ataques de NPM (Network Packet Manipulation) ya no es válido, ya que no podemos detectar y manipular las cadenas de MySQL. Si probamos con WireShark veremos que solo accedemos a la conexión al MySQL, pero nada de las consultas, si que veríamos la conexión al puerto 3306, pero todo cifrado.
Figura 8:Conexión a MySQL desde WordPress |
De esta forma estamos fortificando el intercambio de información entre el WordPress y la base de datos MySQL. También se puede forzar a que usuarios concretos sólo puedan hacer conexiones bajo SSL, lo cual es interesante para fortificar.
Más artículos sobre seguridad y fortificación en WordPress:
- Hackear WordPress con ataques de Network Packet ManipulationAutor: Pablo González Pérez (@pablogonzalezpe)
- Fortificar WordPress frente ataques de fuerza bruta
- WordPress: Ten cuidado con el cacheo de borradores
- WPHardening: Automatizar la fortifación de WordPress
- Listar los plugins de WordPress
- Configurar Latch en WordPress
Escritor de los libros "Metasploit para Pentesters", "Ethical Hacking" y Pentesting con Powershell
Sigue Un informático en el lado del mal - Google+ RSS 0xWord

Available link for download
Labels:
ataques,
comunicaciã³n,
de,
entre,
evitar,
fortificaciã³n,
los,
manipulation,
mysql,
network,
npm,
packet,
wordpress,
y
Sunday, January 1, 2017
Making Money With Writing a blog – Blogger or WordPress
Making Money With Writing a blog – Blogger or WordPress
Writing a weblog is one of the most simplest and most efficient methods to generate earnings on the Online if it is recognized and done effectively. Although globe of Online has become too populated with weblogs, still there is a position for new blog writers and one can generate a reasonable earnings through blogging. If you are looking for beginning your own weblog but dont have enough information about where to begin, then Im going to talk about the two most well-known blogging resources with you which are the most liked blogging systems by starter blog writers as well as professionals also really like to variety their weblogs with any of these systems.
The two systems are Googles 100 % free Blog writer and the 100 % free WordPress. These two resources are most simplest and most efficient in handling a weblog. Lets begin examining the two resources to see which one is the better option for you to begin a weblog with.
Blogger has always been the preliminary choice of several bloggers. When I jumped in to the field of walking a blog, my weblog was hosted with Blogger. This weblog is now hosted on WordPress, but my several other blogs are still there and they are served by the free great hosting of Google Inc.
In the event you dont have money to start a self-hosted weblog, then Blogger is a great choice. You can start your walking a blog career with Blogger even in the event you dont need to invest a penny.
Moreover, you dont require to strike your head with complex technical issues when you pick Blogger as your jogging a blog host. You require to write content on your weblog & all server side issues are handled by Google engineers.
Its been seen that blogs hosted at Blogger are basically ranked & you can drive a lovely number of visitors to your Blogger blogs with ease. You require traffic & Blogger blogs get lovely amount of visitors in short span of time. I have experienced it & at a quantity of my Blogger blogs, I have succeeded in bringing even 5K unique visitors a day within a month.
Hacking Fears: Last but not least, Blogger blogs are harder to be hacked. Your Blogspot weblog is safe from hackers unless your Google account is hacked & it is rare in actual world. So Blogger ensures that your weblog is always safe in case you have enabled 2-Step Verification on your Google account.
AdSense: Google AdSense is the most productive & simplest weblog monetization source which can earn massive for you one time you are successful in establishing a lovely traffic for your weblog. Now experiments show that Blogger blogs are basically approved by Google for its AdSense program. So in getting AdSense, Blogger blogs do lovely which is yet another benefit of Blogger as a jogging a blog device.
If they look over monetization methods other than Google AdSense, Blogger lets you make use of any kind of monetization system including affiliate promotion, PPC, CPM & all other known traffic monetization methods as long as the source isnt spammy. You only require to be cautious about spam content & copyrighted material. These types of content is discouraged by Blogger & your weblog may get deleted if such content is found on your weblog.
These were some benefits of Google Blogger. Now lets have a glance over open source WordPress.
The two systems are Googles 100 % free Blog writer and the 100 % free WordPress. These two resources are most simplest and most efficient in handling a weblog. Lets begin examining the two resources to see which one is the better option for you to begin a weblog with.
BLOGSPOT FOR EARNING MONEY
Benefits of Using Blogger: To start with, Google provides you a dedicated quality hosting free. Your Google accounts 15GB free storage is available for your all blogs. This storage is countless for text and tiny images which you will be using on your Blogger weblog.Blogger has always been the preliminary choice of several bloggers. When I jumped in to the field of walking a blog, my weblog was hosted with Blogger. This weblog is now hosted on WordPress, but my several other blogs are still there and they are served by the free great hosting of Google Inc.
In the event you dont have money to start a self-hosted weblog, then Blogger is a great choice. You can start your walking a blog career with Blogger even in the event you dont need to invest a penny.
Moreover, you dont require to strike your head with complex technical issues when you pick Blogger as your jogging a blog host. You require to write content on your weblog & all server side issues are handled by Google engineers.
Its been seen that blogs hosted at Blogger are basically ranked & you can drive a lovely number of visitors to your Blogger blogs with ease. You require traffic & Blogger blogs get lovely amount of visitors in short span of time. I have experienced it & at a quantity of my Blogger blogs, I have succeeded in bringing even 5K unique visitors a day within a month.
Hacking Fears: Last but not least, Blogger blogs are harder to be hacked. Your Blogspot weblog is safe from hackers unless your Google account is hacked & it is rare in actual world. So Blogger ensures that your weblog is always safe in case you have enabled 2-Step Verification on your Google account.
AdSense: Google AdSense is the most productive & simplest weblog monetization source which can earn massive for you one time you are successful in establishing a lovely traffic for your weblog. Now experiments show that Blogger blogs are basically approved by Google for its AdSense program. So in getting AdSense, Blogger blogs do lovely which is yet another benefit of Blogger as a jogging a blog device.
If they look over monetization methods other than Google AdSense, Blogger lets you make use of any kind of monetization system including affiliate promotion, PPC, CPM & all other known traffic monetization methods as long as the source isnt spammy. You only require to be cautious about spam content & copyrighted material. These types of content is discouraged by Blogger & your weblog may get deleted if such content is found on your weblog.
These were some benefits of Google Blogger. Now lets have a glance over open source WordPress.
WORDPRESS AS BLOGGING TOOL
Now lets have a glance over features of WordPress.org. The jogging a blog gizmo is though the leading & most loved choice of bloggers, but the fact is, its several disadvantages which may frustrate beginner bloggers. Below few lines will make you understand about benefits & disadvantages of WordPress.org as a jogging a blog gizmo.
WordPress has versions. is free WordPress.com while other is self-hosted WordPress.org. In case you are confused on which version to be selected, either WordPress.com or WordPress.org, then you must go for WordPress.org as free WordPress.com doesnt let you monetize your blogs hosted with WordPress free jogging a blog platform.
Benefits: Benefits include the giant number of plugins, availability of lots of multipurpose themes & the tools flexibility in managing blogs. Plugins automate several jogging a blog tools including SEO, post scheduling, automatic social sharing of content, subscriber management & several others.
In addition, lots of pretty themes are available for this jogging a blog platform. You can search through a giant number of pretty themes & can decorate your weblog with either a free or premium theme of your choice. The pretty themes at WordPress.org give your weblog a professional look.
These benefits make WordPress.org an simpler & effective gizmo for managing blogs.
Commercial management including AdSense ads integration as well as affiliate promotion has been made simple with WordPress.org. With the help of plugins, you can manage ads & affiliate links on your weblog with ease.
In addition, you need to invest a lovely amount of money for your blogs maintenance when WordPress.org is selected. A custom domain for Blogger is optional but it is compulsory when you choose WordPress.org. Hosting charges also go up considerably when you need to go for a VPS or dedicated hosting.
Disadvantages: WordPress is technically complex & it may bring difficulties for beginner bloggers when hosted with a poor host. You need to be expert to deal with minor technical aspects of WordPress along with a superb support from your hosting provider to be positive that your weblog stays online on a regular basis.
So this was a comparison between WordPress & Blogger. In case you are thinking to start your jogging a blog journey, then Blogger could be a lovely option for you. Or in case you are expert with a first rate budget to invest, then WordPress.org will simplify jogging a blog tasks for you.
Moreover, your WordPress weblog is simpler to be hacked than a Blogger weblog. Hackers may succeed in hacking your WordPress weblog when you give them even a tiny chance by installing a malicious plugin or a theme.
I hope this comparison made you understand about where to start your jogging a blog career. In case you have got any more questions, you can ask in comments.
Available link for download
Subscribe to:
Posts (Atom)