Skip to main content

SSHD on Windows 7 (somewhat covert)


I recently had an Admin password and wanted a persistent backdoor on a x64 Windows7 box I had physical access to for a limited amount of time.

I thought about putting a bind shell on the box, but then not only would I have to open a port up through the firewall, but also if I killed the session my bind shell would exit, and I'd lose my ability to connect back in.  So I ditched the bind shell idea. 

A reverse shell seemed like the way to go.  This had the benifit of if I moved off the LAN, I could get back in through the NAT firewall.

The question was, how do I make a persistent reverse shell?  Even though I was Admin, when my trojan connected back to my attack platform, it only had User privs, so I couldn't 'run scheduleme' in Meterpreter to set up a service (darn Windows7!). I tried using the Windows Scheduler, creating a task to run my trojan to connect back to me every 10 minutes.  This worked OK at first.  I was worried that if I scheduled it to connect back to me every 10 minutes, that the victim would get a new session process every 10 minutes, and I'd fill up the box... but in testing, if I wasn't listening when the session tried to connect back to me, it would simply exit cleanly. So I thought I was done.  But then, I noticed that even though I had the task in the scheduler, and even though it would work for a while, it would always quit connecting back to me (even though the task was still scheduled).  I played with the scheduler, and no matter how I scheduled the task, it seemed that it would quit calling back to me.  The reason is unknown, but the symptoms persisted... I couldn't get the scheduler to keep calling back to me, even though it SAID it was scheduled.  I added this to my list to research later on, but needed a quick solution.

As a quick work-around, and since I had physical access and the victim was on the LAN with my attack box, ssh seemed like a good solution.  Ssh is robust, and I could use it to run my payload anytime I wanted the victim to connect back to me.  I tried to install OpenSSH.  However, Openssh doesn't work well (at all?) with Windows 7.  So instead I used CopSSH (ver 4.1).  When you install it, a control pannel comes up to configure it.  To get CopSSH to run as a service (every time the PC boots up), you have to create a new user.  That is a major downside, as this user will show up in the logon menu.

Don't forget to run the CopSSH Control Panel as Admin, or your service won't run every time you boot the box!

After I made the new user, ran the CopSSH Control Panel as Admin, and told it to start with this User, I then hid the user from the logon screen with the below.

[Hide User Accounts in windows Vista and Windows 7 (from technet forums):
at Run type regedit
Once in regedit go to HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon
In the left panel, right click on Winlogon and click New and click Key.
Type SpecialAccounts and press Enter
In the left panel, right click on SpecialAccounts and click New and click Key.
Type UserList and press Enter.
In right panel of UserList, right click on a empty area and click New then click DWORD (32bit) Value.
Type in the name of the user account that you want to hide and press Enter.eg: Everyday Account.
In the right panel, right click on the user account name and click Modify.

To hide the user account ? Type 0 and click OK. (number zero not the letter)
Whenever you want to use the account just unhide the it by typing 1 instead of zero.]

Now I have a box that I can SSH into, and then click on my payload to create a session back to my box.

If anyone knows how to fix the scheduler so that it actually reliably runs my task, or if you know how to get my trojan to run with Admin privs (and right-click 'run as Admin' didn't work) please let me know!

Comments

Popular posts from this blog

ADS-B plotting with Kali (and other SDR goodies)

Recently I wanted to try some Software Defined Radio stuff.   
I had a RTL-SDR, FM+DAB, DVB-T USB Stick Set with RTL2832U & R820T. that I got from: http://www.amazon.com/gp/product/B00C37AZXK/ref=oh_details_o04_s00_i00?ie=UTF8&psc=1
But, even though this dongle would break out FM radio stations, and ATC frequencies (like the local Ground Control, tower, and even ATIS), which was cool, it wouldn't break out ADS-B.   
Thus, I bought a Vantech Green Mini RTL2832U R820T DVB-T SDR DAB FM USB DIGITAL TV Tuner Receiver RTL-SDR Project + DAB dongle Tuner MCX Input from Amazon, and tried this.  
This dongle was able to listen to the 1090MHz frequency required for ADS-B (as it goes from 25MHz to 1700MHz).  There were tons of Windows programs out there for breaking out and plotting ADS-B Mode S broadcasts, but not many for Linux.  
For Kali Linux, here's how I got it running and plotting planes around my home:
0) before you start, you should do an apt-get update to ensure you hav…

Beaglebone Black as a Wireless Intrusion Detection System (WIDS)

Recently I have been wanting a wireless IDS (WIDS) to detect nefarious wifi activity.  I also had a Beaglebone Black hanging around that I wanted to put to good use.   This seemed like a perfect match, and indeed it seems to be so!

I did some research on WIDSs, and although there is SUPPOSED to be several out there, nearly all that I seemed to find was commercial and Windows-based products, not something I could use myself.   
About the only exception to that rule was Kismet, so I decided to give that a try.  Kismet is supposed to work as a WIDS, and per its documentation should catch the following attacks:
Kismet supports the following alerts, where applicable the WVE (Wireless Vulnerability and Exploits, www.wve.org) ID is included: AIRJACKSSID Fingerprint Deprecated The original 802.11 hacking tools, Airjack, set the initial SSID to 'airjack' when starting up. This alert is no longer relevant as the Airjac…

Temper Temperature monitor on a Beaglebone Black

Beaglebone Black as a temperature monitor:

Recently I wanted to monitor the temperature of my shed.  I thought I'd use a small computer such as a Raspberry Pi or a Beaglebone or Odroid.

My Raspberry Pi boxes were all in use, so I grabbed my Beaglebone, which was doing nothing.

I flashed it with the Debian9.32018-03-054GB SDIoTimage, but that seemed like it was running lots of bloatware and the ethernet interface wouldn't take a static IP with /etc/network/interfaces.

So I went with the Debian9.32018-01-284GB SDLXQTi image instead.  I still had the same problem, that lots of junk was running, and I couldn't configure my interface by modifying /etc/network/interfaces

So my first step was to get rid of all the bloatware.  If you're using a Raspberry Pi or something, you can skip this and just go to the second step below

STEP 1--Remove Blotatware from Beaglebone Black:

With some searching, I came across this post:
https://www.linuxquestions.org/questions/linux-newbie-8/inte…