The video below demonstrates how an attacker using the CVE-2016-1247 vulnerability in Nginx packaging on Debian-based and Gentoo systems (such as Debian, Ubuntu, Gentoo etc.), could escalate their privileges to root user upon gaining access to the system as www-data user.
In the presented scenario, the attacker gains the local access to www-data shell by exploiting a pre-existing webapp vulnerability (File Upload) to upload a reverse shell and then proceeds to privilege escalation.