AD custom attribute of type numerical string crashes MMC when updated

Solution 1:

This crash occurs when trying to edit attributes of type "Numeric String" that are not "multi valued" with ADSI edit. Application verifier enabled for mmc.exe we can see a stack trace of this type of crash, it seems to crash on trying to delete an array of values:

0:005> k
 # Child-SP          RetAddr               Call Site
00 00000000`0c7ee660 00000000`76cdc4ca     vfbasics!AVrfpRtlFreeHeap+0x62
01 00000000`0c7ee730 000007fe`fd6e10c0     kernel32!HeapFree+0xa
02 00000000`0c7ee760 000007fe`f3554ef0     msvcrt!free+0x1c
03 00000000`0c7ee790 000007fe`ec973d77     vfbasics!AVrfp_deletearray+0x30
04 00000000`0c7ee7c0 000007fe`ec9743e6     adsiedit!DeleteADsValues+0x97
05 00000000`0c7ee7f0 000007fe`ec97c145     adsiedit!CSingleStringEditor::GetNewValue+0x1b6
06 00000000`0c7ee840 000007fe`ec97bf10     adsiedit!CAttributeEditorPropertyPage::EditAttribute+0x149
07 00000000`0c7ee900 000007fe`f334abdb     adsiedit!CAttributeEditorPropertyPage::OnNotifyEditAttribute+0x54
08 00000000`0c7ee930 000007fe`f334ae0b     mfc42u!_AfxDispatchCmdMsg+0x83
09 00000000`0c7ee960 000007fe`f334198e     mfc42u!CCmdTarget::OnCmdMsg+0x17b
0a 00000000`0c7ee9b0 000007fe`f332160d     mfc42u!CPropertySheet::OnCmdMsg+0x32
0b 00000000`0c7ee9f0 000007fe`f3340fc2     mfc42u!CWnd::OnNotify+0xa5
0c 00000000`0c7eea50 000007fe`ec97eb78     mfc42u!CPropertyPage::OnNotify+0x22
0d 00000000`0c7eea80 000007fe`f3320ab8     adsiedit!CAttributeEditorPropertyPage::OnNotify+0x54
0e 00000000`0c7eeab0 000007fe`f33209f8     mfc42u!CWnd::OnWndMsg+0x8c
0f 00000000`0c7eebb0 000007fe`f331ef25     mfc42u!CWnd::WindowProc+0x38
10 00000000`0c7eebf0 000007fe`f331f329     mfc42u!AfxCallWndProc+0xe1
11 00000000`0c7eec90 000007fe`ec987a95     mfc42u!AfxWndProc+0x59
12 00000000`0c7eecd0 00000000`76bfd53e     adsiedit!AfxWndProcDllStatic+0x49
13 00000000`0c7eed20 00000000`76bfc62b     user32!UserCallWinProcCheckWow+0x1ad
14 00000000`0c7eede0 00000000`76bfc71d     user32!DispatchClientMessage+0xc3
15 00000000`0c7eee40 00000000`76e26c26     user32!_fnDWORD+0x2d
16 00000000`0c7eeea0 00000000`76bfb20a     ntdll!KiUserCallbackDispatcherContinue
17 00000000`0c7eef28 00000000`76bf7abb     user32!ZwUserMessageCall+0xa
18 00000000`0c7eef30 00000000`76bfb649     user32!SendMessageWorker+0x73f
19 00000000`0c7eefc0 000007fe`fb4247f7     user32!SendMessageW+0x5b
1a 00000000`0c7ef010 000007fe`fb518b89     comctl32_7fefb3f0000!CCSendNotify+0xf93
1b 00000000`0c7ef130 000007fe`fb47d681     comctl32_7fefb3f0000!CLVMouseManager::HandleMouse+0x7bd
1c 00000000`0c7ef280 000007fe`fb47cc68     comctl32_7fefb3f0000!CListView::WndProc+0x9cd
1d 00000000`0c7ef480 00000000`76bfd53e     comctl32_7fefb3f0000!CListView::s_WndProc+0x6c4
1e 00000000`0c7ef4e0 00000000`76bfd7c6     user32!UserCallWinProcCheckWow+0x1ad
1f 00000000`0c7ef5a0 00000000`76bfd174     user32!DispatchMessageWorker+0x389
20 00000000`0c7ef620 000007fe`fb439d0d     user32!IsDialogMessageW+0x14f
21 00000000`0c7ef6b0 000007fe`fb43c063     comctl32_7fefb3f0000!Prop_IsDialogMessage+0x1f1
22 00000000`0c7ef720 000007fe`fb43c43d     comctl32_7fefb3f0000!_RealPropertySheet+0x31b
23 00000000`0c7ef7f0 000007fe`f0fa2c58     comctl32_7fefb3f0000!_PropertySheet+0x55
24 00000000`0c7ef830 000007fe`f0fa2e30     mmcndmgr!MmcIsolationAwarePropertySheet+0x68
25 00000000`0c7ef860 000007fe`f0fa2bc7     mmcndmgr!PropertySheetProc+0x1a0
26 00000000`0c7ef8f0 000007fe`fd6e3ea7     mmcndmgr!PropertySheetThreadProc+0x9f
27 00000000`0c7ef920 000007fe`fd6e6635     msvcrt!endthreadex+0x47
28 00000000`0c7ef950 00000000`76ccbe3d     msvcrt!endthreadex+0x100
29 00000000`0c7ef980 00000000`76e06a51     kernel32!BaseThreadInitThunk+0xd
2a 00000000`0c7ef9b0 00000000`00000000     ntdll!RtlUserThreadStart+0x1d

Potential solutions/workarounds include

  1. Use ADSI Edit from Windows Server 2019 / Windows 10 with Remote Server Administration Tools, which does not have this issue.
  2. Create the attribute as type other than numeric string
  3. Create the attribute as numeric string "multi-valued"
  4. Don't use ADSI Edit to edit the value, i.e. AD Explorer works fine although on 2008 you will have to use an old version i.e. https://web.archive.org/web/20110601/https://download.sysinternals.com/files/AdExplorer.zip