﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37514	UserAdmin allows adding users without change permission through _saveasnew	Sarah Boyce		"`UserAdmin` requires both add and change permissions to create users. See https://github.com/django/django/blob/9e2e5a31e2ef2e8673d3c2a38d2a391dbf42cf23/django/contrib/auth/admin.py#L122-L129

However, the additional change permission check can be bypassed by posting to a user’s change URL with `_saveasnew`.
The POST is processed even with the default `save_as=False`.

Here is a test to show the behavior:

{{{#!diff
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -1507,6 +1507,28 @@ class ChangelistTests(MessagesTestMixin, AuthViewsTestCase):
             )
         self.assertEqual(response.status_code, 400)
 
+    def test_save_as_new_requires_change_permission(self):
+        user = User.objects.create_user(username=""add_only"", is_staff=True)
+        add_permission = Permission.objects.get(codename=""add_user"")
+        user.user_permissions.add(add_permission)
+        self.client.force_login(user)
+
+        data = {
+            ""username"": ""new_user"",
+            ""usable_password"": ""true"",
+            ""password1"": ""a-long-test-password-123"",
+            ""password2"": ""a-long-test-password-123"",
+            ""_saveasnew"": ""Save as new"",
+        }
+        for url in [
+            reverse(""admin:auth_user_add""),
+            reverse(""admin:auth_user_change"", args=[user.pk])
+        ]:
+            with self.subTest(url=url):
+                response = self.client.post(url, data)
+                self.assertEqual(response.status_code, 403)
+                self.assertFalse(User.objects.filter(username=""new_user"").exists())
+
     def test_user_change_email(self):
         data = self.get_user_data(self.admin)
}}}

This was reviewed by the Django Security Team and is being handled as a permissions consistency bug rather than a security issue. With the default UserAdmin, this path still uses the restricted user creation form: submitted privilege fields such as is_superuser are ignored, and the created account is an ordinary user."	Bug	new	contrib.auth	6.1	Normal		not-security		Unreviewed	0	0	0	0	0	0
