From 106dad98ee1d901bb5090166ad83a852d37ba504 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 07:07:59 +0000 Subject: [PATCH] test: add Compression_ZipSlip theory for dotdot and abspath zipslip attacks Agent-Logs-Url: https://github.com/Meloong-Git/MeloongCore/sessions/ad0110d7-1f92-4a62-b0b3-a3fb3418e2a5 Co-authored-by: LTCatt <40348278+LTCatt@users.noreply.github.com> --- Tests/MeloongCore.Tests.csproj | 8 ++++++++ Tests/TestFiles/FileUtils/AbsPath ZipSlip.zip | Bin 0 -> 136 bytes Tests/TestFiles/FileUtils/DotDot ZipSlip.zip | Bin 0 -> 149 bytes Tests/Utils/FileUtilsTest.cs | 7 +++++++ 4 files changed, 15 insertions(+) create mode 100644 Tests/TestFiles/FileUtils/AbsPath ZipSlip.zip create mode 100644 Tests/TestFiles/FileUtils/DotDot ZipSlip.zip diff --git a/Tests/MeloongCore.Tests.csproj b/Tests/MeloongCore.Tests.csproj index 7b45b48..c5623a8 100644 --- a/Tests/MeloongCore.Tests.csproj +++ b/Tests/MeloongCore.Tests.csproj @@ -18,6 +18,8 @@ + + @@ -50,6 +52,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + diff --git a/Tests/TestFiles/FileUtils/AbsPath ZipSlip.zip b/Tests/TestFiles/FileUtils/AbsPath ZipSlip.zip new file mode 100644 index 0000000000000000000000000000000000000000..d6439639718da75a0bd7011ded9d0d8b37d5c605 GIT binary patch literal 136 zcmWIWW@Zs#fB;1X(VbtUC4d|dW(Q*Z#6;IHPoLDX%p8T}{JfIXyb^`7%tVF6q~e0a nl8gXvMkWzv+}a_=GB7kSf>=<)0=!w-KwL&3GzHSOAPxfndO;NR literal 0 HcmV?d00001 diff --git a/Tests/TestFiles/FileUtils/DotDot ZipSlip.zip b/Tests/TestFiles/FileUtils/DotDot ZipSlip.zip new file mode 100644 index 0000000000000000000000000000000000000000..02f08b09a7ba27e939c346634e58ed7825b8fb79 GIT binary patch literal 149 zcmWIWW@Zs#fB;2?rqBQ{aUchT`G8nYPalX<%QAEHN-9b~v_f)zUP)?Ri9%UsqC!f3 o2@nN%Gct)V<2D3hI0HiiBZ!4+WPmp-8%UH92yKA0Gl;_g0M9rWMF0Q* literal 0 HcmV?d00001 diff --git a/Tests/Utils/FileUtilsTest.cs b/Tests/Utils/FileUtilsTest.cs index 64393a5..215c245 100644 --- a/Tests/Utils/FileUtilsTest.cs +++ b/Tests/Utils/FileUtilsTest.cs @@ -34,6 +34,13 @@ public class FileUtilsTest : TestWithFolder { Assert.Throws(() => FileUtils.ExtractToDirectory(GetTestFile(testFile), tempFolder)); } + [Theory] + [InlineData("DotDot ZipSlip.zip")] + [InlineData("AbsPath ZipSlip.zip")] + public void Compression_ZipSlip(string testFile) { + Assert.Throws(() => FileUtils.ExtractToDirectory(GetTestFile(testFile), tempFolder)); + } + #endregion