免责声明
0x01 Jetty简介
cd
$JETTY_HOME
java -jar start.jar
2023
-
03
-
08
17
:
24
:
44.806
:INFO::main: Logging initialized @
334
ms
2023
-
03
-
08
17
:
24
:
44.858
:WARN:oejs.HomeBaseWarning:main: This instance of Jetty
is
not running from a separate {jetty.base} directory,
this
is
not recommended. See documentation at http:
//www.eclipse.org/jetty/documentation/current/startup.html
2023
-
03
-
08
17
:
24
:
44.995
:INFO:oejs.Server:main: jetty-
9.3
.0.v20150601
2023
-
03
-
08
17
:
24
:
45.012
:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:
///opt/jetty-distribution-9.3.0.v20150601/webapps/] at interval 1
2023
-
03
-
08
17
:
24
:
45.030
:INFO:oejs.ServerConnector:main: Started
ServerConnector@
19
dfb72a{HTTP/
1.1
,[http/
1.1
]}{
0.0
.0.0:
8080
}
2023
-
03
-
08
17
:
24
:
45.030
:INFO:oejs.Server:main: Started @
558
ms
cd
$JETTY_HOME
/demo-base/
java -jar
$JETTY_HOME
/start.jar
成功运行将有如下信息输出:
2023-03-08 17:24:24.161:INFO::main: Logging initialized @308ms
2023-03-08 17:24:24.431:WARN::main: demo test-realm is deployed.
DO
NOT
USE
IN
PRODUCTION!
2023
-03
-08
17
:
24
:
24.434
:INFO:oejs.Server:
main
: jetty
-9.3
.0
.v20150601
2023
-03
-08
17
:
24
:
24.457
:INFO:oejdp.ScanningAppProvider:
main
: Deployment monitor [
file
:///opt/jetty-distribution
-9.3
.0
.v20150601/demo-base/webapps/]
at
interval
1
2023
-03
-08
17
:
24
:
24.826
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.w.WebAppContext@c038203{/,
file
:///opt/jetty-distribution
-9.3
.0
.v20150601/demo-base/webapps/ROOT/,AVAILABLE}{/ROOT}
2023
-03
-08
17
:
24
:
24.929
:WARN::
main
:
test
-jaas webapp
is
deployed.
DO
NOT
USE
IN
PRODUCTION!
2023
-03
-08
17
:
24
:
24.978
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.w.WebAppContext@
46238e3
f{/
test
-jaas,
file
:///tmp/jetty
-0.0
.0
.0
-8080
-
test
-jaas.war-_test-jaas-
any
-9105214562680121772.
dir/webapp/,AVAILABLE}{/
test
-jaas.war}
2023
-03
-08
17
:
24
:
25.162
:WARN::
main
: async-rest webapp
is
deployed.
DO
NOT
USE
IN
PRODUCTION!
2023
-03
-08
17
:
24
:
25.208
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.w.WebAppContext@
6
b67034{/async-rest,[
file
:///tmp/jetty
-0.0
.0
.0
-8080
-async-rest.war-_async-rest-
any
-1023939491558622183.
dir/webapp/, jar:
file
:///tmp/jetty
-0.0
.0
.0
-8080
-async-rest.war-_async-rest-
any
-1023939491558622183.
dir/webapp/WEB-INF/lib/example-async-rest-jar
-9.3
.0
.v20150601.jar!/META-INF/resources],AVAILABLE}{/async-rest.war}
2023
-03
-08
17
:
24
:
25.311
:WARN::
main
:
test
-jndi webapp
is
deployed.
DO
NOT
USE
IN
PRODUCTION!
2023
-03
-08
17
:
24
:
25.386
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.w.WebAppContext@
8
b96fde{/
test
-jndi,
file
:///tmp/jetty
-0.0
.0
.0
-8080
-
test
-jndi.war-_test-jndi-
any
-1692053319754270133.
dir/webapp/,AVAILABLE}{/
test
-jndi.war}
2023
-03
-08
17
:
24
:
25.508
:WARN::
main
:
test
-spec webapp
is
deployed.
DO
NOT
USE
IN
PRODUCTION!
2023
-03
-08
17
:
24
:
25.594
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.w.WebAppContext@
69930714
{/
test
-spec,[
file
:///tmp/jetty
-0.0
.0
.0
-8080
-
test
-spec.war-_test-spec-
any
-5518740932795802823.
dir/webapp/, jar:
file
:///tmp/jetty
-0.0
.0
.0
-8080
-
test
-spec.war-_test-spec-
any
-5518740932795802823.
dir/webapp/WEB-INF/lib/
test
-web-fragment
-9.3
.0
.v20150601.jar!/META-INF/resources],AVAILABLE}{/
test
-spec.war}
2023
-03
-08
17
:
24
:
25.781
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.w.WebAppContext@
3
eb7fc54{/proxy,
file
:///tmp/jetty
-0.0
.0
.0
-8080
-xref-proxy.war-_xref-proxy-
any
-3068657547009829038.
dir/webapp/,AVAILABLE}{/xref-proxy.war}
2023
-03
-08
17
:
24
:
25.786
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.s.h.MovedContextHandler@
59662
a0b{/oldContextPath,
null
,AVAILABLE}
2023
-03
-08
17
:
24
:
25.951
:WARN::
main
:
test
webapp
is
deployed.
DO
NOT
USE
IN
PRODUCTION!
2023
-03
-08
17
:
24
:
26.248
:INFO:oejsh.ContextHandler:
main
: Started o.e.j.w.WebAppContext@
4
f83df68{/
test
,
file
:///tmp/jetty
-0.0
.0
.0
-8080
-test.war-_test-
any
-5238659347611323540.
dir/webapp/,AVAILABLE}{/test.war}
2023
-03
-08
17
:
24
:
26.255
:INFO:oejs.ServerConnector:
main
: Started ServerConnector@
5
a9c4ad9{
HTTP
/
1.1
,[
http
/
1.1
]}{
0.0
.0
.0
:
8080
}
2023
-03
-08
17
:
24
:
26.259
:INFO:oejus.SslContextFactory:
main
: x509={jetty.eclipse.org=jetty} wild={}
alias
=
null
for
SslContextFactory@
23941
fb4(
file
:///opt/jetty-distribution
-9.3
.0
.v20150601/demo-base/etc/keystore,
file
:///opt/jetty-distribution
-9.3
.0
.v20150601/demo-base/etc/keystore)
2023
-03
-08
17
:
24
:
26.269
:INFO:oejs.ServerConnector:
main
: Started ServerConnector@
5
d908d47{SSL,[ssl,
http
/
1.1
]}{
0.0
.0
.0
:
8443
}
2023
-03
-08
17
:
24
:
26.270
:INFO:oejs.Server:
main
: Started @
2417
ms
现在可以通过浏览器访问 http://localhost:8080, 此时可以看到一个Jetty的欢迎页面,页面上包含几个简单的例子,欢迎页面如下
cd $JETTY_HOME/demo-base/
java -jar $JETTY_HOME/start.jar --
list
-modules
java -jar %JETTY_HOME/start.jar --
list
-config
--
list
-modules:此命令将返回当前服务所有可用的模块,同时也会显示本地的模块,信息包括模块实现的顺序,依赖模块以及相应的jar信息
--
list
-config:显示运行环境和配置文件等信息
cd
$JETTY_BASE
java -jar
$JETTY_HOME
/start.jar jetty.http.port=8081
另外,可以将要设置的端口属性添加到start.ini或者start.d/http.ini文件中。默认情况,在start.d/http.ini文件中定义的jetty.http.port属性可以被修改成另一个值。
为HTTPS & HTTP2增加SSL
可通过如下命令,添加并激活HTTPS和HTTP2模块
java -jar $JETTY_HOME/start.jar --add-to-startd=https,http2
java -jar $JETTY_HOME/start.jar
2023
-
03
-08
17
:
27
:
45.933
:INFO
:oejs
.
ServerConnector:
main:
Started ServerConnector@6f1fba17{SSL,[ssl, alpn, h2, http/
1.1
]}{
0
.
0
.
0
.
0
:
8443
}
cd
$JETTY_BASE
java -jar
$JETTY_HOME
/start.jar jetty.ssl.port=5500
java -jar
$JETTY_HOME
/start.jar --
help
Jetty示例Web Application
ROOT/:这个文件夹包含各种静态资源。包含Jetty欢迎页面,默认访问路径为/
test.d:一个包含附加配置文件的文件夹,被test.xml使用用来为test.war增加额外的配置
test.xml:一个context配置文件,用来配置和部署test.war,包含上下文环境和test.d里面的配置附加的配置信息
test.war:在test.xml里面配置的示例web程序
async-rest.war:一个异步示例的web应用程序
test
-jaas.war:一个使用JAAS身份验证的web应用程序。
test
-jaas.xml:用来配置
test
-jaas.war的配置文件
test
-jndi.war:一个使用JNDI的示例应用
test
-jndi.xml:用来配置
test
-jndi.war的配置文件
test
-spec.war:一个使用注解,ServletContainerInitializers 和Servlet 3.0/3.1规范的示例应用
test
-spec.xml:用来配置
test
-spec.war的配置文件
xref-proxy.war:使用代理的一个示例应用
example-moved.xml:一个演示MovedContextHandler重定向使用的示例应用
异步Servlet
异步Servlet是Servlet3.0出来的新特性。在并发量较大的情况下,若一个Servlet处理较慢,则会导致所有Servlet需要排队等待之前的Servlet线程处理完后才能继续执行。在加入异步Servlet之后,可以在处理时间较长的Servlet中增加单独的工作线程专门处理该业务,然后Servlet线程继续处理其他的Servlet请求
0x02 Jetty漏洞复现
jetty
9
.4
.40
jetty
10
.0
.2
jetty
11
.0
.2
对字母“W"进行双重URL编码,即可绕过限制进行访问:
/
static
?
/%2557EB-INF/
web.xml
CVE-2021-28164 敏感信息泄露
漏洞简介:
.和..称为点段,都是为路径名层次结构中的相对引用而定义的,它们在一些操作系统文件目录结构中分别代表当前目录和父目录。但是与文件系统不同的是,这些点段仅在 URI 路径中解释层次结构,并作为解析过程的一部分被删除。也就是说在解析URI路径时,需要先处理.和..,Jetty为了符合这种处理方式,却导致了一系列的漏洞产生,首先是在9.4.39版本中修复了CVE-2021-28164,然后出现了新的绕过,其又在9.4.43版本中修复了CVE-2021-34429。
使用空字符绕过:
原文始发于微信公众号(狐狸说安全):中间件常见漏洞之Jetty
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论