2016-08-25

RPS provisioning with yealink

It looks like awareness of security problems with yealink (and many other manufacturers for that matter) rised at the end of 2013:
https://freeswitch.org/raising-awareness-about-secure-phone-provisioning/
http://www.slideshare.net/sleepycal/auto-provisioning-sucks
Basically, if your phone can fetch configuration from publicly available server so can anybody else. There are no private certificates used, often no encryption of any kind at all. And what about yealink AES encryption? At first session phone fetches user-defined AES key for configuration file (y000000000000.cfg). This key is encrypted with AES and common key inside separate file (y000000000000_Security.enc).

Whiskey Tango Foxtrot

It shouldn't take long to recover common AES key either from windows/linux encryption tools provided by yealink or from phone firmware itself. Once it is known, AES key for configuration can be decrypted, then configuration can be decrypted (with operator configuration, including password) leading to toll frauds.

I know you're too lazy, I am too. Fear not, as someone found common AES key already:

# Yealink's encryption tool generates a "random" key using characters
# [a-zA-Z0-9].  It uses this key directly as a stream of bytes to
# encrypt the configuration file with AES-128-ECB.  Then it encrypts
# this key with a "common" key distributed as part of the firmware and
# the encryption tool and writes the result to a second file, also
# using AES-128-ECB.

encrypt () {
 local key="$1"
  openssl enc -aes-128-ecb -nopad \
    -K $(printf "$key" | xxd -p)
}

decrypt () {
  local key="$1"
  openssl enc -aes-128-ecb -d -nopad \
    -K $(printf "$key" | xxd -p)
}

encrypt_key () { encrypt 'EKs35XacP6eybA25'; }
decrypt_key () { decrypt 'EKs35XacP6eybA25'; }
encrypt_cfg () { encrypt "$1"; }
decrypt_cfg () { decrypt "$1"; }

test_lib () {
  printf "Test that key decryption/encryption produces identical results..."
  (decrypt_key < test/test_Security.enc | encrypt_key | diff test/test_Security.enc -) \
    && printf "Success\n" || printf "Failure\n"
  printf "Test that we produce identical encrypted configs..."
  local key=$(decrypt_key < test/test_Security.enc)
  (decrypt_cfg $key < test/test.cfg | encrypt_cfg $key | diff test/test.cfg -) \
    && printf "Success\n" || printf "Failure\n"
}



Source: https://github.com/traviscross/yealink-confenc.

2016-07-09

FreeSWITCH on Windows - first impression

Few notes from compiling and running FreeSWITCH on Windows

In the hope of getting help with some faxing/T.30 problems from great VS debugger I've built FreeSWITCH 1.6.8 for Windows. So far I can say that Windows version is well prepared as contrary to building under Linux (tested Ubuntu 14 LTS) it works out of the box (i.e. without solving dependency puzzle).

