Security And Hacking – Lance Grover https://www.lancegrover.com Fri, 25 Aug 2017 20:56:02 +0000 en-US hourly 1 https://wordpress.org/?v=5.9.5 Join a firejail session https://www.lancegrover.com/join-a-firejail-session/ Fri, 25 Aug 2017 20:55:26 +0000 http://www.lancegrover.com/?p=106 Sometimes I use firejail…well a lot actually….and I usually just use it for a browser like this:

firejail –private google-chrome

or this

firejail –private google-chrome –proxy-server=”socks5://localhost:8080″

But on a few occasions I want to be able to join ssh to the same sandbox instance…so I do this:

firejail –list

firejail –join=3452
(or whatever the session you want)

Another thing I have ran into is I downloaded something but want to save it before I destroy my firejail (private) session…so I do this:

firejail –get=5255 ~/.config/google-chrome/Default/Cookies

 

You can see more examples and other documentation here:

Firejail Usage

]]>
A little ssh honeypot fun https://www.lancegrover.com/a-little-ssh-honeypot-fun/ Tue, 25 Jul 2017 17:03:43 +0000 http://www.lancegrover.com/?p=97 I say honeypot but really it isn’t a honeypot… but it is something I am using to log/capture data from malicious individuals….so thus the reason I say honeypot.

I want to edit sshd to log all user/password attempts.

Cent7

yum install git make zlib-devel openssl-devel openssh-devel pam-devel screen autoconf gcc vim-enhanced lsof
git clone https://github.com/openssh/openssh-portable.git
cd openssh-portable/
autoreconf
./configure
vim auth-passwd.c (add in my little log code in the auth_password function)

//for Lanix
logit(“sshd credentials:%s:%s”,authctxt->user,password);

make
we are going to use the built-in sshd_config and the current ssh_host_keys to prevent anyone remote being able to easily identify the trap.
cp /etc/ssh/sshd_config /root/  (modify this as there are multiple parts we didn’t complile into our ssh and errors will be thrown, also to test I run it first on a different port)
cp /etc/ssh/ssh_host_* /root/
chmod 0600 /root/ssh_host_*
/root/openssh-portable/sshd -f sshd_config -D (I test with the -D so that I can easily stop the program)
This will log things in /var/log/secure on a Cent7 box, just look for the “sshd credentials” LOL

Debian

apt-update
apt-get install zlib1g-dev screen vim make gcc autoconf git libssl1.0-dev
(libssl1.0-dev because regular libssl-dev throws errors on compile of ssh, well as of right now)
(not sure if these are needed yet) apt-get install libcrypto++-dev libgcrypt20 libcrypto++6 libcrypto++-utils r-cran-openssl
git clone https://github.com/openssh/openssh-portable.git
cd openssh-portables/
autoreconf
./configure

vim auth-passwd.c (add in my little log code in the auth_password function)

//for Lanix
logit(“sshd credentials:%s:%s”,authctxt->user,password);

make
we are going to use the built-in sshd_config and the current ssh_host_keys to prevent anyone remote being able to easily identify the trap.
cp /etc/ssh/sshd_config /root/  (modify this as there are multiple parts we didn’t complile into our ssh and errors will be thrown, also to test I run it first on a different port)
cp /etc/ssh/ssh_host_* /root/
chmod 0600 /root/ssh_host_*
/root/openssh-portable/sshd -f sshd_config -D (I test with the -D so that I can easily stop the program)
This will log things in /var/log/auth.log, just look for the “sshd credentials” LOL

]]>
Windows (windblows) password audit notes https://www.lancegrover.com/windows-windblows-password-audit-notes/ Fri, 30 Jun 2017 14:50:02 +0000 http://www.lancegrover.com/?p=83 Well, it’s that time of the year/quarter/month…. whatever policy you have on performing the password audit…  Some of my notes are from references that are a few years old, so not sure if they will be around much longer, I hope so, they have good info.  Keep in mind I am using kali 2017.1 for my fun today.

