Skip to content

Commit 7eef3a0

Browse files
author
gsbp
committed
update n1ctfwp
1 parent a4a4d88 commit 7eef3a0

File tree

24 files changed

+1024
-115
lines changed

24 files changed

+1024
-115
lines changed

.DS_Store

2 KB
Binary file not shown.

content/.DS_Store

0 Bytes
Binary file not shown.

content/about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ layout='about'
66

77
+++
88

9-
一名大二在读学生
9+
一名大三在读学生
1010

11-
Syclover核心成员,主力成员&Nu1L成员
11+
Syclover队长&Nu1L成员
1212

1313
对各种安全感兴趣,目前主要学习的还的是Web安全(Java 安全、偶然也会学点云安全,等)
1414

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
+++
2+
date = '2025-11-03T12:00:00+08:00'
3+
draft = false
4+
title = '[2025]N1CTF WP for n1cat,eezzjs'
5+
author='GSBP'
6+
categories=["Java安全","CVE","N1CTF","WP"]
7+
8+
+++
9+
10+
## TL;DR
11+
12+
It's my first time to create challenges after i entered Nu1L Team. I'm glad to see so many hackers could solve my challenges though they have few problems(Such as in eezzjs, flag is in `/flag` instead of `/ffffflag` because my new attachment did not update on competition platform in time). Here are my expected solutions for these challenges
13+
14+
## eezzjs
15+
16+
In this challenges, your first work is to get a legal JWT that you could pass `authenticateJWT` middleware and use `/upload` to upload your file arbitrarily.
17+
18+
Actually it is easy to find this vuln. Beacuse when you try to debug locally, you could find information in this image
19+
20+
![image-20251103111304530](https://tuchuang-1322176132.cos.ap-chengdu.myqcloud.com//imgimage-20251103111304530.png)
21+
22+
When you run `npm audit`, you got the vuln is in sha.js,even it tells you the advisory of this vuln XD.
23+
24+
![image-20251103111339546](https://tuchuang-1322176132.cos.ap-chengdu.myqcloud.com//imgimage-20251103111339546.png)
25+
26+
The Principle of sha.js vuln is when you submit an Object as `update()` 's arg, you could find `length` is assign by `data.length`,so this._len can be control that if data is an Object and it has a member named `length`
27+
28+
```
29+
Hash.prototype.update = function (data, enc) {
30+
if (typeof data === 'string') {
31+
enc = enc || 'utf8'
32+
data = Buffer.from(data, enc)
33+
}
34+
35+
var block = this._block
36+
var blockSize = this._blockSize
37+
var length = data.length
38+
var accum = this._len
39+
40+
for (var offset = 0; offset < length;) {
41+
var assigned = accum % blockSize
42+
var remainder = Math.min(length - offset, blockSize - assigned)
43+
44+
for (var i = 0; i < remainder; i++) {
45+
block[assigned + i] = data[offset + i]
46+
}
47+
48+
accum += remainder
49+
offset += remainder
50+
51+
if ((accum % blockSize) === 0) {
52+
this._update(block)
53+
}
54+
}
55+
56+
this._len += length
57+
return this
58+
}
59+
```
60+
61+
where `this._len` equals to zero,its value always becomes the same.Then you could pass `authenticateJWT` and upload your file.
62+
63+
Next step,you should use `/upload` and `/` try to get RCE
64+
65+
As we all know,when ejs try to template a view in web.it would try to run this code
66+
67+
```
68+
...
69+
if (!opts.engines[this.ext]) {
70+
// load engine
71+
var mod = this.ext.slice(1)
72+
debug('require "%s"', mod)
73+
74+
// default engine export
75+
var fn = require(mod).__express
76+
77+
if (typeof fn !== 'function') {
78+
throw new Error('Module "' + mod + '" does not provide a view engine.')
79+
}
80+
...
81+
```
82+
83+
when you submit `?templ=abc.ddw`,it would try to require ddw modules. It gives us a chance to run arbitrary code.
84+
85+
![image-20251103121255718](https://tuchuang-1322176132.cos.ap-chengdu.myqcloud.com//imgimage-20251103121255718.png)
86+
87+
But we couldn't create dir or `js` file.How do we attack?
88+
89+
In [documents]("https://nodejs.org/api/modules.html") we could know
90+
91+
> If the exact filename is not found, then Node.js will attempt to load the required filename with the added extensions: `.js`, `.json`, and finally `.node`. When loading a file that has a different extension (e.g. `.cjs`), its full name must be passed to `require()`, including its file extension (e.g. `require('./file.cjs')`).
92+
93+
So we could use `.node` file to finish our attack,[My exploit]("https://github.com/Nu1LCTF/n1ctf-2025/tree/main/web/eezzjs/solution")
94+
95+
At last, i felt sorry for this challenge really has some issues,and there many unexpected solutions can solve this challenge that could use simply `../` or `./` bypass my ez waf haha.
96+
97+
## n1cat
98+
99+
n1cat is a gray challenge because if i provide full source code, the first step( `CVE-2025-55752`) is completely useless XD. In other words you could use this vulnerability to get full source code(maybe some libs was confused).
100+
101+
My attachment provide a Tomcat file `rewrite.config`,then you know `CVE-2025-55752` is a point of this challenge. You could try to read `web.xml`.
102+
103+
```
104+
<?xml version="1.0" encoding="UTF-8"?>
105+
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
106+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
107+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
108+
version="4.0">
109+
<servlet>
110+
<servlet-name>welcomeServlet</servlet-name>
111+
<servlet-class>ctf.n1cat.welcomeServlet</servlet-class>
112+
</servlet>
113+
114+
<servlet-mapping>
115+
<servlet-name>welcomeServlet</servlet-name>
116+
<url-pattern>/</url-pattern>
117+
</servlet-mapping>
118+
</web-app>
119+
120+
```
121+
122+
then you know `welcomeServlet` class path,you could use the same way to down it. The same applies to the`User` class and detect lib.
123+
124+
User.class
125+
126+
```
127+
package ctf.n1cat;
128+
129+
import javax.naming.InitialContext;
130+
import javax.naming.NamingException;
131+
132+
public class User {
133+
private String name;
134+
private String word;
135+
private String url;
136+
137+
public User(){
138+
}
139+
public String getName() {
140+
return name;
141+
}
142+
public String getWord() {
143+
return word;
144+
}
145+
public void setWord(String password) {
146+
this.word = password;
147+
}
148+
149+
public void setName(String name) throws NamingException {
150+
this.name = name;
151+
}
152+
public String getUrl() {
153+
return url;
154+
}
155+
public void setUrl(String url) {
156+
try{
157+
new InitialContext().lookup(url);
158+
} catch (NamingException e) {
159+
throw new RuntimeException(e);
160+
}
161+
}
162+
}
163+
164+
```
165+
166+
You could directly find a JNDI Injection vuln. Now first step is over.
167+
168+
The second step is try to use this vulnerability to get an rce.JDK version is 17,many ways of JNDI attack might not working.I uses RMI communicate deserialize(Communication between the RMI server and RMI client employs serialisation and deserialisation).About deserialize chains,we uses Jackson+SpringAOP to solve this (You could find `Jackson` dependence in `welcomeServlet`,`SpringAOP`dependence and version could use `CVE-2025-55752` to detect).
169+
170+
About this chains analysis,could see [this]("https://fushuling.com/index.php/2025/08/21/%e9%ab%98%e7%89%88%e6%9c%acjdk%e4%b8%8b%e7%9a%84spring%e5%8e%9f%e7%94%9f%e5%8f%8d%e5%ba%8f%e5%88%97%e5%8c%96%e9%93%be/")
171+
172+
[My exploit]("https://github.com/Nu1LCTF/n1ctf-2025/tree/main/web/n1cat/solution")
173+
174+
![image-20251103135843185](https://tuchuang-1322176132.cos.ap-chengdu.myqcloud.com//imgimage-20251103135843185.png)
175+
176+
## END
177+
178+
All challenges and solutions has uploaded on [GitHub]("https://github.com/Nu1LCTF/n1ctf-2025").Hope next time will be better

public/about/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
77
<title>About Me | GSBP&#39;s Blog</title>
88
<meta name="description"
9-
content="一名大二在读学生
10-
Syclover核心成员,主力成员&amp;Nu1L成员
9+
content="一名大三在读学生
10+
Syclover队长&amp;Nu1L成员
1111
对各种安全感兴趣,目前主要学习的还的是Web安全(Java 安全、偶然也会学点云安全,等)
1212
最爱吃,最喜欢吃的是🍉,最喜欢干的事情就是大夏天抱着半个西瓜拿勺子挖着吃然后看视频
1313
什么都想学,但什么都不会
@@ -22,8 +22,8 @@
2222
<meta property="og:url" content="http://localhost:1313/about/">
2323
<meta property="og:site_name" content="GSBP&#39;s Blog">
2424
<meta property="og:title" content="About Me">
25-
<meta property="og:description" content="一名大二在读学生
26-
Syclover核心成员,主力成员&amp;Nu1L成员
25+
<meta property="og:description" content="一名大三在读学生
26+
Syclover队长&amp;Nu1L成员
2727
对各种安全感兴趣,目前主要学习的还的是Web安全(Java 安全、偶然也会学点云安全,等)
2828
最爱吃,最喜欢吃的是🍉,最喜欢干的事情就是大夏天抱着半个西瓜拿勺子挖着吃然后看视频
2929
什么都想学,但什么都不会
@@ -37,8 +37,8 @@
3737

3838
<meta name="twitter:card" content="summary">
3939
<meta name="twitter:title" content="About Me">
40-
<meta name="twitter:description" content="一名大二在读学生
41-
Syclover核心成员,主力成员&amp;Nu1L成员
40+
<meta name="twitter:description" content="一名大三在读学生
41+
Syclover队长&amp;Nu1L成员
4242
对各种安全感兴趣,目前主要学习的还的是Web安全(Java 安全、偶然也会学点云安全,等)
4343
最爱吃,最喜欢吃的是🍉,最喜欢干的事情就是大夏天抱着半个西瓜拿勺子挖着吃然后看视频
4444
什么都想学,但什么都不会
@@ -160,8 +160,8 @@ <h1>GSBP&#39;s Blog</h1>
160160
<div class="archive">
161161
<h1 class="title is-1">About Me</h1>
162162
<div class="content about-content">
163-
<p>一名大二在读学生</p>
164-
<p>Syclover核心成员,主力成员&amp;Nu1L成员</p>
163+
<p>一名大三在读学生</p>
164+
<p>Syclover队长&amp;Nu1L成员</p>
165165
<p>对各种安全感兴趣,目前主要学习的还的是Web安全(Java 安全、偶然也会学点云安全,等)</p>
166166
<p>最爱吃,最喜欢吃的是🍉,最喜欢干的事情就是大夏天抱着半个西瓜拿勺子挖着吃然后看视频</p>
167167
<p><strong>什么都想学,但什么都不会</strong></p>

public/categories/cve/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ <h2 class="archive-title">Category: CVE</h2>
145145

146146

147147

148+
<article class="archive-item">
149+
<a href="http://localhost:1313/post/2025n1ctf-wp-for-n1cateezzjs/" class="archive-item-link hover-underline-animation">[2025]N1CTF WP for n1cat,eezzjs</a>
150+
<span class="archive-item-date">
151+
November 3, 2025
152+
</span>
153+
154+
</article>
155+
156+
157+
148158
<article class="archive-item">
149159
<a href="http://localhost:1313/post/tomcatcve-2025-24813%E5%A4%8D%E7%8E%B0%E5%8F%8A%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90/" class="archive-item-link hover-underline-animation">[Tomcat]CVE-2025-24813复现及原理分析</a>
150160
<span class="archive-item-date">

public/categories/cve/index.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
<description>Recent content in CVE on GSBP&#39;s Blog</description>
77
<generator>Hugo</generator>
88
<language>en-us</language>
9-
<lastBuildDate>Wed, 12 Mar 2025 18:00:00 +0800</lastBuildDate>
9+
<lastBuildDate>Mon, 03 Nov 2025 12:00:00 +0800</lastBuildDate>
1010
<atom:link href="http://localhost:1313/categories/cve/index.xml" rel="self" type="application/rss+xml" />
11+
<item>
12+
<title>[2025]N1CTF WP for n1cat,eezzjs</title>
13+
<link>http://localhost:1313/post/2025n1ctf-wp-for-n1cateezzjs/</link>
14+
<pubDate>Mon, 03 Nov 2025 12:00:00 +0800</pubDate>
15+
<guid>http://localhost:1313/post/2025n1ctf-wp-for-n1cateezzjs/</guid>
16+
<description>&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;&#xA;&lt;p&gt;It&amp;rsquo;s my first time to create challenges after i entered Nu1L Team. I&amp;rsquo;m glad to see so many hackers could solve my challenges though they have few problems(Such as in eezzjs, flag is in &lt;code&gt;/flag&lt;/code&gt; instead of &lt;code&gt;/ffffflag&lt;/code&gt; because my new attachment did not update on competition platform in time). Here are my expected solutions for these challenges&lt;/p&gt;&#xA;&lt;h2 id=&#34;eezzjs&#34;&gt;eezzjs&lt;/h2&gt;&#xA;&lt;p&gt;In this challenges, your first work is to get a legal JWT that you could pass &lt;code&gt;authenticateJWT&lt;/code&gt; middleware and use &lt;code&gt;/upload&lt;/code&gt; to upload your file arbitrarily.&lt;/p&gt;</description>
17+
</item>
1118
<item>
1219
<title>[Tomcat]CVE-2025-24813复现及原理分析</title>
1320
<link>http://localhost:1313/post/tomcatcve-2025-24813%E5%A4%8D%E7%8E%B0%E5%8F%8A%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90/</link>

public/categories/index.html

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ <h1>Categories</h1>
156156
<a class="title is-5 is-size-6-mobile" href="http://localhost:1313/categories/wp/">WP</a>
157157

158158
<strong>
159-
<sup style="font-size:16px;">6</sup>
159+
<sup style="font-size:16px;">7</sup>
160160
</strong>
161161
</div>
162162
</div>
@@ -172,7 +172,7 @@ <h1>Categories</h1>
172172
<a class="title is-5 is-size-6-mobile" href="http://localhost:1313/categories/java%E5%AE%89%E5%85%A8/">Java安全</a>
173173

174174
<strong>
175-
<sup style="font-size:16px;">5</sup>
175+
<sup style="font-size:16px;">6</sup>
176176
</strong>
177177
</div>
178178
</div>
@@ -187,6 +187,22 @@ <h1>Categories</h1>
187187
<div>
188188
<a class="title is-5 is-size-6-mobile" href="http://localhost:1313/categories/cve/">CVE</a>
189189

190+
<strong>
191+
<sup style="font-size:16px;">2</sup>
192+
</strong>
193+
</div>
194+
</div>
195+
196+
</div>
197+
198+
<div class="card">
199+
200+
<a href="http://localhost:1313/categories/n1ctf/">
201+
</a>
202+
<div class="card-content has-text-centered">
203+
<div>
204+
<a class="title is-5 is-size-6-mobile" href="http://localhost:1313/categories/n1ctf/">N1CTF</a>
205+
190206
<strong>
191207
<sup style="font-size:16px;">1</sup>
192208
</strong>

public/categories/index.xml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,49 @@
66
<description>Recent content in Categories on GSBP&#39;s Blog</description>
77
<generator>Hugo</generator>
88
<language>en-us</language>
9-
<lastBuildDate>Mon, 25 Aug 2025 15:33:31 +0800</lastBuildDate>
9+
<lastBuildDate>Mon, 03 Nov 2025 12:00:00 +0800</lastBuildDate>
1010
<atom:link href="http://localhost:1313/categories/index.xml" rel="self" type="application/rss+xml" />
1111
<item>
12-
<title>Pytorch</title>
13-
<link>http://localhost:1313/categories/pytorch/</link>
14-
<pubDate>Mon, 25 Aug 2025 15:33:31 +0800</pubDate>
15-
<guid>http://localhost:1313/categories/pytorch/</guid>
12+
<title>CVE</title>
13+
<link>http://localhost:1313/categories/cve/</link>
14+
<pubDate>Mon, 03 Nov 2025 12:00:00 +0800</pubDate>
15+
<guid>http://localhost:1313/categories/cve/</guid>
1616
<description></description>
1717
</item>
1818
<item>
1919
<title>Java安全</title>
2020
<link>http://localhost:1313/categories/java%E5%AE%89%E5%85%A8/</link>
21-
<pubDate>Sun, 01 Jun 2025 21:00:00 +0800</pubDate>
21+
<pubDate>Mon, 03 Nov 2025 12:00:00 +0800</pubDate>
2222
<guid>http://localhost:1313/categories/java%E5%AE%89%E5%85%A8/</guid>
2323
<description></description>
2424
</item>
25+
<item>
26+
<title>N1CTF</title>
27+
<link>http://localhost:1313/categories/n1ctf/</link>
28+
<pubDate>Mon, 03 Nov 2025 12:00:00 +0800</pubDate>
29+
<guid>http://localhost:1313/categories/n1ctf/</guid>
30+
<description></description>
31+
</item>
2532
<item>
2633
<title>WP</title>
2734
<link>http://localhost:1313/categories/wp/</link>
28-
<pubDate>Sun, 01 Jun 2025 21:00:00 +0800</pubDate>
35+
<pubDate>Mon, 03 Nov 2025 12:00:00 +0800</pubDate>
2936
<guid>http://localhost:1313/categories/wp/</guid>
3037
<description></description>
3138
</item>
39+
<item>
40+
<title>Pytorch</title>
41+
<link>http://localhost:1313/categories/pytorch/</link>
42+
<pubDate>Mon, 25 Aug 2025 15:33:31 +0800</pubDate>
43+
<guid>http://localhost:1313/categories/pytorch/</guid>
44+
<description></description>
45+
</item>
3246
<item>
3347
<title>云安全</title>
3448
<link>http://localhost:1313/categories/%E4%BA%91%E5%AE%89%E5%85%A8/</link>
3549
<pubDate>Thu, 15 May 2025 16:57:31 +0800</pubDate>
3650
<guid>http://localhost:1313/categories/%E4%BA%91%E5%AE%89%E5%85%A8/</guid>
3751
<description></description>
3852
</item>
39-
<item>
40-
<title>CVE</title>
41-
<link>http://localhost:1313/categories/cve/</link>
42-
<pubDate>Wed, 12 Mar 2025 18:00:00 +0800</pubDate>
43-
<guid>http://localhost:1313/categories/cve/</guid>
44-
<description></description>
45-
</item>
4653
</channel>
4754
</rss>

public/categories/java安全/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ <h2 class="archive-title">Category: Java安全</h2>
145145

146146

147147

148+
<article class="archive-item">
149+
<a href="http://localhost:1313/post/2025n1ctf-wp-for-n1cateezzjs/" class="archive-item-link hover-underline-animation">[2025]N1CTF WP for n1cat,eezzjs</a>
150+
<span class="archive-item-date">
151+
November 3, 2025
152+
</span>
153+
154+
</article>
155+
156+
157+
148158
<article class="archive-item">
149159
<a href="http://localhost:1313/post/d3ctf2025/" class="archive-item-link hover-underline-animation">D3CTF 2025-WP</a>
150160
<span class="archive-item-date">

0 commit comments

Comments
 (0)