Merge ~federicoquattrin/qa-regression-testing:add_libspreadsheet-parseexcel-perl_tests into qa-regression-testing:master

Proposed by Federico Quattrin
Status: Needs review
Proposed branch: ~federicoquattrin/qa-regression-testing:add_libspreadsheet-parseexcel-perl_tests
Merge into: qa-regression-testing:master
Diff against target: 110 lines (+89/-0)
2 files modified
scripts/spreadsheet-parseexcel/exploit.pl (+6/-0)
scripts/test-libspreadsheet-parseexcel-perl.py (+83/-0)
Reviewer Review Type Date Requested Status
Ubuntu Security Team Pending
Review via email: mp+466194@code.launchpad.net

Commit message

added tests for libspreadsheet-parseexcel-perl

Description of the change

added tests for libspreadsheet-parseexcel-perl

To post a comment you must log in.
bf54b5f... by Federico Quattrin

added additional files for libspreadsheet-parseexcel-perl

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Where did the binary files come from, and how are they licensed?

Unmerged commits

bf54b5f... by Federico Quattrin

added additional files for libspreadsheet-parseexcel-perl

Failed
[SUCCEEDED] imagemagick:0 (build)
[SUCCEEDED] imagemagick:1 (build)
[SUCCEEDED] imagemagick:2 (build)
[SUCCEEDED] gcc-security:0 (build)
[SUCCEEDED] gcc-security:1 (build)
[SUCCEEDED] gcc-security:2 (build)
[SUCCEEDED] glibc:0 (build)
[SUCCEEDED] glibc:1 (build)
[SUCCEEDED] glibc:2 (build)
[SUCCEEDED] glibc-security:0 (build)
[SUCCEEDED] glibc-security:1 (build)
[SUCCEEDED] glibc-security:2 (build)
[SUCCEEDED] gnupg:0 (build)
[SUCCEEDED] gnupg:1 (build)
[SUCCEEDED] gnupg:2 (build)
[SUCCEEDED] sudo:0 (build)
[SUCCEEDED] sudo:1 (build)
[SUCCEEDED] sudo:2 (build)
[SUCCEEDED] git:0 (build)
[SUCCEEDED] git:1 (build)
[SUCCEEDED] git:2 (build)
[SUCCEEDED] ghostscript:0 (build)
[SUCCEEDED] ghostscript:1 (build)
[SUCCEEDED] ghostscript:2 (build)
[SUCCEEDED] busybox:0 (build)
[SUCCEEDED] busybox:1 (build)
[SUCCEEDED] busybox:2 (build)
[SUCCEEDED] coreutils:0 (build)
[SUCCEEDED] coreutils:1 (build)
[SUCCEEDED] coreutils:2 (build)
[SUCCEEDED] util-linux:0 (build)
[SUCCEEDED] util-linux:1 (build)
[SUCCEEDED] util-linux:2 (build)
[SUCCEEDED] ecdsautils:0 (build)
[SUCCEEDED] ecdsautils:1 (build)
[SUCCEEDED] ecdsautils:2 (build)
[SUCCEEDED] python-urllib3:0 (build)
[SUCCEEDED] python-urllib3:1 (build)
[SUCCEEDED] python-urllib3:2 (build)
[SUCCEEDED] amanda:0 (build)
[SUCCEEDED] amanda:1 (build)
[FAILED] cryptojs:0 (build)
[FAILED] cryptojs:1 (build)
[FAILED] cryptojs:2 (build)
[FAILED] cryptojs:3 (build)
145 of 45 results
5450203... by Federico Quattrin

added tests for libspreadsheet-parseexcel-perl

