Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » WordPress »

[SOLUCIONADO] Problemas de seguridad en mi WordPress

Estas en el tema de Problemas de seguridad en mi WordPress en el foro de WordPress en Foros del Web. Hola, llevo un par de semanas con problemas con spammers en una de mis webs. El problema es que se crea un archivo llamado php5.php ...
  #1 (permalink)  
Antiguo 12/01/2015, 03:34
Avatar de angelAparicio  
Fecha de Ingreso: julio-2009
Ubicación: Sevilla
Mensajes: 307
Antigüedad: 14 años, 8 meses
Puntos: 22
Problemas de seguridad en mi WordPress

Hola, llevo un par de semanas con problemas con spammers en una de mis webs.

El problema es que se crea un archivo llamado php5.php que redirecciona las visitas que vienen desde Google a una página de viagras y ese tipo de cosas.

Y en el index.php se crea esta linea al principio:
<?php if (is_file('php5.php')) @include('php5.php');?>

Si borro esta linea se soluciona, pero al cabo de un par de días vuelve a ocurrir. He cambiado todas las contraseñas (de wordpress y de FTP) y he instalado este plugin, que me avisa de cambios en los ficheros:
https://wordpress.org/plugins/all-in...-and-firewall/

Con esto puedo solucionar el problema rápido cuando ocurre, pero me gustaría que no volviera a ocurrir de nuevo cada 3 o 4 días.

¿A alguien le ha pasado esto? ¿Alguna forma de solucionarlo?
__________________
Mis webs:
- Programador Web Autónomo
- Conciertos en Sevilla
  #2 (permalink)  
Antiguo 12/01/2015, 07:35
Avatar de lauser
Moderator Unix/Linux
 
Fecha de Ingreso: julio-2013
Ubicación: Odessa (Ukrania)
Mensajes: 3.278
Antigüedad: 10 años, 8 meses
Puntos: 401
Respuesta: Problemas de seguridad en mi wordpress.

Tal vez te sirva este articulo.
__________________
Los usuarios que te responden, lo hacen altruistamente y sin ánimo de lucro con el único fin de ayudarte. Se paciente y agradecido.
-SOLOLINUX-
  #3 (permalink)  
Antiguo 13/01/2015, 04:16
Avatar de angelAparicio  
Fecha de Ingreso: julio-2009
Ubicación: Sevilla
Mensajes: 307
Antigüedad: 14 años, 8 meses
Puntos: 22
Respuesta: Problemas de seguridad en mi wordpress.

He añadido todo este tocho al htaccess, usando el plugin de seguridad antes comentado:

