martes, 20 de enero de 2015

Management with Web Hacking. Inserting links

http://www.albertsalvany.com/blog-home-1.html

traducido por Federico Dilla


Hacking Web. Inserting links

by Albert Salvany

  Posted on 21/12/2014 8:22 p.m.

This week, our website regarding our proposed trading in the forex market, FOREXperiences.com has suffered a cyber attack. How have we solved?

This attack was not a specific thing our domain but reports of specialized companies indicate that there has been a spike of activity on websites using CMS like Wordpress or Joomla. It has not been a virus, but an issue of introduction of external links to improve the positioning of certain websites on the Internet. We thought it might be useful to other webmasters who are in this situation know how we managed to reverse the situation and eliminate the threat was being detected by our antivirus and staff Google has warned us of this fact through Google Webmaster Tools.


Anatomy of a crime

If we step, we can see how the antivirus detects threats as JS / HiddenLink, ie a type of malware that artificially generates links to other websites to gain positioning. To do this it uses a call to a JavaScript method that puts us a link in a coordinate off-screen so that it actually is not detected. If the only activity of malware is this, someone might think it's not so necessary to act, as they are not hurting us directly, but keep in mind that Google penalizes such practices, and thus the web descend positioning search engine if we act quickly, since this is a prohibited activity. On the other hand we have a picture theme which is also quite important: Many antivirus detect this malware and give appropriate notice to the user, so if we do not act it all you will see is that no action is taken in a situation of this, probably without knowing the scope of this malware


Research line

As in these cases, we started to investigate what could be the source. Keep in mind that when code that is generated on the server, what we can see in the original source code are all procedures that end up generating this code, therefore we have two main tools to indicate the solution issue:


The source code file server (php in this case)