Failed
[SUCCEEDED] imagemagick:0 (build)
[SUCCEEDED] imagemagick:1 (build)
[SUCCEEDED] imagemagick:2 (build)
[SUCCEEDED] gcc-security:0 (build)
[SUCCEEDED] gcc-security:1 (build)
[SUCCEEDED] gcc-security:2 (build)
[SUCCEEDED] glibc:0 (build)
[SUCCEEDED] glibc:1 (build)
[SUCCEEDED] glibc:2 (build)
[SUCCEEDED] glibc-security:0 (build)
[SUCCEEDED] glibc-security:1 (build)
[SUCCEEDED] glibc-security:2 (build)
[SUCCEEDED] gnupg:0 (build)
[SUCCEEDED] gnupg:1 (build)
[SUCCEEDED] gnupg:2 (build)
[SUCCEEDED] sudo:0 (build)
[SUCCEEDED] sudo:1 (build)
[SUCCEEDED] sudo:2 (build)
[SUCCEEDED] git:0 (build)
[SUCCEEDED] git:1 (build)
[SUCCEEDED] git:2 (build)
[SUCCEEDED] ghostscript:0 (build)
[SUCCEEDED] ghostscript:1 (build)
[SUCCEEDED] ghostscript:2 (build)
[SUCCEEDED] busybox:0 (build)
[SUCCEEDED] busybox:1 (build)
[SUCCEEDED] busybox:2 (build)
[SUCCEEDED] coreutils:0 (build)
[SUCCEEDED] coreutils:1 (build)
[SUCCEEDED] coreutils:2 (build)
[SUCCEEDED] util-linux:0 (build)
[SUCCEEDED] util-linux:1 (build)
[SUCCEEDED] util-linux:2 (build)
[SUCCEEDED] ecdsautils:0 (build)
[SUCCEEDED] ecdsautils:1 (build)
[SUCCEEDED] ecdsautils:2 (build)
[SUCCEEDED] python-urllib3:0 (build)
[SUCCEEDED] python-urllib3:1 (build)
[SUCCEEDED] python-urllib3:2 (build)
[SUCCEEDED] amanda:0 (build)
[SUCCEEDED] amanda:1 (build)
[FAILED] cryptojs:0 (build)
[FAILED] cryptojs:1 (build)
[FAILED] cryptojs:2 (build)
[FAILED] cryptojs:3 (build)
145 of 45 results

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/scripts/spreadsheet-parseexcel/exploit.pl b/scripts/spreadsheet-parseexcel/exploit.pl
0new file mode 1006440new file mode 100644
index 0000000..b9ef0de
--- /dev/null
+++ b/scripts/spreadsheet-parseexcel/exploit.pl
@@ -0,0 +1,6 @@
1use strict;
2use Spreadsheet::ParseExcel;
3
4my $parser = Spreadsheet::ParseExcel->new();
5# file.xls is malicious file from end user
6my $workbook = $parser->parse("test.xls");
0\ No newline at end of file7\ No newline at end of file
diff --git a/scripts/spreadsheet-parseexcel/test.xls b/scripts/spreadsheet-parseexcel/test.xls
1new file mode 1006448new file mode 100644
index 0000000..6e89acc
2Binary files /dev/null and b/scripts/spreadsheet-parseexcel/test.xls differ9Binary files /dev/null and b/scripts/spreadsheet-parseexcel/test.xls differ
diff --git a/scripts/spreadsheet-parseexcel/test.xlsx b/scripts/spreadsheet-parseexcel/test.xlsx
3new file mode 10064410new file mode 100644
index 0000000..c9190fc
4Binary files /dev/null and b/scripts/spreadsheet-parseexcel/test.xlsx differ11Binary files /dev/null and b/scripts/spreadsheet-parseexcel/test.xlsx differ
diff --git a/scripts/test-libspreadsheet-parseexcel-perl.py b/scripts/test-libspreadsheet-parseexcel-perl.py
5new file mode 10075512new file mode 100755
index 0000000..0a8c03d
--- /dev/null
+++ b/scripts/test-libspreadsheet-parseexcel-perl.py
@@ -0,0 +1,83 @@
1#!/usr/bin/python3
2#
3# test-spreadsheet-parseexcel.py quality assurance test script for PKG
4# Copyright (C) 2012 Canonical Ltd.
5# Author:
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 3,
9# as published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
19
20# QRT-Packages: libspreadsheet-parseexcel-perl
21# QRT-Depends: spreadsheet-parseexcel
22
23'''
24 In general, this test should be run in a virtual machine (VM) or possibly
25 a chroot and not on a production machine. While efforts are made to make
26 these tests non-destructive, there is no guarantee this script will not
27 alter the machine. You have been warned.
28
29 How to run in a clean VM:
30 $ ./make-test-tarball test-spreadsheet-parseexcel.py # creates tarball in /tmp/
31 $ scp /tmp/qrt-test-spreadsheet-parseexcel.tar.gz root@vm.host:/tmp
32 on VM:
33 # cd /tmp ; tar zxvf ./qrt-test-spreadsheet-parseexcel.tar.gz
34 # cd /tmp/qrt-test-spreadsheet-parseexcel ; ./install-packages ./test-spreadsheet-parseexcel.py
35 # ./test-spreadsheet-parseexcel.py -v
36
37 To run in all VMs named sec*:
38 $ vm-qrt -p sec test-<script.py>
39
40 ### TODO: update for ./install-packages step ###
41 How to run in a clean schroot named 'lucid':
42 $ schroot -c lucid -u root -- sh -c 'apt-get -y install lsb-release <QRT-Packages> && ./test-PKG.py -v'
43'''
44
45from __future__ import print_function
46
47import os
48import subprocess
49import sys
50import unittest
51import testlib
52
53
54class SpreadsheetParseExcelTest(testlib.TestlibCase):
55 '''Test the perl library Spreadsheet::ParseExcel.'''
56
57 def tearDown(self):
58 '''Clean up after each test_* function'''
59 if os.path.exists("/tmp/inject.txt"):
60 os.remove("/tmp/inject.txt")
61
62 def test_cve_2023_7101(self):
63 '''Test CVE-2023-7101'''
64 os.chdir("{}/spreadsheet-parseexcel".format(os.path.dirname(os.path.realpath(__file__))))
65 self.exploit()
66 injected_exists = os.path.exists("/tmp/inject.txt")
67 if injected_exists:
68 with open("/tmp/inject.txt", "r") as injected_file:
69 file_content = injected_file.read()
70 print("Injected file exists and it's content is {}".format(file_content))
71 self.assertFalse(injected_exists)
72
73 def exploit(self):
74 if self.lsb_release.get("Release") == 14.04:
75 subprocess.call(["perl", "exploit.pl"])
76 else:
77 subprocess.run(["perl", "exploit.pl"])
78
79
80
81
82if __name__ == '__main__':
83 unittest.main()

Subscribers

People subscribed via source and target branches