Código htaccess:
Ver original
  1. # BEGIN All In One WP Security
  2. #AIOWPS_BLOCK_WP_FILE_ACCESS_START
  3. <Files license.txt>
  4. order allow,deny
  5. deny from all
  6. </files>
  7. <Files wp-config-sample.php>
  8. order allow,deny
  9. deny from all
  10. </Files>
  11. <Files readme.html>
  12. order allow,deny
  13. deny from all
  14. </Files>
  15. #AIOWPS_BLOCK_WP_FILE_ACCESS_END
  16. #AIOWPS_BASIC_HTACCESS_RULES_START
  17. <Files .htaccess>
  18. order allow,deny
  19. deny from all
  20. </Files>
  21. ServerSignature Off
  22. LimitRequestBody 10240000
  23. <Files wp-config.php>
  24. order allow,deny
  25. deny from all
  26. </Files>
  27. #AIOWPS_BASIC_HTACCESS_RULES_END
  28. #AIOWPS_DISABLE_INDEX_VIEWS_START
  29. Options -Indexes
  30. #AIOWPS_DISABLE_INDEX_VIEWS_END
  31. #AIOWPS_DISABLE_TRACE_TRACK_START
  32. RewriteEngine On
  33. RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
  34. RewriteRule .* - [F]
  35. #AIOWPS_DISABLE_TRACE_TRACK_END
  36. #AIOWPS_FORBID_PROXY_COMMENTS_START
  37. RewriteCond %{REQUEST_METHOD} =POST
  38. RewriteCond %{HTTP:VIA}%{HTTP:FORWARDED}%{HTTP:USERAGENT_VIA}%{HTTP:X_FORWARDED_FOR}%{HTTP:PROXY_CONNECTION} !^$ [OR]
  39. RewriteCond %{HTTP:XPROXY_CONNECTION}%{HTTP:HTTP_PC_REMOTE_ADDR}%{HTTP:HTTP_CLIENT_IP} !^$
  40. RewriteCond %{REQUEST_URI} !^/(wp-login.php|wp-admin/|wp-content/plugins/|wp-includes/).* [NC]
  41. RewriteRule .* - [F,NS,L]
  42. #AIOWPS_FORBID_PROXY_COMMENTS_END
  43. #AIOWPS_ADVANCED_CHAR_STRING_FILTER_START
  44. <IfModule mod_alias.c>
  45. RedirectMatch 403 \,
  46. RedirectMatch 403 \:
  47. RedirectMatch 403 \;
  48. RedirectMatch 403 \=
  49. RedirectMatch 403 \@
  50. RedirectMatch 403 \[
  51. RedirectMatch 403 \]
  52. RedirectMatch 403 \^
  53. RedirectMatch 403 \`
  54. RedirectMatch 403 \{
  55. RedirectMatch 403 \}
  56. RedirectMatch 403 \~
  57. RedirectMatch 403 \"
  58. RedirectMatch 403 \$
  59. RedirectMatch 403 \<
  60. RedirectMatch 403 \>
  61. RedirectMatch 403 \|
  62. RedirectMatch 403 \.\.
  63. RedirectMatch 403 \%0
  64. RedirectMatch 403 \%A
  65. RedirectMatch 403 \%B
  66. RedirectMatch 403 \%C
  67. RedirectMatch 403 \%D
  68. RedirectMatch 403 \%E
  69. RedirectMatch 403 \%F
  70. RedirectMatch 403 \%22
  71. RedirectMatch 403 \%27
  72. RedirectMatch 403 \%28
  73. RedirectMatch 403 \%29
  74. RedirectMatch 403 \%3C
  75. RedirectMatch 403 \%3E
  76. RedirectMatch 403 \%3F
  77. RedirectMatch 403 \%5B
  78. RedirectMatch 403 \%5C
  79. RedirectMatch 403 \%5D
  80. RedirectMatch 403 \%7B
  81. RedirectMatch 403 \%7C
  82. RedirectMatch 403 \%7D
  83. # COMMON PATTERNS
  84. Redirectmatch 403 \_vpi
  85. RedirectMatch 403 \.inc
  86. Redirectmatch 403 xAou6
  87. Redirectmatch 403 db\_name
  88. Redirectmatch 403 select\(
  89. Redirectmatch 403 convert\(
  90. Redirectmatch 403 \/query\/
  91. RedirectMatch 403 ImpEvData
  92. Redirectmatch 403 \.XMLHTTP
  93. Redirectmatch 403 proxydeny
  94. RedirectMatch 403 function\.
  95. Redirectmatch 403 remoteFile
  96. Redirectmatch 403 servername
  97. Redirectmatch 403 \&rptmode\=
  98. Redirectmatch 403 sys\_cpanel
  99. RedirectMatch 403 db\_connect
  100. RedirectMatch 403 doeditconfig
  101. RedirectMatch 403 check\_proxy
  102. Redirectmatch 403 system\_user
  103. Redirectmatch 403 \/\(null\)\/
  104. Redirectmatch 403 clientrequest
  105. Redirectmatch 403 option\_value
  106. RedirectMatch 403 ref\.outcontrol
  107. # SPECIFIC EXPLOITS
  108. RedirectMatch 403 errors\.
  109. RedirectMatch 403 config\.
  110. RedirectMatch 403 include\.
  111. RedirectMatch 403 display\.
  112. RedirectMatch 403 register\.
  113. Redirectmatch 403 password\.
  114. RedirectMatch 403 maincore\.
  115. RedirectMatch 403 authorize\.
  116. Redirectmatch 403 macromates\.
  117. RedirectMatch 403 head\_auth\.
  118. RedirectMatch 403 submit\_links\.
  119. RedirectMatch 403 change\_action\.
  120. Redirectmatch 403 com\_facileforms\/
  121. RedirectMatch 403 admin\_db\_utilities\.
  122. RedirectMatch 403 admin\.webring\.docs\.
  123. Redirectmatch 403 Table\/Latest\/index\.
  124. </IfModule>
  125. #AIOWPS_ADVANCED_CHAR_STRING_FILTER_END
  126. #AIOWPS_FIVE_G_BLACKLIST_START
  127. # 5G BLACKLIST/FIREWALL (2013)
  128. # @ http://perishablepress.com/5g-blacklist-2013/
  129.  
  130. # 5G:[QUERY STRINGS]
  131. <IfModule mod_rewrite.c>
  132. RewriteEngine On
  133. RewriteBase /
  134. RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR]
  135. RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR]
  136. RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR]
  137. RewriteCond %{QUERY_STRING} (\\|\.\./|`|='$|=%27$) [NC,OR]
  138. RewriteCond %{QUERY_STRING} (\;|'|\"|%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR]
  139. RewriteCond %{QUERY_STRING} (base64_encode|localhost|mosconfig) [NC,OR]
  140. RewriteCond %{QUERY_STRING} (boot\.ini|echo.*kae|etc/passwd) [NC,OR]
  141. RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC]
  142. RewriteRule .* - [F]
  143. </IfModule>
  144.  
  145. # 5G:[USER AGENTS]
  146. <IfModule mod_setenvif.c>
  147. # SetEnvIfNoCase User-Agent ^$ keep_out
  148. SetEnvIfNoCase User-Agent (binlar|casper|cmsworldmap|comodo|diavol|dotbot|feedfinder|flicky|ia_archiver|jakarta|kmccrew|nutch|planetwork|purebot|pycurl|skygrid|sucker|turnit|vikspider|zmeu) keep_out
  149. <limit GET POST PUT>
  150. Order Allow,Deny
  151. Allow from all
  152. Deny from env=keep_out
  153. </limit>
  154. </IfModule>
  155.  
  156. # 5G:[REQUEST STRINGS]
  157. <IfModule mod_alias.c>
  158. RedirectMatch 403 (https?|ftp|php)\://
  159. RedirectMatch 403 /(https?|ima|ucp)/
  160. RedirectMatch 403 /(Permanent|Better)$
  161. RedirectMatch 403 (\=\\\'|\=\\%27|/\\\'/?|\)\.css\()$
  162. RedirectMatch 403 (\,|\)\+|/\,/|\{0\}|\(/\(|\.\.\.|\+\+\+|\||\\\"\\\")
  163. RedirectMatch 403 \.(cgi|asp|aspx|cfg|dll|exe|jsp|mdb|sql|ini|rar)$
  164. RedirectMatch 403 /(contac|fpw|install|pingserver|register)\.php$
  165. RedirectMatch 403 (base64|crossdomain|localhost|wwwroot|e107\_)
  166. RedirectMatch 403 (eval\(|\_vti\_|\(null\)|echo.*kae|config\.xml)
  167. RedirectMatch 403 \.well\-known/host\-meta
  168. RedirectMatch 403 /function\.array\-rand
  169. RedirectMatch 403 \)\;\$\(this\)\.html\(
  170. RedirectMatch 403 proc/self/environ
  171. RedirectMatch 403 msnbot\.htm\)\.\_
  172. RedirectMatch 403 /ref\.outcontrol
  173. RedirectMatch 403 com\_cropimage
  174. RedirectMatch 403 indonesia\.htm
  175. RedirectMatch 403 \{\$itemURL\}
  176. RedirectMatch 403 function\(\)
  177. RedirectMatch 403 labels\.rdf
  178. RedirectMatch 403 /playing.php
  179. RedirectMatch 403 muieblackcat
  180. </IfModule>
  181.  
  182. # 5G:[REQUEST METHOD]
  183. <ifModule mod_rewrite.c>
  184. RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
  185. RewriteRule .* - [F]
  186. </IfModule>
  187. #AIOWPS_FIVE_G_BLACKLIST_END
  188. # END All In One WP Security

A ver que pasa. Si sigue sin resultar, miraré lo que me comentas de solo permitir el acceso al panel de control en función de la IP. Aunque como son varios colaboradores, requiere algo de burocracia por mi parte
__________________
Mis webs:
- Programador Web Autónomo
- Conciertos en Sevilla
  #4 (permalink)  
Antiguo 13/01/2015, 10:20
Avatar de lauser
Moderator Unix/Linux
 
Fecha de Ingreso: julio-2013
Ubicación: Odessa (Ukrania)
Mensajes: 3.278
Antigüedad: 10 años, 8 meses
Puntos: 401
Respuesta: Problemas de seguridad en mi wordpress.

En todo caso puedes colocar todas las ip's de los admin.
De todas formas revisando tu htacces, creo que te falta algo importante.
Código :
Ver original
  1. RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
  2. RewriteRule .* – [F,L]
__________________
Los usuarios que te responden, lo hacen altruistamente y sin ánimo de lucro con el único fin de ayudarte. Se paciente y agradecido.
-SOLOLINUX-
  #5 (permalink)  
Antiguo 14/01/2015, 14:54
 
Fecha de Ingreso: enero-2015
Ubicación: Sevilla / España
Mensajes: 4
Antigüedad: 9 años, 2 meses
Puntos: 1
Respuesta: Problemas de seguridad en mi wordpress.

Hola, Ángel,

Seguramente tengas un plugin, el tema o el mismo WordPress, infectado. Bájate el plugin WordFence( https://wordpress.org/plugins/wordfence/ ) y escanea tu web.
Suele pasar si te has bajado algún plugin o el tema de un sitio no fiable.

¡Suerte!
  #6 (permalink)  
Antiguo 15/01/2015, 03:55
Avatar de angelAparicio  
Fecha de Ingreso: julio-2009
Ubicación: Sevilla
Mensajes: 307
Antigüedad: 14 años, 8 meses
Puntos: 22
Respuesta: Problemas de seguridad en mi wordpress.

He añadido el libwww-perl

He instalado el WordFence y aun quedaban algún que otro fichero infectado, que he borrado.

A ver como evoluciona.
__________________
Mis webs:
- Programador Web Autónomo
- Conciertos en Sevilla
  #7 (permalink)  
Antiguo 15/01/2015, 07:17
Avatar de lauser
Moderator Unix/Linux
 
Fecha de Ingreso: julio-2013
Ubicación: Odessa (Ukrania)
Mensajes: 3.278
Antigüedad: 10 años, 8 meses
Puntos: 401
Respuesta: Problemas de seguridad en mi wordpress.

Me da la sensación que con tantos 301 vas a perder usabilidad en seo.
__________________
Los usuarios que te responden, lo hacen altruistamente y sin ánimo de lucro con el único fin de ayudarte. Se paciente y agradecido.
-SOLOLINUX-
  #8 (permalink)  
Antiguo 17/01/2015, 15:44
Avatar de zanguanga
Moderadora
 
Fecha de Ingreso: julio-2009
Ubicación: España
Mensajes: 1.686
Antigüedad: 14 años, 8 meses
Puntos: 429
Respuesta: Problemas de seguridad en mi wordpress.

Deberías revisar también los permisos de todos los directorios y archivos de la instalación, y cambiar las contraseñas del FTP, de WP y de la BD. En cuestiones de seguridad es mejor prevenir que curar. Como norma sigue las recomendaciones de seguridad de WordPress.
__________________
Mi blog personal | Mi G+
  #9 (permalink)  
Antiguo 20/01/2015, 02:24
Avatar de angelAparicio  
Fecha de Ingreso: julio-2009
Ubicación: Sevilla
Mensajes: 307
Antigüedad: 14 años, 8 meses
Puntos: 22
Respuesta: Problemas de seguridad en mi WordPress

Bueno, parece que tras una semana no hay más infecciones. Lo marco solucionado.
__________________
Mis webs:
- Programador Web Autónomo
- Conciertos en Sevilla

Etiquetas: página, php, plugin, seguridad
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:35.