SkyLined / BugId

Detect, analyze and uniquely identify crashes in Windows applications
https://bugid.skylined.nl
Other
499 stars 90 forks source link

BugID.cmd throws error with 'mWindowsMacros' on the latest release #99

Closed sanjeevk001 closed 2 years ago

sanjeevk001 commented 3 years ago

Hi,

I'm getting error with "mWindowsMacros". Any suggestions on how to resolve it. Environment: Win 10, python 2.7.15.

.\BugId.cmd %WinDir%\system32\rundll32.exe -- advapi32 CloseThreadWaitChainSession

Traceback (most recent call last):
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\BugId.py", line 28, in <module>
    fInitializeProduct();
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\fInitializeProduct.py", line 99, in fInitializeProduct
    cDependencyChecker(sMainProductFolderPath).fCheck();
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\fInitializeProduct.py", line 81, in fCheck
    oProductModule = foLoadModule(sDepentOnProductName, oSelf.oMainProductDetails, sProductName);
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\fInitializeProduct.py", line 24, in foLoadModule
    oProductModule = __import__(sProductName, globals(), locals(), [], -1);
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\cBugId\__init__.py", line 1, in <module>
    from .cBugId import cBugId;
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\cBugId\cBugId.py", line 21, in <module>
    from mWindowsAPI import oSystemInfo;
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\mWindowsAPI\__init__.py", line 1, in <module>
    from .mWindowsAPI import *;
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\mWindowsAPI\mWindowsAPI.py", line 1, in <module>
    from .cConsoleProcess import cConsoleProcess;
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\mWindowsAPI\cConsoleProcess.py", line 1, in <module>
    from mWindowsSDK import *;
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\mWindowsSDK\__init__.py", line 1, in <module>
    from .mWindowsSDK import *;
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\mWindowsSDK\mWindowsSDK.py", line 146, in <module>
    mModule = __import__(sModuleName, globals(), {}, None, -1);
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\mWindowsSDK\mWindowsMacros\__init__.py", line 2, in <module>       
    from .mWindowsMacros import *;
  File "C:\Users\work\Documents\BugId.release.2021-04-15.11.40\modules\mWindowsSDK\mWindowsMacros\mWindowsMacros.py", line 14, in <module>
    globals()[sImportName] = getattr(__import__(sImportName, globals(), locals(), [sImportName], -1), sImportName);
AttributeError: 'module' object has no attribute 'mWindowsMacros'
PS C:\Users\work\Documents\BugId.release.2021-04-15.11.40>
SkyLined commented 3 years ago

Hi, sorry for the late reply! I somehow missed this bug report.

I have had reports like this before, but I cannot reproduce the issue myself. Can you try the previous release version? I think that one does not have this issue. Let me know if that fixes this for you!

VoidSec commented 2 years ago

Hi, as I've encountered the bug above myself (BugID throws error on running 2nd time), here some more details that I hope will let you pinpoint the bug.

Environment: Windows 10 Pro x64 21H1 19043.1237 - Python 2.7.15 x64 BugID version: BugId.release.2021-04-15.11.40

Steps to reproduce:

  1. extract BugId in c:\bugid
  2. with an elevated cmd run pageheap rundll32.exe ON
  3. using an elevated cmd execute the following command .\BugId.cmd %WinDir%\system32\rundll32.exe -- advapi32 CloseThreadWaitChainSession
  4. BugID "print" the following expected output:
    * Command line: C:\Windows\system32\rundll32.exe advapi32 CloseThreadWaitChainSession
    + Main process 5172/0x1434 (rundll32.exe): Attached; command line = C:\Windows\system32\rundll32.exe advapi32 CloseThreadWaitChainSession.
    ┌─ A bug was detected ───────────────────────────────────────────────────────────────────────────────
    │ Id @ Location:    AVR:NULL 810.904 @ rundll32.exe!advapi32.dll+0x60DD4
    │ Description:      An Access Violation exception happened at 0x0 while attempting to read memory at 0x0 using a NULL pointer.
    │ Security impact:  Denial of Service
    │ Version:          rundll32.exe 10.0.19041.746 (x64)
    │                   advapi32.DLL 10.0.19041.1052 (x64)
    │ Bug report:       AVR։NULL 810.904 @ rundll32.exe!advapi32.dll+0x60DD4.html.
    └──────────────────────────────────────────────────────────────────────────────
  5. re-execute the following command .\BugId.cmd %WinDir%\system32\rundll32.exe -- advapi32 CloseThreadWaitChainSession
  6. the following error message is showed:
    Traceback (most recent call last):
    File "c:\bugid\BugId.py", line 28, in <module>
    fInitializeProduct();
    File "c:\bugid\fInitializeProduct.py", line 99, in fInitializeProduct
    cDependencyChecker(sMainProductFolderPath).fCheck();
    File "c:\bugid\fInitializeProduct.py", line 81, in fCheck
    oProductModule = foLoadModule(sDepentOnProductName, oSelf.oMainProductDetails, sProductName);
    File "c:\bugid\fInitializeProduct.py", line 24, in foLoadModule
    oProductModule = __import__(sProductName, globals(), locals(), [], -1);
    File "c:\bugid\modules\cBugId\__init__.py", line 1, in <module>
    from .cBugId import cBugId;
    File "c:\bugid\modules\cBugId\cBugId.py", line 21, in <module>
    from mWindowsAPI import oSystemInfo;
    File "c:\bugid\modules\mWindowsAPI\__init__.py", line 1, in <module>
    from .mWindowsAPI import *;
    File "c:\bugid\modules\mWindowsAPI\mWindowsAPI.py", line 1, in <module>
    from .cConsoleProcess import cConsoleProcess;
    File "c:\bugid\modules\mWindowsAPI\cConsoleProcess.py", line 1, in <module>
    from mWindowsSDK import *;
    File "c:\bugid\modules\mWindowsSDK\__init__.py", line 1, in <module>
    from .mWindowsSDK import *;
    File "c:\bugid\modules\mWindowsSDK\mWindowsSDK.py", line 146, in <module>
    mModule = __import__(sModuleName, globals(), {}, None, -1);
    File "c:\bugid\modules\mWindowsSDK\mWindowsMacros\__init__.py", line 2, in <module>
    from .mWindowsMacros import *;
    File "c:\bugid\modules\mWindowsSDK\mWindowsMacros\mWindowsMacros.py", line 14, in <module>
    globals()[sImportName] = getattr(__import__(sImportName, globals(), locals(), [sImportName], -1), sImportName);
    AttributeError: 'module' object has no attribute 'mWindowsMacros'

Deleting Bugid's folder, re-extracting the files from the release ZIP will "fix" the error up to the first execution; on the 2nd one, Bugid will throw the same above error again.

Using BugId.release.2020-07-02.21.18 completely fix the problem.

Let me know if there is anything I can help you with (logs, tests, etc) :)

SkyLined commented 2 years ago

Fixed in https://github.com/SkyLined/BugId/releases/tag/2021-10-25

When you allow Python to use pre-compiled byte code, it generates .pyc files from the .py files the first time you run BugId. The second time you run it, to executes these .pyc files instead of the .py files. The source code expected to run from files with the .py extension and failed when it was run from files with the .pyc extension.