From what I remember some earlier FreeSWITCH versions supported multiple VS versions or at least contained project files for older and relatively lightweight VS2008. With FS 1.6.8 only VS2015 is supported. Although this IDE still has free versions I definitely dislike that Microsoft forces installation of Visual Basic (which I have absolutely no intent to use) while making C++ optional. With all that .net baggage be prepared for 9GB disk usage (+ few extra hundreds for IE 10/11 if you don't have it with Windows 7) for VS2015 Community.

FreeSWITCH groups multiple project files. Although it seemed to me that building just FreeSwitchConsole project and mod_sofia from Endpoints group would create minimal functional set - it you don't build other modules, at least one that you would in /conf/autoload_conf/modules.conf.xml after building basic executable you'll gonna have bad time... With XML dialplan files ignored you won't be able making basic calls.

Configuring and debugging requires lot of try-and-error for me thus I've opted to completely disable UPnP that adds significant delay to application startup. Modified switch_nat.c:
#if 0
    if (!nat_globals.nat_type) {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPnP\n");
        init_upnp();
    }
#endif


To add SIP operator create new configuration file in conf/sip_profiles/external/<operator_name>.xml.
To check operator status use
sofia status
or
sofia status gateway <sip_provider>
"REGED" means registered.

To add internal SIP extension (softphones, desk phones to register) create configuration files in conf/directory/default/. Default configuration contains already extensions with numbers 1000 - 1019. Edit vars.xml file to change default password (from 1234) for all these extension, I think they are disabled until it is done as log says:
CRIT WARNING WARNING WARNING WARNING WARNING WARNING
DESTINATION_OUT_OF_ORDER
Open vars.xml and change the default_password

To check internal extensions status use list_users command.

Other useful commands:
  • shutdown or ... = quit
  • show calls
  • reloadxml
  • sofia global siptrace on - log RX/TX SIP messages

2016-04-01

ELEKTRONIKA B6-03

Small flashlight powered by 3 NiCd button cells, rechargeable directly from mains with simple inductorless charger. Made in (late) USSR, probably in the early 90s. Surprisingly reliable and very economical in use.
After cleaning cell contacts (residue in a form of crystal needles, most likely rich in cadmium) it still charges and works.


2016-01-26

Manta MID721QC

Very cheap 7" tablet distributed probably under dozen different brands:
  • Allwinner A33, quad-core A7 running at 1.2GHz with Mali400 graphics
  • 7" 800x480 display with poor viewing angles (I can say that just viewing it in vertical position can give strange impression as left and right eye see slightly different images) and capacitive multitouch
  • WiFi
  • VGA front camera
  • accelerometer
  • Android 4.4.2
  • 512 MB RAM, 4 GB Flash
  • microphone and (poor) speaker
  • micro SD slot
  • roughly 4 hours on battery (WiFi, internet), up to 6 hours (WiFi disabled, minimum brightness, PDF reader)
 I believe this tablet had factory installed trojan - at least I don't think I could infect it just in an hour and such "accidents" are not rare. This must have pretty fresh mutations as VirusTotal says that file was first scanned on 2015-12-12 (https://www.virustotal.com/en/file/401a320b23213932b222cc0afb8c69acb12efb9cbeb1884f0873a581d0192f96/analysis/)
Trojan was embedded in GoogleQuickSearchBox.apk (system application) and required rooting to remove. I believe it was responsible for opening fishy "antivirus" site once or twice and it also tried to install "WiFi Booster" (another malware?).
Case is easy to open with bare hands.
PCB markings: AL-Ax3-Q8-V1.1 2015-01-21
Serial number from sticker vanished just after few hours of light use; nice trick to void varranty
2200mAh cell (still lot of spare space), main board
357090 (3.5mm x 70mm x 90mm) 2200mAh protected cell. It looks like 3575100 (3000-3500mAh) should fit also.
unpopulated: vibration motor?

ESP8089 WiFi (close cousin of ESP8266); FBNL83A51K3BAAWP 32Gb NAND from Spectek

2x K4B2G0846 2Gb DDR3

LPA4890CM audio amplifier; up to 350 mW output power in this configuration, in reality probably 50 mW, might be worth tweaking

'7660 voltage converter (backlight power supply?)

AXP223 power manager



miniature camera (VGA)

8 ohm speaker with no markings
It looks like this tablet has now included in Linux mainline: http://linux-sunxi.org/AL-AX3-Q8

2016-01-21

Lenovo T500

Few notes on Lenovo T500 - in comparison with R500

  • slightly lighter and tinner, yet simingly on pair with durability to R500
  • LCD unit cover has rubbery finish; it feels nicer than hard plastic in R500 but is more susceptible to scratches
  • palmrest, keyboard and bevel above keyboard is virtually identical - one difference is speakers placement which are placed at the top instead of at the sides of keyboard; if feels little more solid under pressure but on the other hand keyboard seems to have less support in the top right corner
  • bottom part is made of metal instead of plastic; while R500 was already very solid it takes it one step further and from my perspective removes small problem with R500 - bottom plastic was easy to damage if using too much torque for the screws holding e.g. palmrest
  • it's easier to find unit with mid/top specification (Penryn, BT, camera) as T500 probably was not even sold with Merom
  • 1280x800 screen is no better than in R500 (quite low viewing angles), although it comes with LED backlight this time
  • same as with R500 it works great with Linux - in fact causing less problems (and these are common) that Windows
    • I had problems enabling bluetooth on Windows - it probably requires installing lenovo bloatware but it worked out of the box with Linux and stayed enabled when switching back to Windows
    • for unknown reason Conexant Audio 20561 muted speaker output (headphone output was fine) under Windows 7 while leaving no clue (i.e. OS did not saw output as muted); pressing Vol+ key on keyboard and/or upgrading driver helps for it although headphone output disappeared from available volume controls replaced by SPDIF (not a big loss)
  • it uses Ultrabay Slim instead of Ultrabay Enhanced - your DVD drive from R500 may not fit into T500

  •  same as R500 it is NOT spill resistant; yes, there are spill drains at the bottom but there is no way in hell water will flow through them instead of frying mainboard
    • there are no spill drains on the keyboard (at least not on mine - neither with R500 nor T500)
    • can you even spot drain holes looking from top?
    • spilled water can flow freely through gaps between palmrest , top bevel and keyboard
  • LCD unit is connected with flex connector instead of bunch of wires
  •  apparently different keyboards (despite being replaceable) can have slightly different construction

Notes from (almost) replacing fan

As original fan started making noises - especially when using in non-flat position - I've bought cheapest replacement. T500 seems to be starting fan even under light loads (CPU temperature less than 50C) but fan is very quiet then. This is original fan, MCF-224PAM05, it seemed that noised were caused by loose bearing:
And this is el cheapo replacement I bought on ebay for $2.69 with direct shipping from China, MCF-217PAM05, advertised as fitting ThinkPad T61 T61P R61 W500 T500 T400:
Both are using 3-pin connector. Although they seem similar new one did not fit too well - it was slightly higher and even after replacing ventilator with "original" (more fins but slightly lower profile) it required some bending (for its credit: original one apparently was also slightly bent). Apart from that its shape is slightly different, so piece of tape was required for sealing. Worst part is, new one was pretty loud right from the start and noises did not disappeared after a weak. Strangely, after switching back to original fan noises disappeared - perhaps cleaning/reassembling was enough.
More photos: