authorMatthieu Herrb <>2011-10-17 20:27:35 (GMT)
committer Matthieu Herrb <>2011-10-18 13:58:00 (GMT)
commitb67581cf825940fdf52bf2e0af4330e695d724a4 (patch) (side-by-side diff)
parent6ba44b91e37622ef8c146d8f2ac92d708a18ed34 (diff)
Fix CVE-2011-4029: File permission change vulnerability.
Use fchmod() to change permissions of the lock file instead of chmod(), thus avoid the race that can be exploited to set a symbolic link to any file or directory in the system. Signed-off-by: Matthieu Herrb <> Reviewed-by: Alan Coopersmith <>
Diffstat (more/less context) (ignore whitespace changes)
1 files changed, 1 insertions, 1 deletions
diff --git a/os/utils.c b/os/utils.c
index fe49254..07cf4c2 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -297,7 +297,7 @@ LockServer(void)
FatalError("Could not create lock file in %s\n", tmp);
(void) sprintf(pid_str, "%10ld\n", (long)getpid());
(void) write(lfd, pid_str, 11);
- (void) chmod(tmp, 0444);
+ (void) fchmod(lfd, 0444);
(void) close(lfd);