Bug 268381 (CVE-2007-4631)

Summary: CVE-2007-4631 QGit insecure temporary file usage
Product: [Fedora] Fedora Reporter: Lubomir Kundrak <lkundrak>
Component: qgitAssignee: Dan HorĂ¡k <dan>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 7Keywords: Security
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
URL: http://bugs.gentoo.org/show_bug.cgi?id=190697
Whiteboard: source=gentoo,reported=20070729,impact=important
Fixed In Version: 1.5.7-1.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-10 16:54:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lubomir Kundrak 2007-08-30 18:43:46 UTC
Description of problem:

Raphael Marichez of Gentoo reported an insecure temporary file usage flaw in
QGit. (see URL for original report)

The following code in dataloader.cpp is problematic:

220 bool DataLoader::doStart(SCList args, SCRef wd) {
221 
222         // ensure unique names for our DataLoader instance file
223         dataFileName = "/qgit_" + QString::number((ulong)this) + ".txt";
224         scriptFileName = "/qgit_" + QString::number((ulong)this) + ".sh";
225 
226         // create a script to redirect 'git rev-list' stdout to dataFile
227         QDir dir("/tmp"); // use a tmpfs mounted filesystem if available
228         bool foundTmpDir = (dir.exists() && dir.isReadable());
229         scriptFileName.prepend(foundTmpDir ? "/tmp" : wd);
230         dataFileName.prepend(foundTmpDir ? "/tmp" : wd);

Not only does QGit construct a predictable file name here, and doesn't check if
the files already exist, which can be leveraged into information leak or
arbitrary file overwrite in case they're symlinks, but later on executes one of
them. This is not just problem when /tmp is mounted with noexec option, but
might be exploited into arbitrary code execution under time-dependent race
condition.

With this said, please update as possible.

Additional information:

There's no CVE identifier for this issue. I will request one soon.

Version-Release number of selected component (if applicable):

qgit-1.5.6-1.fc7

Comment 1 Lubomir Kundrak 2007-09-03 16:31:08 UTC
Mitre assigne CVE-2007-4631 to this issue.

Comment 2 Fedora Update System 2007-09-10 16:54:48 UTC
qgit-1.5.7-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.