From ac1be895d2501dc79dcff2c1e03549fe5b5a930c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 20 Nov 2019 11:40:51 +1300 Subject: [PATCH] selftest: Confirm that NDR bugs are fixed in DCOM code Test input provided by Michael Hanselmann and found using Hongfuzz. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13875 Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- python/samba/tests/blackbox/ndrdump.py | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/python/samba/tests/blackbox/ndrdump.py b/python/samba/tests/blackbox/ndrdump.py index a9e6b5b54a21..2736c9c751a4 100644 --- a/python/samba/tests/blackbox/ndrdump.py +++ b/python/samba/tests/blackbox/ndrdump.py @@ -139,3 +139,62 @@ def test_ndrdump_fuzzed_clusapi_QueryAllValues(self): except BlackboxProcessError as e: self.fail(e) self.assertEqual(actual, expected) + + def test_ndrdump_fuzzed_IOXIDResolver_ResolveOxid(self): + expected = '''pull returned Character Conversion Error +''' + try: + actual = self.check_exit_code( + 'ndrdump IOXIDResolver ResolveOxid out ' +\ + '--base64-input --input=' +\ + 'c87PMf7CBAUAAAAADgQMBASjfPqKw0KPld6DY87PMfQ=', + 2) + except BlackboxProcessError as e: + self.fail(e) + self.assertRegex(actual.decode('utf8'), expected + "$") + + def test_ndrdump_fuzzed_IOXIDResolver_ResolveOxid2(self): + expected = '''pull returned Buffer Size Error +''' + try: + actual = self.check_exit_code( + 'ndrdump IOXIDResolver ResolveOxid2 out ' +\ + '--base64-input --input=' +\ + 'AAAAAQ0K9Q0AAAAAAAAAA6ampqampqampqampqampqampqampqamNAAAAAAtNDQ=', + 2) + except BlackboxProcessError as e: + self.fail(e) + self.assertRegex(actual.decode('utf8'), expected + "$") + + def test_ndrdump_fuzzed_IOXIDResolver_ServerAlive2(self): + expected = b'''pull returned Success +WARNING! 46 unread bytes +[0000] 0D 36 0A 0A 0A 0A 0A 00 00 00 00 00 00 00 03 00 .6...... ........ +[0010] 00 00 01 00 00 33 39 36 31 36 31 37 37 36 38 34 .....396 16177684 +[0020] 32 34 FC 85 AC 49 0B 61 87 0A 0A 0A F5 00 24...I.a ...... + ServerAlive: struct ServerAlive + out: struct ServerAlive + result : DOS code 0x01000000 +dump OK +''' + try: + actual = self.check_output( + 'ndrdump IOXIDResolver ServerAlive out ' +\ + '--base64-input --input=' +\ + 'AAAAAQ02CgoKCgoAAAAAAAAAAwAAAAEAADM5NjE2MTc3Njg0MjT8haxJC2GHCgoK9QA=') + except BlackboxProcessError as e: + self.fail(e) + self.assertEqual(actual, expected) + + def test_ndrdump_fuzzed_IRemoteActivation_RemoteActivation(self): + expected = '''pull returned Buffer Size Error +''' + try: + actual = self.check_exit_code( + 'ndrdump IRemoteActivation RemoteActivation out ' +\ + '--base64-input --input=' +\ + 'AAAAAQAAAAAAAABKAAD/AAAAAP4AAAAAAAAASgAAAAAAAAABIiIjIiIiIiIiIiIiIiMiAAAAAAD/AAAAAAAA', + 2) + except BlackboxProcessError as e: + self.fail(e) + self.assertRegex(actual.decode('utf8'), expected + "$")