Privilege Escalation: Writing a User to /etc/passwd

Sometimes an application will be misconfigured and will have the capability to read/write to the /etc/passwd file. This code below creates a hashed password and demonstrates how to echo that into the /etc/passwd file.

Further Reading

https://www.cyberciti.biz/faq/understanding-etcpasswd-file-format/