~ubuntu-branches/ubuntu/hardy/mailman/hardy-updates

« back to all changes in this revision

Viewing changes to debian/patches/security-error_log.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-09-12 21:29:14 UTC
  • Revision ID: james.westby@ubuntu.com-20060912212914-ok3c35nf4izdz9f4
Tags: 1:2.1.8-2ubuntu2
* SECURITY UPDATE: XSS.
* Add debian/patches/security-CVE-2006-3636-XSS.dpatch:
  - Fix various cross-site scripting vulnerabilities.
  - Patch backported from svn head, thanks to Barry Warsaw for preparing it.
  - CVE-2006-3636
* Add debian/patches/security-CVE-2006-2941.dpatch:
  - Scrubber.py: Do not bail out if emails' get_filename() throws a
    ValueError. This has been properly fixed in the next upstream email
    package (in Python core), but the fix is very intrusive. Thanks to Steve
    Alexander for discovering this and for the proposed patch.
  - CVE-2006-2941
  - Closes: LP#49620
* Add debian/patches/security-error_log.dpatch:
  - Check characters in URL to prevent injecting bogus messages into
    error_log.
  - Patch taken from upstream SVN:
    http://svn.sourceforge.net/viewvc/mailman?view=rev&revision=7918

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## security-error_log.dpatch by  <martin.pitt@ubuntu.com>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: No description.
 
6
 
 
7
@DPATCH@
 
8
diff -urNad mailman-2.1.8~/Mailman/Handlers/Decorate.py mailman-2.1.8/Mailman/Handlers/Decorate.py
 
9
--- mailman-2.1.8~/Mailman/Handlers/Decorate.py 2006-09-12 21:27:45.000000000 +0200
 
10
+++ mailman-2.1.8/Mailman/Handlers/Decorate.py  2006-09-12 21:28:44.000000000 +0200
 
11
@@ -95,8 +95,8 @@
 
12
         # TK: Try to keep the message plain by converting the header/
 
13
         # footer/oldpayload into unicode and encode with mcset/lcset.
 
14
         # Try to decode qp/base64 also.
 
15
-        uheader = unicode(header, lcset)
 
16
-        ufooter = unicode(footer, lcset)
 
17
+        uheader = unicode(header, lcset, 'ignore')
 
18
+        ufooter = unicode(footer, lcset, 'ignore')
 
19
         try:
 
20
             oldpayload = unicode(msg.get_payload(decode=True), mcset)
 
21
             frontsep = endsep = u''
 
22
diff -urNad mailman-2.1.8~/Mailman/Utils.py mailman-2.1.8/Mailman/Utils.py
 
23
--- mailman-2.1.8~/Mailman/Utils.py     2006-03-18 18:23:04.000000000 +0100
 
24
+++ mailman-2.1.8/Mailman/Utils.py      2006-09-12 21:28:29.000000000 +0200
 
25
@@ -53,6 +53,7 @@
 
26
 from Mailman import Errors
 
27
 from Mailman import Site
 
28
 from Mailman.SafeDict import SafeDict
 
29
+from Mailman.Logging.Syslog import syslog
 
30
 
 
31
 try:
 
32
     True, False
 
33
@@ -219,9 +220,16 @@
 
34
 
 
35
 
 
36
 
 
37
+# Patterns which may be used to form malicious path to inject a new
 
38
+# line in the mailman error log. (TK: advisory by Moritz Naumann)
 
39
+CRNLpat = re.compile(r'[^\x21-\x7e]')
 
40
+
 
41
 def GetPathPieces(envar='PATH_INFO'):
 
42
     path = os.environ.get(envar)
 
43
     if path:
 
44
+        if CRNLpat.search(path):
 
45
+            path = CRNLpat.split(path)[0]
 
46
+            syslog('error', 'Warning: Possible malformed path attack.')
 
47
         return [p for p in path.split('/') if p]
 
48
     return None
 
49
 
 
50
@@ -326,7 +334,6 @@
 
51
                         # We have no available source of cryptographically
 
52
                         # secure random characters.  Log an error and fallback
 
53
                         # to the user friendly passwords.
 
54
-                        from Mailman.Logging.Syslog import syslog
 
55
                         syslog('error',
 
56
                                'urandom not available, passwords not secure')
 
57
                         return UserFriendly_MakeRandomPassword(length)
 
58
@@ -541,7 +548,6 @@
 
59
                 text = sdict.interpolate(utemplate)
 
60
         except (TypeError, ValueError), e:
 
61
             # The template is really screwed up
 
62
-            from Mailman.Logging.Syslog import syslog
 
63
             syslog('error', 'broken template: %s\n%s', filename, e)
 
64
             pass
 
65
     if raw: