Stupefy most likely works by incapacitating major nerve endings of one's body, thereby preventing any muscle from movement. However, it is unlikely that it affects the brain in any way, as in order to not cause any permanent harm and for the body to keep functioning normally, it is essential for the brain to still be working properly.