Thursday, June 18, 2020

How to recover your Amazon account

Case 1: You are being asked to enter an OTP sent to your phone, although you don't have two step/factor authentication/verification, and you have lost access to your phone number or can't receive messages or voice calls where you are, e.g. extraordinary authentication that may occur when you are travelling to other countries where your phone is not working.

Solution: Solution assumes you still have access to the email address associated with your Amazon account. Go here and enter your email address. It will ask you to enter an OTP code that will be sent to your email. Check your email, get the code and enter it; you will then be given the opportunity to change your password AND if needed also the phone number (e.g. new local SIM card or other phone number that does work) associated with your Amazon account.

Case 2: You can still log in to your account but your account has been locked because Amazon thinks you may not be the actual owner of the account.

Solution: Go here and follow the instructions.

Thursday, May 28, 2020

ExecuteFunction won't work with non-button controls in Office Web Add-in manifests

Although  explicitly stated in official Microsoft Office web add-in docs that a function in FunctionFile.js may be called by both a button and a menu item control, it turns out that, at least with the latest Chrome based version of the Edge web control implementing the task pane, only button controls are actually able to invoke functions using the ExecuteFunction add-in manifest clause.

Saturday, April 11, 2020

Switch cameras while recording video on Android

Android, as of this post in April 2020, does not natively support flipping camera from back to front while recording a video. Some chat apps can do it though - Instagram and Snapchat for instance certainly WhatsApp and Skype during video calls. So, how do they do it?

Apparently they do it by screen grabbing a video preview they create in memory - the preview is much like what you see on your screen (minus the overlaid camera controls) when previewing and switching cams on your Android's native camera app. So they take that preview and either record it locally or transmit it to wherever the video is going online, e.g. an Instagram post or the person you are video chatting with.

But what if you want to do just that, i.e. create your own video while switching between cams on both sides of your phone, without being confined by the intricacies and limiting use cases of each of the aforementioned apps?

Well, all you have to do is kinda emulate what these apps do. A way to easily do that is:

  1. Get a good screen recorder Android app (it records a video of your phone screen being used). There's plenty of those on Play Store.
  2. Get an alternative Android cam app that allows all camera controls to be hidden. One good such app is "Open Camera" which is also available on the Play Store. Just use it's "Immersive Mode" to have the controls disappear after a couple of seconds of not using them.
Have fun!

Sunday, November 24, 2019

How to defeat Chrome CORB for XHR access to 127.0.0.1

How to defeat CORB (Cross-Origin Read Blocking) and allow javascript to access local web server running on localhost (127.0.0.1) over XHR:

  1. Select a random domain and point it to 127.0.0.1 in your HOSTS file
  2. Direct your XHR connections to that domain instead of 127.0.0.1
  3. You will need to enable SSL/TLS on your local web server.
    • If you are coding your own sockets server in C here is a guide on how to SSL enable them.
    • Or you can base your simple local server on a light web server that supports SSL/TLS out of the box: abyssws I chose this faster solution and had it serve files dynamically dumped out by my existing logic to specific doc paths under the server's root.
  4. You will need to make sure that your local server's responses always include this CORS header: Access-Control-Allow-Origin: *

It should be working now.

Tuesday, September 24, 2019

How to sniff packets in a WiFi network

In wired Ethernet LANs sniffing packets meant for other computers in the network, if on a Linux based system, is as simple as setting your local network interface to promiscuous mode and running tcpdump.

WiFi complicates things as each computer connected to the hotspot holds a wireless WPA session encrypted to a different session key and most hotspots (at least today) only send Ethernet frames meant for a specific MAC address over the specific session mapped to the device to which that MAC address belongs.

Therefore, one is left with at least three possible ways to do promiscuous sniffing on a WiFi network:

  1. MAC spoofing. The MAC address of a Linux box can be easily spoofed using standard utilities like ifconfig but there are also specialized utilities like macchange. MAC spoofing is very fragile and timing prone and although you can hijack a few packets using it you run a high risk of killing the Internet connection of the target device you are spoofing.
  2. Running a rogue (secondary) DHCP server on your Linux box (easily installed and configured on a Linux box) and then performing a DHCP poisoning exploit on the legitimate DHCP server using an easily available and installable utility like yersinia. Doing this you eventually end up with the all of the local network's devices registering with the DHCP server under your control and this way you get to tell them which DNS server and Internet gateway to use. If all you want to do is monitor their DNS requests so you know what sites/services they use, you can simply tell them to use your local BIND instance (which must have query logging turned on) as their DNS server. However, some devices may have their DNS servers hardcoded or you may want to intercept the communication packet themselves; in this case you simply need to set the gateway to your own IP address (which still has as gateway the legit gateway) and turn on packet forwarding like this: sysctl -w net.ipv4.ip_forward=1 After that, using tcpdump and filtering for the IP address of the target device will give you access to the full packet stream to/from that device.
  3. There is an easier way to have the exact same results as with method 2 right above. You can use the arpspoof utility (easily installable by installing the dsniff package) to pretend you are the gateway. While arpspoof is ARP spoofing the target machine will send you its packets thinking you are the gateway; you need to forward them by using the same command as above: sysctl -w net.ipv4.ip_forward=1 Now you also have access to the target device's packet stream. This method also bears some risk of breaking the Internet connection of the target device, so it's best to keep your spoofing as short and targeted as possible.
Methods 2 and 3 are versions of a gateway MITM (Man In The Middle) attack.

Next chapter: SSL/TLS MITM attacks. Privacy goes bye-bye.