I decided to play a little bit with scapy and tried to find something in the internet that helped me to sniff and modify traffic without ARP-Storming the whole network.
I want to connect a box to my computer eth0 and the network to eth1, so that I’m between the box and the network.
Note: This one does not defeat SSL right now, but that could be easily done with all the tools out there.
The idea is to transparently forward all traffic and only pick out specific packets for modification with scapy.
I did do this with an combination of bridged interface, iptables NFQueue and scapy.
First we gonna create a bridge between eth0 and eth1 to transparently forward all traffic:
ifconfig eth0 0.0.0.0
ifconfig eth1 0.0.0.0
brctl addbr br0
brctl addif br0 eth0 eth1
ifconfig br0 up
Second, we need to setup iptables to send the traffic we want to change to an NFQueue.
Important is that this line is executed within the startup of the scapy script, so the actual modding only happens if the script is running.
It would be bad if the script is not running and the packets don’t traverse..
The line we need to set in the scapy script is:
iptables -A FORWARD -m physdev –physdev-in eth1 -s 192.168.1.10 -j NFQUEUE
Third, our scapy program catches those packets, modify them if they are of interest for us and forwards them accordingly.
Important is to command scapy that it should also forward traffic we do not want to be modified (e.g. other SNMP calls in this example):
What I actually do is to modify a response of our target system to the monitoring system.
I choose the SNMP response of an HP ProLiant power-supply check that checks if the power supplies are OK or not (or disconnected):
The “original” says that both power-supplies are degraded or in other words they have a problem:
# snmpwalk -v 1 -c public -O eq 192.168.1.10 126.96.36.199.188.8.131.52.184.108.40.206.4
# ./check_psu -H 192.168.1.10
PSU 1 DEGRADED, PSU 2 DEGRADED
after starting the scapy script, it will happily transform to something much better:
Adding iptable rules :
iptables -A FORWARD -m physdev –physdev-in eth1 -s 192.168.1.10 -p udp -j NFQUEUE
[+] Running Main loop
Got a packet ! source ip : 192.168.1.10 dest: 192.168.1.60
Old status: 2 (<ASN1_OID[‘.220.127.116.11.18.104.22.168.22.214.171.124.4.1.1’]>)
New status: 2 (OK)
Got a packet ! source ip : 192.168.1.10 dest: 192.168.1.60
Old status: 2 (<ASN1_OID[‘.126.96.36.199.188.8.131.52.184.108.40.206.4.1.2’]>)
New status: 2 (OK)
and in the console:
# snmpwalk -v 1 -c public -O eq 192.168.1.10 220.127.116.11.18.104.22.168.22.214.171.124.4
# ./check_psu -H 192.168.1.10
PSU 1 OK, PSU 2 OK
And this all by just carefully crafting and modifying packets
Have Phun :)
It was quite a long time since my last post now. That is simply because my family and my job is taking up all my time since the last years ;) The last month I found myself that I need to challenge myself and wished long time ago to get a technical certification in the security sector.
My last certification was quite a lot of time ago and was a Qualys Guard certification so i searched the internet for an adequate challenge to take.
After reading some blogs i found that the certifications from
http://www.offensive-security.com seemd to be really challenging, even for people who worked for years as pentesters.
A bit of reading on the offensive website stated:
“… widely regarded as one of the most respected and difficult to obtain technical information security certifications available, the OSCE is the industry premier advanced penetration testing certification.
Holders of this certification are part of an elite group who have proven they have what it takes to be among the best and brightest in the field.”
Umm making that statement from such a respected company…
I thought this could be really challenging.
So i decided to give the Cracking the Perimeter and the resulting Offensive Security Certified Expert (OSCE) a shot
That said, I found myself over at fc4.me, the registration challenge for the CTP course.
The first few steps of http://fc4.me were quite easy, just because I had managed to get a few levels over at http://3564020356.org years ago and remember everything of that, the rest you can think of yourself :)
Please be aware that I will not give any hints on the registration challenge / the course or the exam.
The exam is so hard – if you can not make it yourself and need to use hints from anybody to do the exam you are cheating and have not deserved the certificate.
-the CTP course-
You will have an option to register for 30 or 60 days, i chose 60 days and planned to do my exam after about 45 days and if i could not archive it, I could work on the lab for another 15 days and try again.
If you need other information’s about the course itself, give google a shot, there are plenty of reviews on the CTP course itself.
Of course nothing you plan for your life is exactly happening the way you planned before.
I wanted to plan my exam 15th April but on Friday 2016-03-25 my public services provider dropped a letter that they will break up the whole street where I live and maintain power, gas and water for 15 WEEKS, starting the 15th April.
Damnit, so i cannot rely on a stable internet connection for the whole 48 hours of exam.
I then found an exam slot at Monday 28th March – yeah 2 days after I received the letter from public services..
I then scheduled the exam to this date…
As stated before that nothing you plan is going exactly this way, everything is trying to get the hell out of me and my whole family went sick in the night to Monday >:(
Nothing i could do – I couldn’t reschedule the exam and had to do it now.
– the exam –
I can’t tell you how nervous I was. I created a lot of scripts beforehand where I thought Offensec will put me some stones. I even learned python a little bit as I want to get everything I could from the course.
The exam consists of 4 challenges, 2 with more points, 2 with fewer points rewarded.
I started with the smaller ones where even my scripts come handy so my nervousness flattened..
7 hours later I had 3 out of 4 challenges made.
I started the exam at 16:00 PM now it was 1 o’clock. I went to my first sleep.
Wakened up at 8AM I get a coffee and immediately headed over for the last challenge.
This challenge could be broken up in 2 parts and after some fiddling I got the first part working after two hours or so.
But then, this one put everything out of me, I couldn’t get it to do what I want – I worked really hard with some little breaks to regain consciousness.
I found several ways that *could* work, but none of them did work at the end and I started to get frustrated.
It is now 02:00 AM and I went to bed again, couldn’t do anymore..
After a horrible sleep I woke up and the first thing that came to my mind was:
Okay, got a coffee.. More ideas came…
5 hours later I was really between hope and desperation.
It was now 13:00 and I started to get ready to fail at the last step of the exam.
But not with me, I tried shooting at the dev-target as much as I could and baaam!
Out of nowhere my last idea did work!
Now I started to get really nervous now, I had to hack all my findings together in a working manner and has to circumvent some little problems but I managed to get everything up and working 2 hours before the end of the exam.
Now I was ready to work against the objective and on the first attempt it did work!
YEAH I was so happy that I screamed around and really felt like a hero.
I hacked together my documentation of everything for what i had again 24 hours after the exam but I needed to know if I did pass or not. I had invested soo much hard thinking I couldn’t wait for the result.
After 2 days I got the revenue:
We are happy to inform you that you have successfully completed the Cracking the Perimeter certification exam and have obtained your Offensive Security Certified Expert (OSCE) certification
And they even sent me a nice image to include in my online activities:
In the end I was sooo close to give up, but the moment when you overcome this feeling and get it working is what everybody out there is meaning with the words “try harder” – with enough persistence everything is possible.
Thank you Offensive-Security for this mind-blowing course and to allow me to master success and failure – this was the hardest thing I ever have made under the pressure of time!
Really I need to say thanks to my 2 kids and my wife – they have gone sick but managed to not disturb me the whole 3 days while i took the exam. Thank you :) Love you ;)
Now, the next step is to recon from this and to get my family healthy again ;)
Now, in my last Posts i showed you that i use the Xbee Series to play a little bit around.
First of all i tried to design a system that allows me to realize my House Automation.
I wanted to include the Xbee System as this not just helps me to save cables, but enable me doing freaky wireless stuff like remote-open my door or alarming all Xbee Chips at the same time that some burgular trying to do his work.
I had the following things in mind:
- Xbee Devices are all over the house, encryption on, connected to a Micro like the ATMega32 or standalone (for my letterbox)
- Communicator is hooked up to a linux system so i can take control from there
- Xbee’s should communicate with each other, the Computer is just passive
So the following thing is what i need:
1. XBee’s in API Mode
This is a must as only in this mode fast addressing is possible
2. Linux system connected to the Coordinator via FTDI
I had the standard ftdi_sio module loaded with the connected FTDI 232BL, it got’s recognized and i can communicate with the XBee.
After a while i can write to the XBee but my subsequent read’s doesn’t return anything.
While i debugged and changed my Code over two Month’s i found the Problem: The FTDI Chip or the ftdi_sio driver.
I use perl, threads and a lot of other stuff i never used before and searched the Problem there. But i didn’t find anything.
A quick test with an standard RS232 Converter + XBee resulted that my Code is completly OK. >:[ D-A-M-N
3. Preferbly a Perl Script that run’s a a Server
So more than one “Client” can Connect to it and Control everything, for ex. a recurring linux Cron Job checking Temperature and a “GUI” User Interface on Windows should not disturb each other and both should work at the same time.
4. Xbee’s connected to ATMega32
No problems here, ATMega32 have a Serial Interface
5. ATMega32 API
This was not too hard to write, but the Memory Management is tricky..
I learned that i even can overwrite my Memory with BASCOM, so this is no more excuse to not use C ^^
This was written about two years ago, in the meantime i created a system exact like this one, written a perl server and has the XBee’s connected.
Everything is fine until a day where all XBee’s lost it’s connection to the coordinator without an obvoius reason.
I’m still investigating why the Radiochips loose it’s connection, sometimes it takes 3-4 Weeks, sometimes every hour they loose it.
I’m really disappointed about the relaiability of those XBee’s, i thought they will reconnect to other routers but it seems that one XBee is sticked to it’s parent forever.
I’ve written an perl server with jabber and network integration for the System but i discarded it.
At the moment i’m concentrating on an FHEM implementation as I started to head over to HomeMatic :)
More to come..
Recently i extended my RAID 5 array by replacing one-by-one hdd’s with bigger ones and waiting for each to rebuild.
All the instructions are executed on a HP DL360 G6 with an SmartArray P410i controller with only one logicaldisk.
It is highly recommended that you backup all your VM’s before executing a single command – everything worked fine for me but one error in a command could leas to a complete data loss of everything!
Recently I wrote a blog entry about how to add a root certificate to your rooted android keystore for using SSL funambol.
This works perfectly as long as you have root access to the device.
Sometimes you come into the situation where you cannot root the device, eg. in a corporate environment or if you just don’t want to crack a new device just to make the funambol client working, like me for now.
I’ve got a new Motorola Xoom and needed funambol to sync my contacts and calendar entries.
After asking Mr. Google there are only 2 ways till Android 4.x is ready:
- Using http without ssl
- Using ssl and recode the funambol client to accept all cert’s
I decided to use the 2nd solution – this also refreshes my java a little bit :-)
Of course i want to share everything with you – if you’re too lazy to read all the stuff you can point your Android client here to install my compiled Funambol 10.0.8 client without the certificate check:
For Android < 4.0 this binary works:
Direct download with android: funambol-android-10.0.8_Tasks-devBioS.apk
Since ICS (>= 4.0) people having problems syncing Calender. This is because they made changes in the Calender API wich renders the Calendar Sync unusable, you can use this binary (which only works on ICS and greater):
Direct download with android: funambol-android-10.1.3_Tasks-devBioS.apk
UPDATE 2012-04-03: I activated the task sync feature also and re-uploaded the binary.
If anyone is intrested in the source on how to activate it, drop me a line and i will update the post.
Yeah, after being really busy with my real life, here is another intresting trick for you:
How to get some more root certificates on an android phone where you have root acces (or, at least, you can start & use root explorer).
Some background info:
I use a funabol community server to keep my phone’s and outlook’s in sync and recently my colleague sven did a great job converting my HTC HD2 with winmobile to Android 2.x (kudo’s to him! thanks!).
Update on 2011-12-27: I changed the client to allow self-signed certificates: here
The challenge is that if you use funabol with self signed ssl certificates you need to get those recognized by android which is a really complicated task if you don’t know how. But here we go:
What you need before (and what i don’t describe):
- a rooted phone + root explorer. You NEED to be able to write to /etc/security/ in “RW” mode.
- a working funambol installation with ssl configured (see here: http://wiki.ow2.org/sync4j/Wiki.jsp?page=HowtouseHttps)
Our steps include:
- Export the certificate out of the funambol java keystore
- Get the cacert.bks from the android device
- modify the cacerts.bks of android
- reboot and finished
Step 1 – Export the funambol certificate
- Execute “%JAVA_HOME%\bin\keytool -export -alias tomcat -file myroot.cer” (in-detail like here)
- copy the myroot.cer to the SD-Card of the android device (or download to another computer)
- insert the SD-Card to the android device, startup root explorer and navigate to /etc/security/
- copy the file cacert.bks
- navigate to /sd-card and paste the file
- insert to another computer
- Go and execute the Portecle Keytool and open the cacerts.bks from your SD-Card
- When promtes for a password, just hit enter
- go to Tools -> Import Key Pair and select your myroot.cer, give it any name you want
- save the cacerts.bks
- re-insert the SD-Card to android device
- open up root explorer, head to /sd-card, copy, paste to /etc/security/
- make sure root explorer show “mounted as r/w” in the header of the program.
- set permissions of the newly copied cacert.bks to rw-r–r– (owner,group,other: read owner:write)
- double check if the permissions of cacerts.bks are set correctly to rw-r–r–
- restart the phone
- funambol sync should now complete.
Have phun to be in sync!
P.S. Keep in touch! the next xbee’s blogpost’s are half-way written, but i really don’t have time ATM… sry
Something that i always hate is when there is no update and a product stop’s working so i cannot do my work anymore.
In this case i (am forced to) use Internet Explorer to open up several intranet pages that allowed me to do my administration work.
The problem sums like this:
- Google, and everything else on “the internet” works seemless
- opening something internal just hang up IE8 for a couple of minutes and then just stop loading without an error
- Same in FireFox with IETab installed
- same in IE 7 + IE 8 64 bit and 32 bit
The solution is as easy as stupid:
In “Internet Options” -> “Security” the “Local Intranet” is set up with disabled “Protected Mode”.
Enabling it fixed the Problem instantly for IE8, IE7 and Firefox with IETab.
As i promised this is my first XBee Project. I just needed a more or less useful application i can “test” the XBee’s in a real environment.
It is in my nature to do crazy things, so i thought it would be really cool to have a notification Jabber Message to my Phone when someone put some letters for me in my letterbox. Here it is ;)
The FTDI Chip gives me A fscking LOT PAIN more to come in the next Post. DO NOT USE IT :)
This is my Setup:
- XBee “Coordinator” API Mode connected through a FTDI USB Chip to a linux box
- XBee “End Device” Interfaced with an Atmel ATTiny13v power by two 1.5v AA Batteries
- Perl XBee Module API.pm from Thomas Jager
- Jabber Perl Modules to enable sending messages
- Siemens S685IP DECT Phone that can recieve Jabber messages
Before you read further you should note that i flashed the ZIGBEE firmware (XB24-ZB) API on my XBee’s because i don’t want to miss the mesh feature.
This Setup now runs with 2x Alkaline Batterys in the End-Device for 4 weeks now, and is still running!
Recently, well 1 year ago, i readed in The Make Zine about a Project called “The Brain Machine”.
This is the Story i had the last weekend with some cool Chips named “XBEE”.
These Chips are intelligent RS-232 -> Wireless sender and reciever who can stickt together to a so called mesh network.
First i have to tell the terminology:
“Coordinator” – is the Main Boss of the Network, who coordinates everything – and let routers and endpoints connect
“Router” – is a endpoint but can route packets and other endpoints can connect to it.
“End Device” – is a endpoint but noone can conenct to it – it is designed to save energy and run from batteries.
Mesh Networking is really fantastic because you can have a coordinator (“middle”) which is connected to routers and end devices, and is “self-healing” this means if a router is powered off, packets get automatically routed through another reachable router – so packets can arrive to their destination.
If a Enddevice don’t have a connection to a router or the coordinator, put a router in between and it will connect seamless without configuring routing or anything manually.
More about the theory you can find in the references section at the end of my Post.
Okay, first a Picture of my actual “Setup” then the painful story :)