First Windows password audit, or as I call it, Windblows Password Audit.

  • Retrieve the ntds.dit and SYSTEM file: – notes from https://www.cyberis.co.uk/2014/02/obtaining-ntdsdit-using-in-built.html
    • C:\>ntdsutil
    • ntdsutil: Activate Instance ntds
    • ntdsutil: ifm
    • ifm: create full c:\cool-pass-pentest-audit
    • ifm: quit
    • ntdsutil: quit
  • copy the c:\cool-pass-pentest-audit folder to your kali box
  • install the libesedb-utils
    • apt install libesedb-utils
  • export the ntds tables – notes from https://www.cyberis.co.uk/2014/02/obtaining-ntdsdit-using-in-built.html
    • esedbexport -m tables ntds.dit
    • (this may take a while…a long while)
  • Now we need to extract the hashes….
    • currently I am using this: https://github.com/csababarta/ntdsxtract
      • git clone https://github.com/csababarta/ntdsxtract.git
    • python ntdsxtract/dsusers.py ntds.dit.export/datatable.4 ntds.dit.export/link_table.6 hashdumpwork –syshive SYSTEM –passwordhashes –lmoutfile lm-out.txt –ntoutfile nt-out.txt –pwdformat ocl
  • Now we can do some cracking, using hashcat (since I like to use GPUs)
    • We will start with the rockyou.txt.gz wordlist that came with my kali install
      • cd /usr/share/wordlists; gunzip rockyou.txt.gz; cd –
      • hashcat -a 0 -m 1000 –username hashdumpwork/nt-out.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/rockyou-30000.rule
        • I like to use most of the rule sets that come with the hashcat install on kali, I tend to get a bit of success with the different ones, but I will just give the example using the rockyou-30000.rule
  • you want to see what passwords you got when it is over?  just do the same hashcat command but add the –show flag in there and presto!
]]>
SSH proxy through my VM cloud server (using firejail and chrome) https://www.lancegrover.com/ssh-proxy-through-my-vm-cloud-server-using-firejail-and-chrome/ Fri, 30 Jun 2017 14:23:39 +0000 http://www.lancegrover.com/?p=84 Oh.. you have country blocking turned on at the firewall… or some other web filter or firewall that is preventing you from viewing a website.

Keep in mind you do need a server you have access to via ssh… I like cloud servers, they tend to not have web filters..lol

First we need to setup the ssh socks5 proxy, we will ssh into our VM (virtual machine server) and proxy through there on local port 8080:
ssh -D 8080 myuser@myserver.mydomain

Now, keep in mind I am using Kali 2017.1 for this next part but you can use other distros and even configure other browsers to connecto to your localhost:8080 proxy, I am using firejail and google-chrome. Firejail allows me to have an independant isolated browser running so I can still have my regular browser up and running as needed. This is how we connect:
firejail –private google-chrome –proxy-server=”socks5://localhost:8080″

Boom, good times…

]]>
limit ssh to specific hosts with firewalld (firewall-cmd) https://www.lancegrover.com/limit-ssh-to-specific-hosts-with-firewalld-firewall-cmd/ Tue, 23 Jun 2015 16:22:24 +0000 http://www.lancegrover.com/?p=61 Here is a little reminder on how to limit ssh (or any port really) to a specific IP using firewalld:

<code>
systemctl start firewalld.service
systemctl enable firewalld.service
firewall-cmd –zone=”trusted” –add-source=<external IP 1>
firewall-cmd –zone=”trusted” –add-source=<external IP 1> –permanent
firewall-cmd –zone=”trusted” –add-source=<external IP 2>
firewall-cmd –zone=”trusted” –add-source=<external IP 2> –permanent
firewall-cmd –zone=”trusted” –add-service=ssh
firewall-cmd –zone=”trusted” –add-service=ssh –permanent
firewall-cmd –zone=”trusted” –list-all
firewall-cmd –zone=public –remove-service=ssh
firewall-cmd –zone=public –remove-service=ssh –permanent
</code>

]]>
How about a little aircrack of wpa? https://www.lancegrover.com/how-about-a-little-aircrack-of-wpa/ Mon, 15 Jun 2015 19:42:28 +0000 http://www.lancegrover.com/?p=56 Make sure you own the network/wireless access point or have permission to attack/break in to the WPA network you are attacking before you start.  In this case I got permission, and I have several witnesses and documentation to support it.

First do this to find the network
airodump-ng -i wlan1

Focus in on that one network wap and capture the goodies
airodump-ng –bssid 00:1E:52:78:AA:5C -c6 –write WPAcrack wlan1

on another interface, do a deauth to force devices to reconnect
aireplay-ng –deauth 100 -a 00:1E:52:78:AA:5C wlan2

notice the “WPA handshake: 00:1E:52:78:AA:5C” at the top of the airodump screen?

now crack it with this:
aircrack-ng WPAcrack-01.cap -w /usr/share/wordlists/dirb/big.txt

or by using john the ripper:
john –incremental=all –session=WirelessBrute –stdout | aircrack-ng -a 2 -b 00:1E:52:78:AA:5C WPAcrack-01.cap -w –

Resume works as well:
john –restore=WirelessBrute | aircrack-ng -a 2 -b 00:1E:52:78:AA:5C WPAcrack-01.cap -w –
the other I am doing right now
john –incremental=all –session=BruteRockSteady –stdout | aircrack-ng -a 2 -b 88:1F:A1:38:9C:90 WPAcrackRock_Steady-01.cap -w –

 

 

Thanks to the following for information/tutorial :

https://www.hackthissite.org/articles/read/1094

http://null-byte.wonderhowto.com/how-to/hack-wi-fi-cracking-wpa2-psk-passwords-using-aircrack-ng-0148366/

]]>
Proxy web traffic through your linux server? https://www.lancegrover.com/proxy-web-traffic-through-your-linux-server/ Wed, 20 May 2015 13:35:46 +0000 http://www.lancegrover.com/?p=53 sshuttle is a fun little application that basically acts as a quick and easy VPN over ssh.