The source code generated by the browser (which in the case of Chrome you can get with this option by pressing the right mouse button.

And I say this because I am going to show a specific case, but obviously the situation may have other variants, but all with the same base. Seeing that the documentation from the antivirus did not give me much more information that was useful, since they affect the elimination of virus "client" part is what makes the product, but not eliminate the source, I decided to look other resources and found an interesting page:


sitecheck.sucuri.net/

Examining malware

This page is a free malware scanner. All you have to do is put your URL in the box and examine the code to identify possible sources of this malware. The process will take a detail of all incidents encountered, and most importantly, a small window in which some malicious code that gives us important information in our case shows: dnnViewState.


dnnViewState is a Javascript function that is being used in this case to inject the code with the link. As mentioned, this link is not visible because it is placed outside of the screen and also encoded so we can not find a particular string within the code, but despite these difficulties, it is possible to identify the point where the code has been altered.


Identifying the insertion point

The more complicated and exhausting step certainly is this, since for them must be computer literate. We will use the extracted code browser, in which we will look into it the point where it is insertanto Javascript procedure that generates the link. As mentioned, we will find the link physical form in our file on the server because it is generated by interpreting the relevant language in which is developed the web (php).


Once we have located the point, we turn to our source code from the server looking for the same point where the code is inserted, and that we must seek the php process that is generating and its corresponding file on the server. Keep in mind that if we work with template, the module can be physically housed in corresponding to the same directory.


Within the module we will look something like this:


Once located we only remove this sentence and this should be solved the problem. I hope this helps to close affected by this issue and will provide the solution, but if you need more help just have to send a message



Hacking Web. Inserción de enlaces


 Posteado on 21/12/2014 20:22 PM



Durante esta semana, nuestra web referente a nuestro proyecto de trading en el mercado de divisas, FOREXperiences.com ha sufrido un ataque informático. Cómo lo hemos solucionado?
Este ataque no ha sido una cosa específica de nuestro dominio sino que los reportes de las empresas especializadas indican que se ha producido un pico de actividad en las webs que utilizan CMS como Wordpress o Joomla. No se ha tratado de un virus, sino un tema de introducción de links externos para mejorar el posicionamiento de ciertas webs en Internet. Hemos pensado que podría ser útil para otros webmasters que se encuentren en esta situación saber cómo hemos logrado revertir la situación y eliminar la amenaza que estaba siendo detectada por nuestro antivirus y el personal de Google que nos ha advertido de este hecho a través de las Google Webmaster Tools.

Anatomía de un crimen

Si vamos por pasos, podemos ver como el antivirus detecta la amenaza como JS/HiddenLink, es decir un tipo de malware que genera artificialmente enlaces a otras webs para ganar posicionamiento. Para ello se vale de unallamada a un procedimiento JavaScript que nos coloca un link en unas coordenadas fuera de la pantalla para que éste hecho no sea detectado. Si la única actividad del malware es ésta, alguien podría pensar que tampoco es tan necesario que actuemos, pues no están perjudicándonos de forma directa, pero hay que tener en cuenta que Google penaliza este tipo de prácticas, y por tanto la web descenderá de posicionamiento en los buscadores si no actuamos rápidamente, puesto que esto es una actividad prohibida. Por otro lado tenemos un tema de imagen que también es bastante importante: Muchos de los antivirus detectan este malware y dan el correspondiente aviso al usuario, por lo que si no actuamos éste lo único que verá es que no se toman medidas ante una situación de este tipo, seguramente sin conocer el alcance de este malware

Línea de investigación

Como ocurre en estos casos, nos pusimos a investigar cual podría ser el origen. Hay que tener en cuenta que al ser código que se genera en el servidor, nosotros lo que podemos ver en el código fuente original son todos los procedimientos que acaban generando este código, por tanto, debemos contar con dos herramientas principales para indicar la solución al problema:
  • El código fuente del fichero del servidor (php en este caso)
  • El código fuente generado por el navegador (que en el caso de Chrome lo puedes obtener con una opción presente pulsando el botón derecho del ratón.
Y digo esto porque yo os voy a mostrar un caso concreto, pero evidentemente la situación puede tener otras variantes, aunque todas con la misma base. Viendo que la documentación procedente del antivirus no me daba mucha más información que fuera de utilidad, dado que ellos inciden en la eliminación del virus de la parte “cliente” que es la que realiza el producto, pero no como eliminar la fuente, decidí buscar otros recursos y encontré una página interesante:
sitecheck.sucuri.net/

Examinando el malware

Esta página es un scanner de malware gratuito. Lo único que debes hacer es poner tu URL en la casilla y el examinará el código para identificar posibles orígenes de ese malware. El proceso te saca un detalle de todas las incidencias encontradas, y lo más importante, una pequeña ventana en donde se visualiza parte del código malicioso que nos da una importante información en nuestro caso: dnnViewState.
dnnViewState es una función de Javascript que se está utilizando en este caso para inyectar el código con el enlace. Tal y como hemos comentado, éste enlace no es visible, ya que se coloca fuera de la pantalla y además, se codifica para que no podamos buscar un string concreto dentro del código, pero a pesar de estas dificultades, es posible identificar el punto donde el código se ha alterado.

Identificando el punto de inserción

El paso más complicado y agotador sin duda es éste, dado que para ellos hay que tener conocimientos de informática. Para ello utilizaremos el código extraído del navegador, en el que pasaremos a buscar dentro de él el puntodónde se está insertanto el procedimiento Javascript que genera el enlace. Como hemos comentado, no encontraremos el enlace de forma física en nuestro fichero en el servidor porque se genera al interpretar el lenguaje correspondiente en el que está desarrollado la web (php).
Una vez hemos localizado el punto, pasamos a examinar nuestro código fuente procedente del servidor buscando el mismo punto en el que está insertado el código, y ahí debemos buscar el procedimiento php que lo está generando y su fichero correspondiente en el servidor. Hay que tener en cuenta, que si trabajamos con plantilla, el módulo puede estar alojado físicamente en los directorios correspondientes a la misma.
Dentro del módulo deberemos buscar algo parecido a esto:
Una vez localizado debemos eliminar únicamente esta sentencia, y con esto debería quedar solucionado el problema. Espero que esto sirva de ayuda a próximos afectados por este problema y os facilite la solución, pero si necesitáis más ayuda sólo tenéis que enviar un mensaje