cryne797 has quit [Read error: Connection reset by peer]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Read error: Connection reset by peer]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Read error: Connection reset by peer]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Read error: Connection reset by peer]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
<sdomi>
question / challenge: given an associative array (`declare -A`), can passing untrusted data as a key be exploited?
<sdomi>
I know it's almost always an RCE if you use regular arrays, and I wasn't able to do anything bad to associative arrays last time i tried
<sdomi>
but I wonder if I missed anything
<sdomi>
cc: Maja ^
<sdomi>
okay i found something horrifying. setup: `declare -A meow; meow[asdf]=1; x=asdf`
<sdomi>
`echo $'$x'` obviously outputs `$x`
<sdomi>
`echo "${meow[$'$x']}" outputs 1
<sdomi>
but only for cstrings. and only in array keys
dermoth has quit [Ping timeout: 276 seconds]
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Read error: Connection reset by peer]
cryne797 has joined ##bash-crimes
<izabera>
why is that not the same as ${meow['$x']} ?
<izabera>
i don't get it at all
cryne797 has quit [Read error: Connection reset by peer]
mei[m] has joined ##bash-crimes
<mei[m]>
do c-strings work as associative array keys in the first place?
cryne797 has joined ##bash-crimes
cryne797 has quit [Client Quit]
cryne797 has joined ##bash-crimes
cryne797 has quit [Read error: Connection reset by peer]
cryne797 has joined ##bash-crimes
cryne797 has quit [Read error: Connection reset by peer]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
<JAA>
Yeah, I can't reproduce that either. And yes, $'$x' should be the same as '$x'.
<JAA>
There are a bunch of quirks around arithmetic context and quoting keys, and I don't recall whether there's any non-awful safe method that works correctly across versions.
<JAA>
Cf. pitfall 62
<JAA>
Also `unset` and `[[ -v ... ]]`
<JAA>
I haven't yet seen brokenness outside of those three contexts, but I wouldn't bet on there not being any either.
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
cryne797 has quit [Quit: Bye!]
cryne797 has joined ##bash-crimes
dermoth has joined ##bash-crimes
<izabera>
i can reproduce
<izabera>
i just don't understand it
<JAA>
Oh
<JAA>
It only happens when it's quoted.
<JAA>
I was testing with `echo ${meow[$'$x']}` rather than `echo "${meow[$'$x']}"`.