Learnings from analysing my compromised server

Returning back home. I get this buzz on my phone. Turns out it’s an email from Linode. Daym. I thought was I billed already? Trust me on this, I was really not sure what to do of this for the first two minutes when I read the email. I opened the Linode admin panel to check out what was my server up to. And the CPU graph had jumped off the hooks. Same was the case with the network graph Looking at the network log’s suggested a high amount of outbound traffic coming from my server, further cementing the Linode support ticket that I got. I ssh’d inside my server to see what was going on. I will be damned. I don’t remember sleep typing my password continuously for that long! Let me tell you, you don’t do a cat /var/log/secure at this point as the file would just be spit continously at you with no end of stopping. Did head (even a tail can do) to it. Going through the start of the file, everything was fine until I started to see the extremely less epoch time between two failed attempts. This confirmed my hunch that some script kiddie was trying to brute force through the root user login. /var/log/secure Fulled to brim I know, I should have disabled root login at the start and used ssh-keys to access my server. But I just delayed it to be done the next day. My fault. The logical thing now would be to start iptables (or) ufw and block outbound traffic as well… Read more



bleno writeup (updated)

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals. Need a BLE central module? See noble. Note: macOS / Mac OS X, Linux, FreeBSD and Windows are currently the only supported OSes. Prerequisites OS X install Xcode 10.9 or later Linux Kernel version 3.6 or above libbluetooth-dev bluetoothd disabled, if BlueZ 5.14 or later is installed. Use sudo hciconfig hci0 up to power Bluetooth adapter up after stopping or disabling bluetoothd. System V: sudo service bluetooth stop (once) sudo update-rc.d bluetooth remove (persist on reboot) systemd sudo systemctl stop bluetooth (once) sudo systemctl disable bluetooth (persist on reboot) If you’re using noble and bleno at the same time, connected BLE devices may not be able to retrieve a list of services from the BLE adaptor. Check out noble’s documentation on bleno compatibility Ubuntu/Debian/Raspbian sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev Make sure node is on your path, if it’s not, some options: symlink nodejs to node: sudo ln -s /usr/bin/nodejs /usr/bin/node install Node.js using the NodeSource package Fedora / Other-RPM based sudo yum install bluez bluez-libs bluez-libs-devel Intel Edison See Configure Intel Edison for Bluetooth LE (Smart) Development FreeBSD Make sure you have GNU Make: sudo pkg install gmake Disable automatic loading of the default Bluetooth stack by putting no-ubt.conf into /usr/local/etc/devd/no-ubt.conf and restarting devd (sudo service devd restart). Unload ng_ubt kernel module if already loaded: sudo kldunload ng_ubt Make sure you have read and write permissions on the /dev/usb/* device that corresponds to your Bluetooth adapter. Windows node-gyp… Read more



BLE pairing vs. bonding

Just a quick writeup on the difference between pairing and bonding, since these terms get used interchangeably. I think this has to do with the usage of ‘pairing’ in Bluetooth Classic, or BR/EDR. As far as Bluetooth LE is concerned, pairing and bonding are two very distinct things. The short explanations are that pairing is the exchange of security features each device has, and creating temporary encryption. Bonding is the exchange of long term keys AFTER PAIRING HAS OCCURRED, and STORING THOSE KEYS FOR LATER USE. Pairing is not the creation of permanent security between devices, that is called bonding. Pairing is the mechanism that allows bonding to occur. Pairing Pairing is the exchange of security features. This includes things like i/o capabilities, requirement for man-in-the-middle protection, etc. The client side begins this exchange. The client essentially says ‘hey, i’d like it if you had these features’. The server replies, ‘yeah, well, this is what I can do’. Once this exchange is made, the security that will be used has been determed. For example, if a server supports just noInput/noOutput for i/o capabilities, the Just Works pairing mechanism is going to be used. Once the pairing feature exchange is complete, a temporary security key is exchanged and the connection is encrypted, but only using the temporary key. In this encrypted connection, long term keys are exchanged. These keys are things like the (long term) encryption key to encrypt a connection, and also things like a digital signature key. The exact… Read more



Unveiling the Mysteries of BLE GATT: A Comprehensive Guide for Computer Savvy

As a seasoned computer professional, you’re likely no stranger to the world of wireless communication. With the proliferation of IoT devices, Bluetooth Low Energy (BLE) has emerged as a popular choice for device connectivity. At the heart of BLE lies the Generic Attribute Profile (GATT), a crucial component that enables seamless data exchange between devices. In this article, we’ll delve into the intricacies of BLE GATT, exploring its architecture, key concepts, and practical applications. What is BLE GATT? BLE GATT is a protocol that defines how devices interact with each other over BLE. It’s a hierarchical structure that facilitates the exchange of data between a peripheral device (e.g., a smart sensor) and a central device (e.g., a smartphone). GATT is built on top of the Attribute Protocol (ATT), which provides a way for devices to read and write attributes, such as device names and services. GATT Architecture The GATT architecture consists of three primary components: Services: These are logical groupings of attributes that define a specific function or feature of a device. Services are used to categorize attributes into meaningful categories, making it easier for devices to discover and interact with each other.Characteristics: These are individual attributes that contain specific data, such as sensor readings or device settings. Characteristics are the building blocks of services and are used to define the actual data being exchanged.Descriptors: These are optional attributes that provide additional information about a characteristic, such as a human-readable description or a unit of measurement. How BLE GATT Works… Read more



The Web Bluetooth module for Angular

For the past few months, I’ve been playing around with the new Web Bluetooth API which is about to ship in Chrome 56 in February 2017. And let me tell you, this new feature just unlocked lots of new possibilities for the Web. As a Web Advocate, I was so excited and couldn’t wait to build an application showing how easy it is to combine Angular and the Web Bluetooth API (even more, with any of the upcoming Web APIs, more on that soon, stay tuned). Let’s meet The Missing Web Bluetooth Module for Angular Application I started then working with my buddy François Beaufort (kudos to him!) to build a demo app, a kind of proof of concept that illustrates how to integrate Web Bluetooth with Angular. After implementing a couple of use cases, I came up with an Angular module which abstracts away all the boilerplate needed to configure the Web Bluetooth API. A Few Disclaimers Web Bluetooth APIs I am going to assume that you’re already familiar with the Web Bluetooth APIs: GATT server, Services, Characteristics…etc. Please make yourself comfortable with this topic before reading the next sections. Here are few resources: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web https://medium.com/@urish/start-building-with-web-bluetooth-and-progressive-web-apps-6534835959a6 Observables I am also assuming that you have some basic knowledge about Observables, Observers and Subjects. Finnish Notation You will notice that some methods ends with a $ symbol. This is some sort of convention in the Observables world that we’ve been using for a while. We may drop this $ symbol in the future because of this blog post. Installing the module You can get this module… Read more



Web Bluetooth Notifications Sample

The Web Bluetooth API lets websites discover and communicate with devices over the Bluetooth 4 wireless standard using the Generic Attribute Profile (GATT). It is currently partially implemented in Android M, Chrome OS, Mac, and Windows 10. This sample illustrates the use of the Web Bluetooth API to start and stop characteristic notifications from a nearby Bluetooth Low Energy Device. You may want to try this demo with the BLE Peripheral Simulator App from the Google Play Store and check out the Notifications (Async Await) sample. var myCharacteristic; function onStartButtonClick() { let serviceUuid = document.querySelector(‘#service’).value; if (serviceUuid.startsWith(‘0x’)) { serviceUuid = parseInt(serviceUuid); } let characteristicUuid = document.querySelector(‘#characteristic’).value; if (characteristicUuid.startsWith(‘0x’)) { characteristicUuid = parseInt(characteristicUuid); } log(‘Requesting Bluetooth Device…’); navigator.bluetooth.requestDevice({filters: [{services: [serviceUuid]}]}) .then(device => { log(‘Connecting to GATT Server…’); return device.gatt.connect(); }) .then(server => { log(‘Getting Service…’); return server.getPrimaryService(serviceUuid); }) .then(service => { log(‘Getting Characteristic…’); return service.getCharacteristic(characteristicUuid); }) .then(characteristic => { myCharacteristic = characteristic; return myCharacteristic.startNotifications().then(_ => { log(‘> Notifications started’); myCharacteristic.addEventListener(‘characteristicvaluechanged’, handleNotifications); }); }) .catch(error => { log(‘Argh! ‘ + error); }); } function onStopButtonClick() { if (myCharacteristic) { myCharacteristic.stopNotifications() .then(_ => { log(‘> Notifications stopped’); myCharacteristic.removeEventListener(‘characteristicvaluechanged’, handleNotifications); }) .catch(error => { log(‘Argh! ‘ + error); }); } } function handleNotifications(event) { let value = event.target.value; let a = []; // Convert raw data bytes to hex values just for the sake of showing something. // In the “real” world, you’d use data.getUint8, data.getUint16 or even // TextDecoder to process raw data bytes. for (let i = 0; i < value.byteLength; i++)… Read more



Publication Survey: Security Considerations For Bluetooth Smart Devices

Bluetooth Smart is an emerging short range wireless technology aimed for low power devices. Bluetooth 4.2 core specification provides various methods to secure the communication between devices and establish trusted connections. This paper describes the design considerations to secure the Bluetooth smart devices. 1. Introduction Bluetooth smart (also known as Bluetooth low energy or BLE) is introduced in the legacy Bluetooth 4.0 specification by Bluetooth special interest group. Bluetooth smart is primarily designed for low power embedded devices with limited computation capabilities. With expeditious growth in the IoT technology, Bluetooth Low Energy Module has become substantiate criterion for the smart devices. Bluetooth specification supports the asymmetrical architecture of the LE devices. Memory and processing power requirements of peripheral devices are much lower than the central. This will be a great advantage in case of single mode – peripheral only devices. Device that acts always as peripheral can be designed with low memory, longer battery life and low power consumption. Low power smart wearable devices available in market such as Bluetooth heart rate monitors, blood pressure monitors, fitness kit, smart watches etc. run on a small coin cell battery for years. 2. Low energy, Low security Like any other wireless technology, BLE is no exception from security threats. While Bluetooth LE beacons bring lots of potential in the IOT design, security threats such as device tracking, eaves dropping, and man in the middle attack are increasing significantly. BLE devices are designed to broadcast MAC, UUID and service information’s at a predefined… Read more



A Simple Guide to Zigbee Wireless Networking

As computer communication professionals, we are well aware of the significance of wireless communication protocols in today’s connected world. Among the numerous wireless protocols available, Zigbee has emerged as a popular choice for low-power, low-data-rate applications. In this blog post, we will delve into the details of the Zigbee protocol, its architecture, and how to implement a Zigbee-based network. What is Zigbee? Zigbee is a low-power, low-data-rate wireless communication protocol based on the IEEE 802.15.4 standard. It operates on the 2.4 GHz frequency band and has a data transfer rate of up to 250 kbps. Zigbee is designed for applications that require low power consumption, low cost, and low complexity, making it an ideal choice for IoT devices, home automation, and industrial control systems. Zigbee Protocol Architecture The Zigbee protocol architecture consists of three layers: the Physical Layer (PHY), the Media Access Control Layer (MAC), and the Application Layer (APL). Physical Layer (PHY): The PHY layer is responsible for transmitting and receiving raw data bits over the wireless channel. It defines the modulation scheme, data rate, and transmission power.Media Access Control Layer (MAC): The MAC layer is responsible for controlling access to the wireless channel, managing data transmission and reception, and providing error detection and correction mechanisms.Application Layer (APL): The APL layer provides services to the application, including data encryption, device management, and network formation. Zigbee Network Topology Zigbee supports three network topologies: Star, Tree, and Mesh. Star Topology: In a star topology, a single device acts as the coordinator,… Read more



Proximity Communication Technologies: A Comprehensive Review

Proximity communication technologies have revolutionized the way devices interact with each other, enabling seamless data transfer and communication over short distances. These technologies have become an essential part of our daily lives, powering a wide range of applications, from wireless keyboards and headsets to mobile payments and smart homes. In this article, we will delve into the world of proximity communication technologies, exploring the principles, applications, and future directions of Bluetooth, Wi-Fi, Near Field Communication (NFC), and other related technologies. Bluetooth Technology Bluetooth is a personal area network (PAN) technology that enables wireless communication between devices over short distances, typically up to 10 meters. Operating in the 2.4 GHz frequency band, Bluetooth devices can transfer data at speeds of up to 720 kbps. Bluetooth technology is widely used in computer peripherals, such as wireless keyboards, mice, and headsets, as well as in mobile devices, such as smartphones and tablets. Bluetooth devices can operate in one of two modes: master or slave. A master device can connect to multiple slave devices, enabling data transfer and control. Bluetooth technology has several advantages, including low power consumption, low cost, and simplicity. However, it also has some limitations, such as limited range and data transfer speed. Wi-Fi Technology Wi-Fi is a local area network (LAN) technology that enables wireless communication between devices over longer distances, typically up to several hundred meters. Operating in the 2.4 GHz and 5 GHz frequency bands, Wi-Fi devices can transfer data at speeds of up to several hundred Mbps…. Read more



Best practices in managing mid-size R&D teams

I have spent several years as a Team Leader (also known as an Engineering Manager), heading up teams of about 4–6 developers from different backgrounds, seniority levels, and abilities. The first time I led a team was during my army service as an officer in the elite 8200 unit. I oversaw a team of brilliant aspiring software engineers and our work revolved around making sure the right information made its way to the right places, at the right time. While being a developer in the army is the dream of many young adults, this dream is usually accompanied by many responsibilities, in addition to those typical army-related duties. Managing people is challenging enough, without having to deal with other “side” distractions; soldiers who are currently on duty the exact moment you discover a bug in production, soldiers who are sick and, therefore, get sent home (also known as “gimelim”), or even soldiers who fulfilled their army duty and moved to work at a high-tech company or started their degrees. While little “blips in the radar” are common among any regular R&D team, it’s important to realize that you can usually ask the relevant person to fix the issue, have them log in from home, or from anywhere else they may be. Dual ownership to the rescue! Having to ‘manage my soldiers’ chores, vacations, sick days, etc. in addition to routine engineering activities, forced me to adopt the first guideline on my best practices list: dual ownership! Let me explain; every… Read more