[interchange-cvs] [SCM] Interchange branch, master, updated. 9b6872cabea98440451efac8565f4050350116ef
Jon Jensen
interchange-cvs at icdevgroup.org
Tue Sep 8 05:46:38 UTC 2009
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange".
The branch, master has been updated
via 9b6872cabea98440451efac8565f4050350116ef (commit)
from 08a1fdeb0cf66e2499844c96ab9e826857174fe3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9b6872cabea98440451efac8565f4050350116ef
Author: Jon Jensen <jon at endpoint.com>
Date: Mon Sep 7 23:45:39 2009 -0600
Disallow abuse of writes via ErrorFile when NoAbsolute is set
Exploit reported by Peter Ajamian.
-----------------------------------------------------------------------
Summary of changes and diff:
dist/test/products/tests.asc | 23 +++++++++++++++++++++++
lib/Vend/Util.pm | 27 +++++++++++++++++----------
2 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/dist/test/products/tests.asc b/dist/test/products/tests.asc
index 9d3df92..f7973a0 100644
--- a/dist/test/products/tests.asc
+++ b/dist/test/products/tests.asc
@@ -3020,6 +3020,29 @@ Verify fix of AllowedFileRegex circumvention
%%
Verify fix of TemplateDir circumvention of NoAbsolute constraints
%%%
+000168
+%%
+[if file /tmp/ic.bad.file]
+ The bad test file /tmp/ic.bad.file already exists!
+ Please delete it before re-running this test.
+[/if]
+[calcn]
+ my $oldfile = $Config->{ErrorFile};
+ $Config->{ErrorFile} = '/tmp/ic.bad.file';
+ Log 'This is a new file that is being created and written where it should not be.';
+ $Config->{ErrorFile} = $oldfile;
+ return;
+[/calcn]
+[if file /tmp/ic.bad.file]bad[else]good[/else][/if]ness
+%%
+goodness
+%%
+already exists
+%%
+
+%%
+Verify fix of ErrorFile circumvention of NoAbsolute constraints
+%%%
999999
%%
[the test] [perl]
diff --git a/lib/Vend/Util.pm b/lib/Vend/Util.pm
index 8356b84..f3bee42 100644
--- a/lib/Vend/Util.pm
+++ b/lib/Vend/Util.pm
@@ -1840,22 +1840,29 @@ sub logError {
$Vend::Errors .= $msg
if $Vend::Cfg->{DisplayErrors} || $Global::DisplayErrors;
- eval {
- open(MVERROR, ">> $opt->{file}")
- or die "open\n";
- lockfile(\*MVERROR, 1, 1) or die "lock\n";
- seek(MVERROR, 0, 2) or die "seek\n";
- print(MVERROR $msg, "\n") or die "write to\n";
- unlockfile(\*MVERROR) or die "unlock\n";
- close(MVERROR) or die "close\n";
- };
+ my $reason;
+ if (! allowed_file($opt->{file}, 1)) {
+ $@ = 'access';
+ $reason = 'prohibited by global configuration';
+ }
+ else {
+ eval {
+ open(MVERROR, ">> $opt->{file}")
+ or die "open\n";
+ lockfile(\*MVERROR, 1, 1) or die "lock\n";
+ seek(MVERROR, 0, 2) or die "seek\n";
+ print(MVERROR $msg, "\n") or die "write to\n";
+ unlockfile(\*MVERROR) or die "unlock\n";
+ close(MVERROR) or die "close\n";
+ };
+ }
if ($@) {
chomp $@;
logGlobal ({ level => 'info' },
"Could not %s error file %s: %s\nto report this error: %s",
$@,
$opt->{file},
- $!,
+ $reason || $!,
$msg,
);
}
hooks/post-receive
--
Interchange
More information about the interchange-cvs
mailing list