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 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!


Popular posts from this blog

atftpd vs tftpd-hpa

Recently I was trying to tftp files from a Windows computer to a Kali box.   One version of Windows worked, but another didn't.    After much troubleshooting, here were my symptoms:

I could tftp a file from-to any Kali box from-to another Kali box
I could NOT tftp files to a specific Windows 7 box from any Kali box
I could NOT tftp files to a Chrooted-Ubuntu-Chromebook box from a Kali box

After MUCH troubleshooting, going through every setting in atftpd, it seemed like it literally was a client OS problem.  Different clients simply would not download files---unacceptable.

Thus, I switched to tftpd-hpa.   To install:
apt-get install tftpd-hpa

files go to/come from /srv/tftp, but it needs to be a tftp user. Thus, I needed to:
chroot -R /srv/tftp

Also, if you want to be able to put files ON the tftp server (from a client), you need to modify /etc/default/tftpd-hpa:
change "TFTP_OPTIONS="--secure" to "TFTP_OPTIONS="--secure --create"

I also changed the IP li…

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:
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…

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:…