SpringShell CVE-2022-22963 检查工具

admin 2022年3月31日13:10:15评论404 views字数 4399阅读14分39秒阅读模式
点击上方蓝字“Ots安全”一起玩耍

暂时没有共享POC

漏洞介绍:

CVE-2022-22963 描述了一种可能的远程代码执行 (RCE)流行的 Spring Boot 框架中的漏洞。只需发送 POST带有特定负载的请求会导致易受攻击的服务器执行代表攻击者的命令。


检查 Spring

该工具将尝试确定运行它的主机是否容易受到 CVE-2022-22963 的攻击。


该漏洞通常与尚未确认的名为“SpringShell”的 RCE 相关联(有关更多详细信息,请参阅此帖子)。


CVE-2022-22963,SpEL / Spring 表达式资源访问漏洞 与此无关,但至少得到证实。


这与 check-log4 工具非常相似,它遍历文件系统以查找 Java 档案,破解打开的档案,然后查找已知的易受攻击的 jar 或类。


请参阅手册页以获取完整的详细信息。


安装

要将命令和手册页安装在方便的地方,请运行make install;Makefile 默认为 '/usr/local' 但您可以更改前缀:

$ make PREFIX=~ install

文档

NAME     check-springshell - try to determine if a host is vulnerable to Spring     CVE-2022-22963
SYNOPSIS check-springshell [-Vhv] [-j jar] [-p path] [-s skip]
DESCRIPTION The check-springshell tool attempts to determine whether the host it is executed on is vulnerable to the Spring SpEL / Expression Resource Access Vulnerability vulnerability identified as CVE-2022-22963.
Since this vulnerability is in a specific Java class that may be inside nested Java archive files, check-springshell may be somewhat intrusive to run and should be executed with care and consideration of the system's load. Please see DETAILS for more information.
OPTIONS The following options are supported by check-springshell:
-V Print version number and exit.
-h Print a short help message and exit.
-j jar Check only this archive, nothing else. Can be specified multiple times for multiple JAR (or other zip formatted archive) files.
-p path Limit filesystem traversal to this directory. Can be specified multiple times. If not specified, check-springshell will default to '/'.
-s skip Skip the given checks. Valid arguments are 'files', 'packages', and 'processes'.
-v Be verbose. Can be specified multiple times.
DETAILS CVE-2022-22963 describes a possible remote code execution (RCE) vulnerability in the popular Spring Boot framework. Simply sending a POST request with a specific payload can cause the vulnerable server to execute commands on the attacker's behalf.
To determine whether a host is vulnerable, the check-springshell tool will perform the following checks: o check for the existence of likely vulnerable packages o check for the existence of java processes using the 'CachedIntrospectionResuLts' class
The discovery process may include running find(1), lsof(1), rpm(1), or yinst(1); please use the -s flag to skip any checks that might have a negative impact on your host.
The output of the command attempts to be human readable and provide sufficient information to judge whether the host requires attention.
ENVIRONMENT The following environment variables influence the behavior of check-springshell:
CHECK_SPRINGSHELL_FIND_OPTS_PRE Additional options to pass to find(1) prior to the path name(s).
By default, check-springshell runs "find / -type f -name '*.[ejw]ar'"; the contents of this variable are placed immediately after the 'find' and before the path name(s).
CHECK_SPRINGSHELL_FIND_OPTS_POST Additional options to pass to find(1) immediately after the path name(s).
EXAMPLES Sample invocation on a non-vulnerable host:
$ check-springshell No obvious indicators of vulnerability found. $
Sample invocation only looking at processes
$ check-springshell -s files -s packages -v -v => Running all checks... ==> Skipping package check. ==> Looking for jars... ==> Skipping files check. ==> Checking all found jars... check-springshell 1.0 localhost: Possibly vulnerable jar 'BOOT-INF/lib/spring-beans-5.3.16.jar' (inside of /usr/local/myapp/myservice-0.0.1.jar) used by process 15569.
$
Sample invocation searching only /var and /usr/local/lib and skipping package and process checks:
$ check-springshell -p /var -p /usr/local/lib -s packages -s processes Possibly vulnerable jar '/usr/local/lib/jars/spring-beans-5.3.16.jar'. Possibly vulnerable jar '/usr/local/lib/jars/spring-beans.jar'. $
Note version comparisons are only done for packages, which is why the above output incudes files ending in a seemingly non-vulnerable version.
To avoid mountpoint traversal on a Unix system where find(1) requires the -x flag to precede the paths:
$ env CHECK_SPRINGSHELL_FIND_OPTS_PRE="-x" check-springshell No obvious indicators of vulnerability found.
To only search files newer than '/tmp/foo':
$ env CHECK_SPRINGSHELL_FIND_OPTS_POST="-newer /tmp/foo" check-springshell No obvious indicators of vulnerability found.
EXIT STATUS check-springshell will return 0 if the host was found not to be vulnerable and not in need of any update; it will return 1 if a vulnerable jar or package was detected.
SEE ALSO find(1), lsof(1), rpm(1), yinst(1)
HISTORY check-springshell was originally written by Jan Schaumann <[email protected]> in March 2022.
BUGS Please file bugs and feature requests via GitHub pull requests and issues or by emailing the author.

根据POC中描述文件,该方式也是通过搜索一下版本进行检测

     $ check-springshell -p /var -p /usr/local/lib -s packages -s processes     Possibly vulnerable jar '/usr/local/lib/jars/spring-beans-5.3.16.jar'.     Possibly vulnerable jar '/usr/local/lib/jars/spring-beans.jar'.     $


项目地址:https://github.com/jschauma/check-springshell

SpringShell CVE-2022-22963 检查工具

原文始发于微信公众号(Ots安全):SpringShell CVE-2022-22963 检查工具

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年3月31日13:10:15
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   SpringShell CVE-2022-22963 检查工具https://cn-sec.com/archives/857856.html

发表评论

匿名网友 填写信息