|
| From: | Chet Ramey |
| Subject: | Re: Why is *splitting every word* is a shell security hole? |
| Date: | Wed, 21 Aug 2024 11:14:36 -0400 |
| User-agent: | Mozilla Thunderbird |
On 8/19/24 7:41 AM, shynur . wrote:
Hi, friends, I'm reading the paper by Chet Ramey. Here: <https://tiswww.case.edu/php/chet/bash/rose94.pdf>. In section 4.2.5:Bash and ksh split only the results of expansion, rather than every word as sh does, closing a long-standing shell security hole.Why is *splitting every word* is a shell security hole?
Consider setting IFS to something that's not the default and using it to
split words (not expansions) that a user might reasonably expect to remain
unchanged.
Then you write a shell function or script (or other executable) whose name
is something like
`ec'
setting IFS="${IFS}h"
and you get to run it the next time the user uses `echo'.
This is obviously contrived, but the principle should be obvious.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
| [Prev in Thread] | Current Thread | [Next in Thread] |