As an ethical hacker you can also use this to proxy your traffic over this connection….think of the possibilities.

This is an easy one to setup, first on the server side just make sure you have python installed. Then on the client side you need to have sshuttle installed and on the client side you will need root level access since you are changing routing and firewall rules.

Now to actually start routing traffic over ssh:

sshuttle -r username@sshserver 0.0.0.0/0 -vv

to route dns traffic

sshuttle --dns -vvr username@sshserver 0/0

]]>
Setup OSSEC agent on a CentOS7 system with Alienvault server https://www.lancegrover.com/setup-ossec-agent-on-a-centos7-system-with-alienvault-server/ Thu, 14 May 2015 18:49:49 +0000 http://www.lancegrover.com/?p=50 Time to get some OSSEC on and connect an agent to Alienvault…  There is a bunch of people out there that are compiling, and not many using the RPM, or they forget to install both RPMs…

  1. wget -q -O – http://www.atomicorp.com/installers/atomic.sh | sh
  2. yum install ossec-hids ossec-hids-client
  3. add agent config to Alienvault
  4. extract key
  5. # /var/ossec/bin/manage_client
    (I – to import the key from Alienvault)
  6. modify /var/ossec/etc/ossec-agent.conf
    (change server ip address)
  7. service ossec-hids start
  8. chkconfig ossec-hids on
  9. On the Alienvault server – restart the ossec server in Environment-Detection-HIDS-Ossec Control
]]>
Too many Tickets and Alarms in your Alienvault system? https://www.lancegrover.com/too-many-tickets-and-alarms-in-your-alienvault-system/ Wed, 13 May 2015 17:26:54 +0000 http://www.lancegrover.com/?p=47 Working on an Alienvault IDS system, the company that was setting it up made some mistakes and had over 50k alarms and over 50k tickets that they wanted removed.  Time to do some database changes to clear those out.

  1. ssh into the alienvault database server or all-in-one server, and jailbreak to the command line.
  2. use the ossim-db command:
    #  ossim-db
  3. use the alienvault database:
    > use alienvault
  4. First lets look at the tables involved with tickets – or incidents:
    > show tables like ‘incident%’;
  5. Now mark all the incidents as closed:
    > select * from incident where not status = “Closed” limit 5;
  6. Now look at the alarm tables:
    > show tables like ‘alarm%’;
  7. Now mark all alarms as closed:
    > update alarm set status = “closed”;
  8. Note: notice the incidents use a capitol on Closed, and the alarms use a lower case on closed.
]]>
Installing Fusion-io/Sandisk ioDrive2 drivers on CentOS7 with LUKS encryption https://www.lancegrover.com/installing-fusion-iosandisk-iodrive2-drivers-on-centos7-with-luks-encryption/ Fri, 08 May 2015 15:09:59 +0000 http://www.lancegrover.com/?p=34 I was working on a Mongo database server that was going to be running a Fusion-io/Sandisk ioDrive2 card for wicked speed, and also needed to do on disk encryption…fun task.  I am using CentOS7 and ioDrive2 drivers version 3.2.10.  I wanted auto mounting of the space, so I can have the services start on reboot (after putting in the LUKS password).

1. download drivers from https://link.sandisk.com/Home/SoftwareDownload (may need to make account first) (in this case v 3.2.10)

2. # tar xvf fusionio-files-*.tar
3. # uname -r (now check the binary available does it match your kernel? – mine did not)
4. # cd fusionio-files-*/ioDrive2/Linux_centos-7/3.2.10/Software\ Source
5. # rpmbuild –rebuild iomemory-vsl-3.2.10.1509-1.0.el7.centos.src.rpm
6. # cd ~/rpmbuild/RPMS/x86_64/
7. # yum install iomemory-vsl-3.10.0*.rpm iomemory-vsl-config-3.10.0-*.rpm iomemory-vsl-source-3.2.10*.rpm
8. # cd ~/fusionio-files-*/ioDrive2/Linux_centos-7/3.2.10/Utilities/
9. # yum install fio*.rpm
10. # yum install lib*.rpm
11. # mkdir /var/lib/mongo
12. # modprobe iomemory-vsl
13. # dmesg (to vierify that the device was found)

**** now setup LUKS encryption ****

14. # cryptsetup -y create iomongo /dev/fioa
15. # mkfs.xfs /dev/mapper/iomongo
16. # mount /dev/mapper/iomongo /var/lib/mongo
17. # vim /etc/crypttab
add the line:
iomongo /dev/fioa none
18. # vim /etc/sysconfig/iomemory-vsl
uncomment the following:
ENABLED=1
modify and add the mount points
MOUNTS=”/var/lib/mongo”
19. # reboot
(verify everything comes up – notice if you have other LUKS encrypted devices and you use the same password on all of them, you will only be asked once for a password and all your devices should work)

]]>