Tuesday, May 7, 2013

FreedomPop Overdrive: first thoughts

Roughly two weeks ago I received an email that stated that FreedomPop coverage is now available in my area. I've been curious about this company for a while as they offer "free" internet access using several 3G/4G devices. Until recently they only offered 4G connectivity using the ClearWire 4G network that is only available in larger cities (and here in the bay area ClearWire coverage ends roughly in Berkeley, 1 mile short from our home). Since a couple of weeks (say April 2013) FreedomPop peers with Sprint and offers combined 3G/4G coverage.

Upon receiving that email I immediately bought the device (for 39.90$ incl. shipping) and was eagerly waiting for the delivery (which in the end took >10 days). The first trail month of free 2GB of data started immediately upon buying the device and there are only 19 days left now that the device finally arrived. The set-up process is a bit weird as well as FreedomPop offers a feature to find friends with whom you can share surplus data. In addition, you get a free 50MB of data per month for every friend that you add. Naturally there are lists on the internet where you can find such 'friends'. You only have to import them to your gmail address book which in turn is forwarded to FreedomPop. Unfortunately when you search for friends all of them will get a SPAM email from FreedomPop as you leak all your address book to the company. I tried to be clever and removed all email addresses from one of my spare gmail accounts but apparently I forgot to delete some of the 'recently used' addresses and leaked those to FreedomPop (sorry again friends!).

When the device finally arrived I was very eager to get the service up and running. The setup is a bit complicated as you have to start up the WiFi hotspot first and wait until it is able to connect to at least a 3G network. With a quick double-tap on the power button you can display the SSID and the temporary password on the device's screen (it's not 12345 or password as a quick glimpse through the quickstart guide might suggest). When logging in you can then switch to the admin mode using 'password' and I had to execute both "Update 3G PRL" and "Update 3G Profile" until the overdrive was able to connect to 3G. Before the update the device only showed an "Error 67, can not connect to 3G" error message.

Since the update the hotspot has been running flawlessly and a quick speed test shows 0.51Mbps down and 0.39Mbps up which is not too bad for 3G at 10pm. Now fingers crossed for my next conference trip or business trip to hotels where WiFi costs like 20$ per day.

Monday, March 11, 2013

WarGames in memory: shall we play a game?

Memory corruption (e.g., buffer overflows, random writes, memory allocation bugs, or uncontrolled format strings) is one of the oldest and most exploited problems in computer science. Low-level languages like C or C++ trade memory safety and type safety for performance: the compiler adds no bound checks and no type checks. The programmer itself is responsible for memory management and type casting which can lead to serious exploitable bugs. Prerequisites for a successful memory corruption are (i) that a pointer is pushed out of bounds (i.e., by iterating over the end of a buffer) or that a pointer becomes dangling (i.e., by freeing the object that a pointer points to) and (ii) that the attacker controls the value written to the out of bounds pointer, e.g., directly through an assignment or indirectly through some management function.

According to academia "buffer overflows are a solved problem" (quote paraphrased according to a member of the panel discussion about system security at INFOCOM'99 in New York). This answer is partially true as there are safe languages that provide memory safety and type safety like, e.g., Java or C#. These languages achieve memory safety by using automatic memory allocation and de-allocation (garbage collection) and adding bound checks to all buffers and structures. In addition, they add a strict type system that disallows casting between mutually exclusive types (e.g., from one struct to another completely disjoint struct).

Figure 1: development of different classes of memory corruption attacks; based on CVE data.

On the other hand if we look at the development of memory corruption attacks since 1999 (Figure 1) we see that the number of these attacks rose until 2007 and is on an all-time high. So we can ask ourselves: what went wrong? On one hand there are new attack vectors (e.g., code-reuse attacks like Return Oriented Programming [39]) and safe languages have (i) too much overhead, (ii) too much latency (languages like Java do not support realtime execution because of stop-the-world garbage collection), (iii) missing support for legacy code, (iv) increased complexity, and (v) missing features like direct memory access for low-level applications.

The goal of this post is to explain different forms of memory corruption attacks and possible defenses that are deployed for current software systems. We will see that attack vectors and defense mechanisms are closely related and through this relation they evolve alongside. This article extends existing surveys and summaries [20, 36] by (i) a study that looks at the symbiosis between attacks and defenses and (ii) an analysis that explains why certain defense mechanisms are used in practice while other mechanisms never see wide adoption.

Attack model

An attacker with restricted privileges forces escalation, e.g., a remote user escalates to a local user account or a local user escalates to a privileged account. Our attack model assumes a white-box approach: the attacker knows both the source code and the binary of the application (so the attacker can execute binary analysis, evaluate the offsets of structs, and recover partial runtime information). A successful attack redirects the control flow to an alternate location and either injected code is executed or alternate data is used during the execution of existing code.

Evolution of attack vectors and defenses

Memory corruption attacks

A memory corruption attack relies on two properties: (i) a live pointer points to illegal data and (ii) said pointer is read or written by the application. An attacker can directly force the pointer out of bounds by exploiting a buffer overflow or underflow that writes across the bounds of a buffer or indirectly by messing with the object that the pointer points to: if this objects is freed or recycled then the pointer is dangling and points to illegal data.

In reality an attacker breaks these two steps into three steps:
  1. Preparation: first the pointer is redirected to an illegal memory location through a spatial bug (the pointer is forced out of bounds) or a temporal bug (making the pointer dangling). Possible attack vectors for the first step are buffer overflows/underflows on the stack or on the heap, integer overflows and underflows, format string exploits, double free, and other memory corruption.
  2. Setup: the attacker uses regular control flow of the application to dereference and write to the pointer. This second step exploits the spatial or temporal memory bug to disable code pointer integrity (all function pointer in the application point to correct and valid code locations), code integrity (the executable code of the application is unchanged), control-flow integrity (the control-flow of the application follows the original programmer-intended pattern), data-integrity (the data of the application is only changed by valid computation), or data-flow integrity (the data-flow in the application follows the intended pattern). A correct execution of an application relies on all of the before mentioned concepts to be enforced at all times. At this point the attacker has control over some data structures and possible targets are overwriting the return instruction pointer (RIP) on the stack, overwriting a function pointer (in the vtable, GOT, or in the .dtor section), forcing an exception (e.g., a NULL pointer dereference), or overwriting heap management data structures.
  3. Execution: finally the control flow is redirected to a location that is controlled by the attacker. The attacker uses either code corruption (new executable code is injected and/or existing code is changed and control-flow is redirected to the injected code), code-reuse attack (existing code is reused in an unintended way), a data-only attack (only the data of the application is changed to adapt the outcome of some computation), or information leakage (internal state is leaked to the attacker) to execute the malicious behavior.

Commonly used attack techniques

To execute malicious code an attacker usually uses one of three techniques: code injection, code reuse, or command injection. Each technique has its advantages and disadvantages and we will discuss them in detail.

Code injection is the oldest technique that achieves code execution. This technique attacks code integrity and injects executable code into data regions. Depending on flags in the page table any data on a memory page may be interpreted as machine code and executed. Prerequisites for this attack are (i) an executable memory area and a known address of a buffer to redirect control to, (ii) partial control of the contents of the buffer in the executable memory area, and (iii) a redirectable control flow to that partially controlled area of the buffer. This technique is nowadays no longer a problem due to increased hardware protection and non-executable memory pages (post 2006).

Code reuse is considered the response to the increased hardware protection against code injection. This technique circumvents control-flow integrity and/or code pointer integrity and reuses existing executable code with alternate data. So called gadgets (short sequences of instructions that usually pop/push registers and execute some computation followed by an indirect control flow transfer) are used to execute a set of prepared invocation frames. Prerequisites for this attack are (i) known addresses of necessary gadgets, (ii) a partially attacker-controlled buffer, and (iii) a redirectable control-flow transfer to the gadget that uses the first invocation frame. Protecting against this technique on a low level is very hard as control-flow integrity relies on checks and validity of all indirect control flow transfers.

Command injection is a third technique that prepares data that is passed to another application or to the kernel (e.g., SQL injection). The technique relies on the fact that unexepcted and unsanitized data is forwarded which leads to unexpected behavior. This technique attacks data integrity and/or data-flow integrity of the application. Prerequisite for this attack is only a missing or faulty sanity check. It is hard to protect against this attack because the source application needs to know about the kind of data the target expects and the context in which the target expects the data.

Defenses and their limitations

A multitude of different defenses have been proposed and discussed but only three defenses are actually used in practice: Data Execution Prevention (DEP), Address Space Layout Randomization (ASLR), and Canaries. None of the defenses is complete and each defense has particular weaknesses and limitations. In combination they offer complete protection against code injection attacks partial protection against code reuse attacks. In general, it can be said that the available defenses merely raise the bar against specific attacks but do not solve the problem of potential memory corruption.

Data Execution Prevention (DEP) prevents applications (and kernels) from code injection attacks. Newer processor add an additional flag (an eXecutable bit) to every entry in the page table. Each page has three bits: Readable (page is readable if set), Writable (page is writable if set), and eXecutable (page contains code that will be executed if control flow branches to this location). Before the eXecutable bit every page was automatically executable and there was no separation between code and data of an application. DEP is a technique that ensures that any page is either Writable xor eXecutable. This scheme protects against code injection attacks by ensuring that no new code can be injected after the application has started and all the code is loaded from disk. A drawback of DEP is that dynamic code generation for, e.g., just-in-time compilation, is not supported. DEP only protects against code injection attacks, all code reuse and other forms of attacks are still possible.

Address Space Layout Randomization (ASLR) is a probabilistic protection that randomizes the locations of individual memory segments (like code, heap, stack, data, memory mapped regions, or libraries). ASLR is an extension of both the operating system (as memory management system calls return random areas) and the loader that needs to load and resolve code at random locations. Hand written exploits often use absolute addressing and need to know the exact location of code they want to branch to or data they want to reuse. Due to random code and data location these attacks are no longer successful. Unfortunately this attack is prone to information leaks: if an attacker is able to extract the locations of specific buffers he/she can use this knowledge for an exploit if the program did not crash. ASLR basically turns a one-shot attack (pwnage on first try) into a two-shot attack (information leak first, pwnage second). A second drawback of ASLR is that some regions remain static upon every run (e.g., on Linux the main executable is often not compiled as position independent executable (PIE) and remains static for every run (including GOT tables, data regions, and code regions); so an attacker can use this static regions to just use a Return Oriented Programming (ROP) attack or more general a code reuse attack. An alternative to two-shot attacks is, e.g., heap spraying. Heap spraying uses the limited number of randomizable bits for a 32-bit memory image and fills the complete heap with copies of NOP slides and the exploit. When the exploit executes the chances are good that the exploit will hit one of the NOP slides and transfer control into the exploit (that is replicated millions of times on the heap).

Comparing PIE with non-PIE executables (Figure 2) [33] using the SPEC CPU2006 benchmarks shows that there is a performance difference of up to 25%. PIE executables reserve a register as a code pointer (due to the randomized locations indirect control flow transfer - indirect call or indirect jump - instructions need to a reference to know where to transfer control to). Due to the additional register usage register pressure increases which slows down overall execution. In reality few programs are compiled as PIE [43].

Figure 2: performance overhead for -fPIE on a 32-bit x86 system.

Canaries are a probabilistic protection against buffer overflows. The compiler places canary values (4 byte for x86 or 8 byte for x64) adjacent to buffers on the stack or on the heap. After every buffer modification the compiler adds an additional check to ensure that the canary is still intact, e.g., the compiler will add a check after a loop that copies values into a buffer. If the canary is replaced with some other value then the check code terminates the application. Canaries have several drawbacks: first, they only protect against continuous writes (i.e., buffer overflows) and not against any other form of direct overwrite. Second, they do not protect against data reads like information leaks. And third, they are, like ASLR, prone to information leaks. Only one random canary is generated for the execution of an application.

Limitations of defenses: DEP gives us code integrity and protects against code injection, but not against any other form of attacks. DEP relies on a hardware extension of the page table. Both canaries and ASLR are probabilistic and prone to information leaks. A one shot attack becomes a two shot attack. In addition, both canaries and ASLR are not free and there are some performance issues or data-layout issues.

The status of current protection is very limited. Current systems have complete protection against code integrity attacks through DEP which is in widespread use. There is limited protection for code pointer integrity and control-flow integrity through probabilistic protections like PointGuard [1], canaries and ASLR. So the code and control flow of an application is (at least partially) protected. What is missing is complete data protecion: there is no data integrity or data-flow integrity, although there are some proposals: WIT [4] using a points-to analysis for data integrity, and DFI using data encryption for data-flow integrity.

An interesting thing to note is that academia came up with many protection mechanisms but they were only used in practice when the burden of the exploits in the wild became too common and the attack techniques became widely known. Stack-based ASLR and canaries where introduced to protect against buffer overflows and code injection attacks on the stack but later extended to the heap and code regions to protect against code reuse attacks as well. DEP is used as an absolute protection against code injection attacks. This arms race between attackers and defenders is interesting to see and a well-equipped attacker has plenty of opportunities to exploit defense mechanisms on current systems. A second factor is that defense mechanisms always bring up a trade-off between available protection, legacy features that are no longer supported and possible performance impact. New defenses are therefore only introduced if the burden of the attacks is too high and too common.

Timeline

The following timeline shows how attacks and defenses developed alongside:
                              Attack  Year  Defense
               Smashing the stack [5] 1996
                      ret-2-libc [18] 1997
                                      1997 StackGuard [17]
        Heap overflow techniques [14] 1999
         Frame pointer overwrite [25] 1999
             Bypassing StackGuard and 2000
                     StackShield [11]
              Format string bugs [29] 2000
                                      2000 libsafe and libverify protect library
                                           functions [6]
                                      2001 ASLR [30]
                                      2001 ProPolice (stack canaries) are
                                           introduced [23]
                                      2001 FormatGuard [15]
    Heap exploits and SEH frames [22] 2002
                                      2002 Visual C++7 adds stack cookies
               Integer overflows [19] 2002
                                      2002 PaX adds W^X using segments and
                                           Kernel ASLR [42]
                                      2003 Visual Studio 2003: SAFESEH
                                      2004 Windows XP2: DEP: RW heap and stack
  ASLR only has 10bit randomness [37] 2004
                   Heap Spraying [38] 2004
                                      2005 Visual Studio 2005: stack cookies
                                           extended with shadow argument copies
                                      2006 PaX protects kernel against NULL
                                           dereferences
                                      2006 Ubuntu 6.06 adds stack and heap ASLR
         Advanced ret-2-libc [28, 36] 2007
          Double free vulnerabilities 2007
                                      2007 Ubuntu adds AppArmor [8]
                                      2007 Windows Vista implements full ASLR
                                           and heap hardening
                  ROP introduced [36] 2007
                                      2008 Ubuntu 8.04 adds pointer obfuscation
                                           for glibc and exec, brk, and
                                           VDSO ASLR [41]
                                      2008 Ubuntu 8.10 builds some apps with
                                           PIE, fortify source, relro [41]
                                      2009 Nozzle: heap spraying [35]
                                      2009 Ubuntu 9.04 implements BIND NOW and
                                           0-address protection [41]
                                      2009 Ubuntu 9.10 implements NX [41]
Memory management vulnerabilities [9] 2010
      New format string exploits [34] 2010

Failed defenses

Many defense mechanisms have been researched and proposed but none of them have seen widespread use except ASLR, DEP, and Canaries. The other defenses failed out of one of the following reasons: (i) too much overhead, (ii) missing programming features, or (iii) no support for legacy code.

Too much overhead: as we see for ASLR (active for libraries, disabled for executables) the overhead that is tolerated must be less than 10% and must result in reasonable additional security guarantees. Other proposals that result in higher overhead or lower guarantees did not see widespread use next to the paper where they were published. ISA randomization [25, 7, 42] implements code integrity by randomizing the encoding of individual instructions but results in intolerable 2-3x overhead; PointGuard [1] protects function pointers using an encoding; data-flow integrity tracks the data of an application but results in 2-10x overhead; software-based fault isolation sandboxes [27, 2, 3, 34, 46] implement code and code pointer integrity by verifying all code before execution and result in 1.2x to 2x overhead. There are many other solutions in this category but we see that each solution solves one specific problem at too high a price.

Missing programming features: several proposed defense mechanisms implement a security guarantee by removing specific flexibility in code, data, or the original programming language. Many compiler-based security guarantees like control-flow integrity [1, 21] or data space randomization [4] rely on full program analysis where all code must be compiled and analyzed at the same time. This requirement removes the possibility for modularity (i.e., libraries) and requires that all code is loaded statically. Other features like code diversity or ILR make debugging of applications harder.

No support for legacy code: missing support for legacy code [28] is another problem for many failed defense mechanisms. Is is generally not feasible to rewrite all libraries or applications to add a new security guarantees. A large legacy code base in an existing language must still be supported with the new security features. It is OK to change limited aspects in the runtime system (e.g., ASLR, DEP) or during the compilation process (e.g., adding stack canaries in the data layout) but it is hard to add completely new features (e.g., annotations, rewriting the application in a new language).

Conclusion

Studying the existing defense mechanisms we see that three factors are key for adoption: (i) pressing need through (new) attack vectors, (ii) low overhead for the security solution, and (iii) compatibility to legacy code and legacy features. Only if there exists a clear migration path then the new defense mechanism will be adopted. The WarGames in memory will continue if the security community plays the reactive game. For defenses probabilistic mechanisms only raise the bar but they do not offer a solution. There is no reasonable defense mechanism that supports complete program integrity by combining (i) code integrity, (ii) low overhead control-flow integrity, and (iii) data-flow integrity. Until such a solution exists the war in memory continues and the existing exploit techniques will be used for fun and profit.

References

[1] Abadi, M., Budiu, M., Erlingsson, U., and Ligatti, J. Control-flow integrity. In CCS'05.

[2] Acharya, A., and Raje, M. MAPbox: using parameterized behavior classes to confine untrusted applications. In SSYM'00: Proc. 9th Conf. USENIX Security Symp. (2000), pp. 1--17.

[3] Aggarwal, A., and Jalote, P. Monitoring the security health of software systems. In ISSRE'06: 17th Int'l Symp. Software Reliability Engineering (nov. 2006), pp. 146 --158.

[4] Akritidis, P., Cadar, C., Raiciu, C., Costa, M., and Castro, M. Preventing memory error exploits with WIT. In SP'08: Proc. 2008 IEEE Symposium on Security and Privacy (2008), pp. 263--277.

[5] Aleph1. Smashing the stack for fun and profit. Phrack 7, 49 (Nov. 1996).

[6] Baratloo, A., Singh, N., and Tsai, T. Transparent run-time defense against stack smashing attacks. In Proc. Usenix ATC (2000), pp. 251--262.

[7] Barrantes, E. G., Ackley, D. H., Forrest, S., and Stefanovi, D. Randomized instruction set emulation. ACM Transactions on Information System Security 8 (2005), 3--40.

[8] Bauer, M. Paranoid penguin: an introduction to Novell AppArmor. Linux J. 2006, 148 (2006), 13.

[9] blackngel. The house of lore: Reloaded. Phrack 14, 67 (Nov. 2010).

[10] Bletsch, T., Jiang, X., Freeh, V. W., and Liang, Z. Jump-oriented programming: a new class of code-reuse attack. In ASIACCS'11: Proc. 6th ACM Symp. on Information, Computer and Communications Security (2011), pp. 30--40.

[11] Bulba, and Kil3r. Bypassing stackguard and stackshield. Phrack 10, 56 (Nov. 2000).

[12] Checkoway, S., Davi, L., Dmitrienko, A., Sadeghi, A.-R., Shacham, H., and Winandy, M. Return-oriented programming without returns. In CCS'10: Proceedings of CCS 2010 (2010), A. Keromytis and V. Shmatikov, Eds., ACM Press, pp. 559--572.

[13] Chen, P., Xing, X., Mao, B., Xie, L., Shen, X., and Yin, X. Automatic construction of jump-oriented programming shellcode (on the x86). In ASIACCS'11: Proc. 6th ACM Symp. on Information, Computer and Communications Security (2011), ACM, pp. 20--29.

[14] Conover, M.w00w00 on heap overflows.

[15] Cowan, C., Barringer, M., Beattie, S., Kroah-Hartman, G., Frantzen, M., and Lokier, J. Formatguard: automatic protection from printf format string vulnerabilities. In SSYM'01: Proc. 10th USENIX Security Symp. (2001).

[16] Cowan, C., Beattie, S., Johansen, J., and Wagle, P. PointguardTM: protecting pointers from buffer overflow vulnerabilities. In SSYM'03: Proc. 12th USENIX Security Symp. (2003).

[17] Cowan, C., Pu, C., Maier, D., Hintony, H., Walpole, J., Bakke, P., Beattie, S., Grier, A., Wagle, P., and Zhang, Q. StackGuard: automatic adaptive detection and prevention of buffer-overflow attacks. In SSYM'98: Proc. 7th USENIX Security Symp. (1998).

[18] Designer, S. Return intolibc.

[19] Dowd, M., Spencer, C., Metha, N., Herath, N., and Flake, H. Professional source code auditing, 2002.

[20] Erlingsson, U. Low-level software security: Attacks and defenses. FOSAD'07: Foundations of security analysis and design (2007), 92--134.

[21] Erlingsson, U., Abadi, M., Vrable, M., Budiu, M., and Necula, G. C. XFI: Software guards for system address spaces. In OSDI'06.

[22] Flake, H. Third generation exploitation, 2002.

[23] Haas, P. Advanced format string attacks, DEFCON 18 2010.

[24] Hiroaki, E., and Kunikazu, Y. ProPolice: Improved stack-smashing attack detection. IPSJ SIG Notes (2001), 181--188.

[25] Kc, G. S., Keromytis, A. D., and Prevelakis, V. Countering code-injection attacks with instruction-set randomization. In CCS'03: Proc. 10th Conf. on Computer and Communications Security (2003), pp. 272--280.

[26] klog. The frame pointer overwrite. Phrack 9, 55 (Nov. 1999).

[27] McCamant, S., and Morrisett, G. Evaluating SFI for a CISC architecture. In SSYM'06.

[28] Necula, G., Condit, J., Harren, M., McPeak, S., and Weimer, W. CCured: Type-safe retrofitting of legacy software. vol. 27, ACM, pp. 477--526.

[29] Nergal. The advanced return-into-lib(c) exploits. Phrack 11, 58 (Nov. 2007).

[30] Newsham, T. Format string attacks, 2000.

[31] OWASP. Definition of format string attacks.

[32] PaX-Team. PaX ASLR (Address Space Layout Randomization), 2003.

[33] Payer, M. Too much pie is bad for performance. 2012.

[34] Payer, M., and Gross, T. R. Fine-grained user-space security throughvirtualization. In VEE'11.

[35] Payer, M., and Gross, T. R. String oriented programming: When ASLR is notenough. In Proc. 2nd Program Protection and Reverse Engineering Workshop (2013).

[36] Pincus, J., and Baker, B. Beyond stack smashing: Recent advances in exploiting buffer overruns. IEEE Security and Privacy 2 (2004), 20--27.

[37] Planet, C. A eulogy for format strings. Phrack 14, 67 (2010).

[38] Ratanaworabhan, P., Livshits, B., and Zorn, B. Nozzle: A defense against heap-spraying code injection attacks. In Proceedings of the Usenix Security Symposium (Aug. 2009).

[39] Shacham, H. The geometry of innocent flesh on the bone: Return-into-libc without function calls (on the x86). In CCS'07: Proc. 14th Conf. on Computer and Communications Security (2007), pp. 552--561.

[40] Shacham, H., Page, M., Pfaff, B., Goh, E.-J., Modadugu, N., and Boneh, D. On the effectiveness of address-space randomization. In CCS'04: Proc. 11th Conf. Computer and Communications Security (2004), pp. 298--307.

[41] SkyLined. Internet explorer iframe src&name parameter bof remotecompromise, 2004.

[42] Sovarel, A. N., Evans, D., and Paul, N. Where's the FEEB? the effectiveness of instruction set randomization. In SSYM'05: Proc. 14th Conf. on USENIX Security Symposium (2005).

[43] List of Ubuntu programs built with PIE. March 2013.

[44] Ubuntu securityfeatures, May 2012.

[45] van de Ven, A., and Molnar, I. Exec shield. 2004.

[46] Wahbe, R., Lucco, S., Anderson, T. E., and Graham, S. L. Efficient software-based fault isolation. In SOSP'93.

Wednesday, February 20, 2013

Robots, wildlife and bioinspiration

Sangbae Kim, professor in mechanical engineering from MIT visited Berkeley today and gave a great inspiring talk on dynamic locomotion. The original title of the talk was "Toward Highly Dynamic Locomotion: Actuation, structure and control of the MIT cheetah robot".

An early model of the cheetah robot. Image (c) biomimetics 

In the talk Sangbae told us about some of the awesome robots (e.g., the iSprawl fast and dynamic cockroach, or the Gecko stickybot that walks up walls) they are building in his lab and focused on details of the cheetah robot, a bioinspired, cheetah-like, quadro-legged robot that walks, trots, and runs with speeds up to 18.5 miles per hour. While it was not exactly clear for me why they are building this robot (maybe because it's just awesome to have a robotic cheetah in your backyard - I just hope that they do not plan to use those robots to hunt people) he did a great job on explaining all the different research problems they had to solve.

The three problems he talked about in detail are:
Power: you need to have enough power to keep the robot running in the wild for a while. This problem exists even in nature where cheetahs are completely exhausted after a hunt. Large parts of energy are dissipated as heat before it can be used to bring the robot into motion. Some grad students are working on better models that reduce the power consumption and maximize the time the robot can move. In addition, the cheetah regenerates power from reverse motion (comparable to regenerative braking in battery powered electric vehicles).

Motors: a second big problem are reliable motors that deliver high torque at low speed. Currently the market offers mostly low torque but high rotation speed motors. These motors are good to build, e.g., a quadrocopter but they do not work well for a robot as a robot needs fine-grained control over the motion and sensor feedback (e.g., with how much force a surface is touched). A low torque high speed motor needs a gear box between the motor and the tip which makes sensing using just the motor a hard problem. A high torque low speed motor can directly be coupled with the tip and functions as a sensor as well, removing the need for additional sensors and/or complex gear boxes. This simplifies the design and makes the robots more robust. His lab even switched to building their own motors for the cheetah that have an optimized design to offer as much torque as needed.

Stability: wild cheetahs use their tail for stability, to save them from a fall, or to enable fast direction changes which helps them catch their prey. Songbae's group added a tail to their cheetah that enables the robot to recover from miss-steps: "a tail basically buys you time". If a lateral force pushes the robot to the side then the tail can swing and counteract that motion. The robot then reacts to the force and has time to calculate a counter measure.


Video of the running robot. There are a ton more videos on the biomimetics website.

As a side note: after the talk I wanted to learn more about cheetahs and watched the following video about real cheetahs. It's a great video about the cruelty of nature and how hard animals (both beast and prey) have to fight for survival. 


Video about real life cheetahs, (c) by Nat Geo.

The talk was not focused on computer systems or even computer science related, nevertheless it was a very accessible and fun talk. I did not understand all the mechanical and mechatronical details but was able to follow most of the presented material. And let's just be honest: robots are awesome and I at least always wanted to build these awesome things!

Monday, January 28, 2013

All paths lead to Rome: POPL and PPREW from a syssec perspective

A week in Rome: what could be better than sitting all day in a conference room?

POPL (Principles Of Programming Languages) is one of these great conferences that have been around forever and sound very interesting to any systems person. The definition of POPL according to the SIGPLAN homepage is: "Principles of Programming Languages symposium addresses fundamental principles and important innovations in the design, definition, analysis, and implementation of programming languages, programming systems, and programming interfaces.". During my PhD I was in a very (computer) systems and compiler oriented group and POPL always sounded like a fun conference. So I was quite happy when I got some of my older PhD work accepted for the PPREW (Program Protection and Reverse Engineering Workshop) that was co-located with POPL this year. The 2013 POPL venue was in Rome, Italy which was even better!

The POPL conference

Before the conference I quickly browsed through the conference program, recognized some names (hi Vijay D'Silva, Daniel Kroening, Ben Livshits, and Domagoj Babic) and some of the papers sounded quite intriguing (although I feared that I would have some trouble understanding the overly theoretical papers and talks).

The keynote on the first day by Georges Gonthier (MS Research) was mostly about proving theorems in Coq (a theorem prover) and examples on how to user Coq (which did help me understand the whole theorem proving world).

The highlight of the first day was Vijay D'Silva's talk about "Abstract conflict driven learning" (unfortunately I did not find a free PDF version of this paper). I really enjoyed his presentation (he's a great speaker) and the paper was added towards the top of my reading stack.

The second keynote by Shriram Krishnamurthi (Brown University) discussed that JavaScript and HTML are basically evil languages that have no built in safety concepts. Missing language abstractions and full implicit trust of all external library functions (e.g., any included JavaScript library like the JQuery library has full access to all data of a website; all code runs under the same privilege domain with the same priorities) makes it hard for websites to reuse existing libraries. Shriram discussed sandboxing approaches and other language approaches to overcome this problem.

The highlight talk of the second day was Ben Livshits (MS Research) talk "Towards fully automatic placement of security sanitizers and declassifiers" A sanitizer is a function that cleans an user-defined input string from any potentially malicious/bad character sequences (e.g., escape characters if the string is used for an SQL statement, or JavaScript tags, if the string is used as part of an HTML page). A problem is that most sanitizers are neither idempotent (i.e., the cannot be executed repeatedly on the same data without chaning the data) nor reversible (i.e., removing bad characters cannot be undone). Ben argues that programmers are unable to place these sanitizers at the correct location and an automatic analysis tool will do a better job. The core of their analysis piggy backs on existing compiler data-flow techniques and uses both a static and a dynamic component. The static component uses node-based placement of security classifiers for most of the statically detected input sources. The remaining input sources are tagged dynamically and use a dynamic data flow tracking to add sanitizers at runtime. So for most of the input flows the algorithm is able to determine the location of the sanitizer statically while for some remaining sanitizers the algorithm falls back to a dynamic approach.

I really liked the presentation and when Ben visited Berkeley one week after POPL I took the opportunity to talk to him a bit before his (re-)presentation. What bugs me a bit is that the approach is limited to strings (so no full data tracking for all kinds of data flows) and that the strings remain static during the process. If strings are used/concatenated during the execution then some additional special sanitizers must be added that tag part of the string (i.e., assume that an SQL string is being built up from multiple sources: then the approach cannot handle partial strings or concatenated strings).

The keynote of the third day was by Noah Goodman (Stanford) and he talked about principles and practice of probabilistic programming. The talk focused about how we can deal with uncertainty: an easy solution is to extend the current value system and add a probabilistic component to it. After the motivation he moved towards Lambda calculus and explained how basic Lambda calculus can be extended with stochastic methods. I really liked his presentation and was able to follow through most of the talk although the focus of the talk was not exactly in my comfort zone.

The highlight talk of the third day was "Sigma*: Symbolic Learning of Stream Filters" by Matko Botincan and Domagoj Babic. They presented a nice concept of how they can the learning of a symbolic model of an application. They present an iterative process that generates both under-approximations (using dynamic symbolic execution) and over-approximations (using counter-example guided abstraction refinement) of an application. During each step they use an SMT solver to test for equivalence. If the two approximations are not equal then they either extend the under-approximation or shorten the over-approximation until they reach a fixpoint.

The PPREW workshop

After three days of POPL I was looking forward to a more low-level, computer-systems related, and machine-code oriented workshop and PPREW (Program Protection and Reverse Engineering Workshop) met and exceeded my expectations.

First of all, (Jeffrey) Todd McDonald gave a great introduction and welcomed us all to the 2nd incarnation of this workshop. He hopes to grow the workshop in the future and to attract more academic work in the areas of program protection and reverse engineering.

Arun Lakhotia (University of Lousiana at Lafayette) gave the keynote and talked about "Fast Location of Similar Code Fragments Using Semantic 'Juice' (BinJuice)". We have to move away from the old question wheter a binary is 'bad'/malicious or not and move towards the question who is actually responsible for the malicious code. His idea is to remap malware as an information retrieval problem: find the closest match of a new (malware) sample to existing code in a large code library; or partition all your samples inside the library into classes and families. As a next step it is possible to use machine learning to classify similarity. Code is related through code evolution (bug fixes, capabilities, code reuse, shared libraries).

A prerequisite is defining features that can be used to classify individual executables. As part of this research they evolved the features using different forms of abstractions: use a sequence of n bytes; use disassembled text; use disassembled text without relocations, or use n-mnemonic words (je push) (push movl).

An important finding is that current malware does only block level transformations. Semantics catch any changes inside a block, a remaining problem is if unused registers are used for bogus computation across control blocks.

The first talk was by Jack W. Davidson (University of Virginia) about "Software Protection for Dynamically-Generated Code". The focus of this work is program protection: slowing down reverse engineering of a piece of code. If code is available then reverse engineering will always be possible, the question is how fast the 'bad guys' will be able to crack a software protection. Jack proposes Process-level virtualization (PVM): using a binary-dynamic translator that dynamically decrypts encrypted portions of a binary executable at runtime. A static compilation process adds additional guards into the executable, encodes specific the binary and encrypts it using some key.

The second talk was Mathias Payer's (aka your humble author, currently PostDoc at UC Berkeley) talk about "String Oriented Programming: When ASLR is Not Enough". In this talk Mathias discusses protection mechanisms of current systems and their drawbacks. Data Execution Prevention (DEP) is a great solution against code injection while other forms of code-reuse attacks like Return Oriented Programming (ROP) are still possible. Address Space Layout Randomization (ASLR) and Stack canaries are a probabilistic protection against data overwrite attacks that rely on a secret that is shared with all code in the process. Any information leak can be used to reveal that secret and to break the probabilistic protection. String Oriented Programming is an approach that exploits format string bugs to write special static regions in regularly compiled executables to redirect control flow to carefully prepared invocation frames on the stack without triggering a stack canary mismatch and circumventing ASLR and DEP as well.

In the third talk Viviane Zwanger talked about "Kernel Mode API Spectroscopy for Incident Response and Digital Forensics". In the talk Viviane presented her ideas on "API spectroscopy": she measures API function calls of kernel drivers, classifies these function calls into different groups, counts number of calls per group, and uses the a feature vector based on the number of function calls to classify potentially malicious drivers. The analysis is based on a static approach where she uses kernel debugging functionality to get a dump of the kernel memory image to extract individual drivers. The static analysis then counts each function call and generates the feature vector.

In the last talk Martial Bourquin presented "BinSlayer: Accurate Comparison of Binary Executables". He told us that there is no good way to compare two different binaries. The only tool that is readily available is Halvar Flake's BinDiff tool which relies mostly on a bunch of heuristics. Martial extends BinDiff with a better similarity metric by analyzing the callgraph and collapsing similar entries.

Final remarks

All in all I must say that I enjoyed my stay in Rome. Both conferences where interesting: meeting people during POPL and peeking into the theorem proofing and formal verification world was certainly challenging and broadening my view. PPREW on the other hand felt like home: I was aware of the related work, knew my area, and I was surrounded by friendly like-minded people.

Thursday, September 20, 2012

PhD: expectations and reality

Introduction

Deciding to do a PhD is a huge commitment as you are just dedicating a couple of years of your life to a single cause. When I decided to do a PhD in 2006 I was not completely sure what would expect me. I just finished my master of science (MSc) at ETH Zurich and I knew that I really liked working on the research project that I chose. On the other hand I worked in programming and web development for the last couple of years to finance my studies and I discovered that only doing project/programming work is too boring for me. I had no clear picture how the PhD would be like, but I assumed that it would be a combination of a continuation of the research I did during my master thesis, writing papers, going to conferences to present your research, and in the end writing a thesis that proofs your thesis statement.

Many others before me have already blogged or written books about the life as a PhD student, how to carry out a PhD, defined what research, yet I think that I can add my two cents to the existing stories. My experiences are still fresh (I started my PhD in 2006, defended beginning of May 2012, and started my PostDoc here at UC Berkeley in September 2012) and I hope that I can give a good description about the qualitative aspects of a PhD.

The three phases of a research PhD

In my time as a PhD student at ETH Zurich I had uncounted discussions with peers, assistant professors, professors, researchers, and people related to academia. During these discussions we discovered that a PhD can be segmented into three basic phases: the first phase identifies the research topic and bootstraps the student; the second phase is the productive phase where the research bears fruits and is turned into papers (or at least communicated to other people); and the last phase consists in wrapping up, writing the thesis, and finally the defense.

Every successful PhD student goes through three phases during his PhD. Each phase has different requirements and relies on different personality aspects. The phases follow after each other but there is no clear transition from one phase to the other yet one knows if the transition completed.

The search for the holy grail: ramping up and finding your topic

The first phase of a PhD is like the 'get to know each other' phase at the beginning of a relationship. You don't really know what to expect but you are interested and you want to explore. Yes, there are some peculiarities but you are not too concerned about that right now. In this first phase you dig into the field that is interesting to you and you start reading up about prior research approaches about the problem you want to tackle. Some ideas start to form in your head and you decide on a topic for your thesis. In more practical research areas you start building prototypes and you execute small tests; in more theoretical areas you try to come up with some theorems and you have a rough idea about the general topic.

Depending on your adviser he or she will restrict your search in one way or another. The most restrictive adviser tells you exactly what you should do (sometimes they have a grant proposal for a specific project and/or only need a code monkey to implement their grand idea) other advisers let you run free and let you come up with your own idea in a (sub-)field. Both extremes have their advantages and the kind of adviser that is best for you is basically an optimization problem that you need to solve for yourself.

On one end of the scale you are given a topic by your adviser. This approach ensures that your adviser cares/should care deeply about your project and it gives you a head start, on the other hand you'll have to make up for this pre-selection and you'll have a harder time to bring in your own (research) ideas into the already existing project. On the other end you can choose your topic in an open void. It is up to you to make your adviser care about the project and you need to come up with the core idea. This great opportunity usually results in additional time needed to complete this phase. In the real world your adviser will usually set the limits anywhere between these two extremes.

From my experience I would say that the average student stays in this phase from one to three years. I was lucky enough to have an adviser that allowed me to choose freely in any field that he was comfortable with. During my first three years I discussed a huge set of possible research ideas with him and even after we had settled on a specific topic the details kept changing as I passed through the later phases.

Two key aspects in this phase are: (i) creativity, you need to come up with a good research idea and research plan. Nobody will tell you what to do, there is neither a customer who demands a specific feature, nor is there a pre-set plan like in a play. You need to be focused and keep yourself together to pass through this phase. (ii) Due to the fact that you need an idea and you are responsible for the schedule you build up a huge amount of psychological pressure. Most people that drop out during this phase fail due to either a lack of ideas (and creativity) or because they are unable to self-organize themselves in an unstructured work environment.

The paper mill

After you have decided on the (main) topic of your thesis and built the first prototype (or come up with the first layout of the system) you gradually transition from the first phase to the second phase. You are now trapped in the paper mill. This is the most productive phase as you try to publish your work in as many (good) conferences as possible. The quality of your work is (somewhat) measured in the number of papers that you publish at top tier conferences. You are evaluated based on the quality of your work combined with the human factor how you present yourself.

In this phase you start to become an expert in your field: you have claimed a little spot in a bigger field that you extend with your research. Your adviser will try to keep you in this phase as long as you are able to produce more good papers (given that your adviser has enough funding and that you do not run into any hard time limits given by your university).

The core qualifications for this phase are that you can (i) work hard and (ii) present yourself at conferences. You have to write all these papers and at the same time you should refill your pipeline of ideas to get the next publications in order. In addition you have to express all these ideas to others and you have to play the social game at conferences. Building your social network during conferences is actually hard work and you need to try to make friends with some of the bigger shots in your field as this can be helpful for future collaborations, additional papers, or even reviews. If other people understand your ideas from beginning to end and you can convince them (in person) that the ideas are great then they are more likely to accept your paper that they'll review later on. This (productive) phase usually lasts about two years and is your opportunity to build your social network for possible future positions. A side quest during this time is to select your thesis committee. You already know in what area you will write your thesis about, you should have an idea about your thesis statement, and you should know who the experts are in this area. Hint: conferences are a good place to chat up possible committee members!

The exit strategy: wrapping up and writing your thesis

After you churned out a bunch of papers during your time on the paper mill you are finally ready to graduate. At one point in time you start to feel ready, you have published a couple of papers (or at least written a couple of technical reports if you weren't able to publish the papers) and you developed a good understanding of what research in your area is about. In your (regular or not so regular) meetings with your adviser you should also get a feeling if he or she thinks that you are ready.

At ETH you write your thesis from scratch. I started with reading (or at least skimming) my prior papers before I wrote my thesis. After that I came up with the basic outline and the vision that my thesis should get across. The goal of the thesis is to write down your thesis statement and to prove said statement. It is important that your thesis is a self-contained and self-consistent document.

In this phase you should have settled on your thesis committee. Your committee consists of a couple of professors (or people with a PhD depending on your university) that are experts in your area of research. These experts will read your thesis and grill you during your defense.

Some people quit at this late stage of the PhD due to timing constraints or due to burn out. After a couple of years they are worn out and run into deadlines imposed by their adviser or by the university. It makes me sad when I see colleagues that come up to this point in their career and then quit so close to the finish line.

The defense is the end of this last phase and after you have passed this final test you have almost completed your PhD. At most universities there are some bureaucratic hurdles that are left for you to take and there might be some minor (or major) revisions to your written thesis that you have to carry out. Other than that you are done and at some delta t after the defense you are allowed to call yourself PhD (or Dr. Sc in my case).

The teaching aspect in a PhD

Teaching is an orthogonal experience to the research experience. At ETH you are supposed to be the teaching assistant (TA) for one lecture per semester. At the beginning you will start off as a regular TA but as you progress in your PhD you will be trusted with more and more responsibilities, e.g. you will teach lectures if the professor is sick, or you will be head TA for a complete lecture. Head TAs are responsible to coordinate the lecture, to supervise the other TAs, and to organize the individual exercises.

I really enjoyed teaching during my almost 5 1/2 years at ETH and I think that it is a great experience that every PhD should have. During the exercise hours that you have to supervise you learn how to speak in front of a group (a skill that is not that common in Switzerland and that is not part of the regular curriculum at high school or college), you learn how to prepare the material so that you can present it to a group of students, and most importantly you learn how to interact with all kinds of students that have different problems with the material, the course, or a specific exercise. All in all you learn a new skill: how to teach some specific material to students. If you plan an academic career then this might come in handy at one point in time.

The PhD grind

Right when I was finishing my thesis Philip Guo published his memoirs about his own PhD experience in an e-book called "The PhD Grind". In the book Philip tells us about his PhD experience year for year in chronological order. Each year of his PhD is covered in a chapter and he writes about all the ups and downs during that time. The book is a great read and I warmly recommend that you read it too if you are interested in research and academia.

I agree with many of his observations, e.g., that it is important that you focus on conferences that your adviser already has published in recent years. Your adviser will know the right lingo and the right buzzwords for the conference and the members of the committee will know your adviser which in turn will help as well.

On the other hand there are a couple of things where I don't agree with Philip. Most importantly Philip mentioned that being a TA only delays the PhD (page 70, of the e-book). As I explained above I really valued the teaching experience - from a personal as well as from a professional point of view. During the discussions with the students I learned several new and interesting details in areas that I actually assumed to know in depth. Another area I don't agree with Philip is about how to select your thesis committee. Philip tells us that usually the adviser selects the thesis committee (page 56, of the e-book), I on the other side had the pleasure to select my own committee. I discussed possible members of the committee with my adviser and then approached each member myself. For me this was an interesting experience - first coming up with possible and plausible fits and then approaching these professors myself.

Conclusion

A PhD is certainly not the right career path for everyone. Doing a PhD is challenging, requires a lot of self-control and self-organization. The PhD is not (pre-)structured and you will need a lot of creativity. In addition you get less pay than an industry position with a comparable education. On the other hand you learn a huge amount of new skills during your PhD. This is your opportunity to do academic research, you can publish at conferences, you'll meet a huge amount of new people, and you learn to network. I enjoyed my time and I recommend doing a PhD to all the curious and interested people out there that are interested in academia and who want to go that extra mile.

Monday, September 17, 2012

Bootstrapping at UC Berkeley

Today I had my first day at UC Berkeley in Dawn Song's group and I must say that it was quite an intensive day! Most of the time went into going through all the bureaucratic processes here at Berkeley. I always thought that ETH Zurich was bad, but the bureaucratic pain at ETH is peanuts compared to bureaucracy here at Berkeley.

The bureaucratic pain started about 3 weeks ago where I got an email that I had to attend a special Berkeley Visa meeting (also called SIM meeting). The meeting was on the following day (when we were still on holiday). So I rushed up to the International House and attended this meeting. Before the presentation we were handed a booklet and had to register with our passports and DS-2019s. Attending the presentation was mandatory and you only get your travel authorization (if you want to travel during your J1 PostDoc) if you attend this meeting. So I waited in the auditorium and read the booklet. Twice. And the presentation covered the material in the booklet in more or less slow-retard mode (i.e. very detailed and precise so that everybody would get it).

On my first day I had an appointment with ERSO to get my contract set and settled. As a typical Swiss I arrived 5 to 9 and was greeted with a warm welcome. Unfortunately the person I had an appointment with had her day off today so I was handled by somebody else. All in all I had to fill out around 15 forms, enter my personal information about 10 times, and sign the documents 12 times or so. This process took 1/2 an hour and got me a Berkeley employee ID (which will be needed later on).

The next step was meeting with Dawn Song's awesome Barbara Goto who handles access to the offices and hardware distribution. So I signed in with her and we went to the building administration to get me a key for the office (where I had to pay a 5$ deposit). To get access on the (wired and wireless) network you need an EECS account, administered by IRIS. So I went back to Cory Hall to talk to the IRIS guys and got myself registered. The registration is a 3-way process: you register, your PI has to sign it off, you reregister and authenticate yourself using your Cal ID.

When I returned from IRIS Glacier had sent me an email that my employee ID had gone through the first system and that I needed to fill out some (online) forms. So off I went. For taxation Galcier needed all my visits _ever_ to the US with exact date and length of date (which is almost double digits in my case and a pain to enter on their website). To fill out these forms you need your DS-2019 and your position code which is available on your contract.

Now I would also like to have a Cal ID, which is the main form of authentication for campus services. Unforunately I have to wait two days until all the forms I just filled out have rippled through nightly batch jobs and are processed by the different systems. To get the Cal ID you need your employee number as well but with the Cal ID you get access to the recreational sport facilities, AC transit (bus) passes, and much more. Unfortunately I have to wait for two more days. This section concludes my bureaucratic nightmare of the first day, it was already past noon and I have not yet talked to the other guys here.

My next point on the list was a quick meeting with Dawn who pointed me to Lenx to get all the necessary information. Lenx filled me up on all the currently running projects and told me when the group meetings are. Basically ask your group members to get on all the mailing lists, get access to the internal wikis, the GIT repositories, and the SVN. Then I was also told to order laptops and desktops. Dawn offered me one of these retina a MacBook Pro laptops, but I declined and opted for another Lenovo: this time I'll get an X230 with 24 hours of battery life and less than 3lb (1.3kg) weight. Compared to 6 hours battery life and 4.4lb (2kg) of the MacBook Pro. A conference laptop should be lightweight and should last through the regular conference day, so travel light, travel energy efficient!

Now I'm looking forward what the next day will bring! :)


Addendum

It's now Thursday and I hope to have finished all the bureaucratic stuff that I had to do. Basically you need to get an employee ID (at the ERSO office). The employee ID registers you in all the major databases and kick-starts your payroll. Then you have to register your tax services at Glacier to ensure correct taxation of your payroll, you need to setup accounts and fill out all the online forms at AYSO and BLU; these four services (ERSO, AYSO, Glacier, and BLU) ensure your payroll. After that you need to go to Garnett-Powers to select a health-care plan. If you (and your wife) have social security number you might be able to fill out the form online at AYSO. Otherwise you need to go to the Garnett-Powers homepage and fill out the online form, print it, and hand it over to the ERSO guys.

The next step is to generate an IRIS account so that you get an email account, can logon the internal network and wired network, and can register devices. You have to go there to create an account, wait until your account is approved, and go there a second time to set all your passwords. The IRIS account depends on your employee number.

For a bunch of other services you will need a Cal1Card. You have to wait 1-2 days until all the data is batch processed, then you'll have to go to the Cal1Card office (at the student services) which will then issue your PostDoc ID card plus an account token. With your employee number and the account token you'll be able to generate a Cal1 account. The Cal1Card depends on your employee number.

All in all it took me 3 days to fill out all the forms and to wait until the state of my account was batch processed to a completion. Sigh, and I always thought that ETH was inefficient and bureaucratic.

Sunday, September 2, 2012

An expats start as a security postdoc at UC Berkeley

What is this blog post all about (aka tl;dr)?

This post covers our first two weeks in Berkeley, California and includes our struggles to find reasonable housing, a car, pitfalls with Visa requirements, how to get a driving license, and generally how to start a new life in the US - if all you have fits into a bag plus 1 piece of hand luggage (per person).

Day 0 (August 20st): flight from Zurich to Philadelphia to Phoenix to Oakland

When planning our emigration from Switzerland a couple of months ago we booked the cheapest flights to Berkeley that were in a reasonable time frame. US Airways had great flights to Oakland (OAK) airport from Zurich (ZRH) via Philadelphia (PHL) and Phoenix (PHX). The flight from ZRH to PHL was uneventful; US Airways is a cheap airline that has no entertainment system whatsoever on the other hand if you carry a good bock or a tablet the time passes quickly. A couple of years ago US Airways decided to remove all the in flight entertainment systems to cut down on costs. In my opinion this was a great idea as more and more people bring their tablets (with preloaded movies and series) and no longer need the entertainment system anyways. Plus on my flight from ZRH to San Francisco (SFO)  with Swiss Airlines earlier this year the screen was broken on my seat and on the way back the entertainment system was not working for the complete economy part of the plane.

When we landed in PHL we had to wait around 90 minutes for immigration plus an additional 60 minutes at security; the immigration was smooth but we ended up missing our flight to PHX our bags unfortunately made it to the flight. The transfer guys at the US Airways desk did a great job and rerouted us on the same day to SFO instead. We were told that the bags will be delivered soon - but this is a different chapter.

After arriving at our hotel, the Piedmont House we discovered that this hostel has no reception and is basically some sort of frat house for weird people. A bunch of guys and girls are living there together without any organisation whatsoever. When you "check in" you can grab some keys from the key board and then try to find your room. The online advertisement looked good, the pictures were nice, and the self check-in sounded like a great idea (I assumed some online system that would hand us a room card when entering) but our expectations were a bit too high. Just so you can relate: I consider myself a traveler and I have stayed in a fair share of shabby hostels without much troubles but Piedmont House is pretty bad.

The house and the rooms are very old, smelly, and the bathrooms are sub par (i.e., there are two showers for 10 rooms or so but only one shower works, the other shower stall is used as storage for old lamps and stuff). The house features a shared kitchen as well; watch out: if you store food in one of the shared fridges it might disappear plus there are rats (and mouse traps) in the kitchen. Unfortunately we booked a double room for one week. As we were arriving in the first week before the new semester all hotel rooms in the area were booked and the hotels tripled their prices, yet I would still advise you to stay in a different hotel, with a friend, or just sleep in the park! We were trying to get hold of somebody (i.e., the owner or some staff) to tell them that we were expecting our bags from the airline but no luck. We managed to tell them the next day that we were expecting bags but nobody of the staff seemed to care. Later when we were reunited with our bags we found out that the US Airways delivery guy tried to deliver the bags twice and nobody answered the door nor did anybody answer the phone number that is listed on the Piedmont House contact page. That's what I call a shitty hostel!

Day 1 (August 21st): a brave new world (and apartment)

This was the time when Lumi (nickname of my wife Anna Barbara) hit rock bottom the first time: the combination of new country, immigration, loosing our bags, a crappy shabby 'hostel' room, and disgusting shower stalls. As soon as we had breakfast we started looking for an apartment in the area.

The areas we considered were Berkeley (obviously), Emeryville, Oakland, Albany, and El Cerrito. Berkeley is a very vibrant student city and offers everything you need. South of the UC you find all the student housing, fraternity parties, cheap eats, and Telegraph avenue with lots of shops and food options. West of the UC you find the so called gourmet ghetto with even more food options and a couple of hotels and motels along University avenue. Prices for a 1 bed room apartment are around 1300 to 2000 plus there is a huge competition when you look for an apartment (an owner told us that he got 60 calls in 2 hours for one apartment; 10 people would sign the contract without even looking at the apartment). Emeryville is south of Berkeley and a 3 to 6 mile commute to the UC and housing is a little cheaper. If you like an all inclusive resort: have a look at the Watergate community, they offer swimming pools, tennis courts, and whirl pools all included in the rent. Unfortunately no free apartment was available when we were looking. Oakland is even further from Berkeley and comes with a 4 to 10 mile commute to the UC; if you want to live there you should consider taking the BART or the Bus. Apartment prices are even cheaper but the area can be a bit dodgy, so watch out. Albany is a small village north-west of Berkeley and comes with a 3 to 4 mile commute to the UC. Albany offers many shops, restaurants, pubs, and other small village perks around Solano avenue and San Pablo avenue. El Cerrito is a bit further up north from Albany and comes with a 4 to 8 mile commute to the UC.

If you want to find something in the bay area that is not new you will have to check out craigslist. Craigslist is like an online black board with millions of postings and listings. You can get everything on craigslist from second hand toasters, to bikes, to cars, up to apartments. We looked at more than 200 apartment listings in the areas described above, sent more then 20 emails to the different owners, called around 10 owners, got 5 appointments, and looked at two apartments. All on one day. The market is very competitive and you have to sweet talk people into leasing you the apartment right away. We decided quickly to get the second apartment we looked at, stuck around after the showing, and settled the lease with the property manager (including handing over the cashiers check for the deposit and the down payment) before the others could even hand in their possible application for the apartment. The 2 bed room apartment we got is in Albany and the commute to UC is around 3.2 miles plus there is a bus stop right in front of the apartment. Good news: we can move in on Sunday (in 5 days).

A note on transportation: public transportation in the bay area is reasonable (good compared to other areas in the US, bad compared to Switzerland). Caltrain (a commuter train) connects San Francisco with San Jose; BART (a light railway) connects both international airports, San Francisco, Berkeley, and Richmond. AC Transit (a bus line) connects the cities on the east bay.

Day 2 (August 22nd): organizing a ride

No matter how good public transport is you'll still need a car in the US. In Zurich we were able to live without a car for the last 10 years but the distances are just longer here in the US and even for basic tasks like grocery shopping, going to a workout, or going to the movies you'll need a car. Our plan was to get the smallest car possible and we set ourselves a budget of 4k$ for a used car with less than 150k miles and not older than 10 years or <10k$ for the smallest new car that we could find. We talked to a couple of friends and I read tons of online posts about the topic and the chime was: never buy a used car at a used car dealer. They basically offer the same guarantees as private sellers but they add 1k$ to the private and they will tell you anything (aka they are professional liars). That's why we started with craigslist. Generally we followed this great checklist on how to buy a used car and we used Autocheck to check the VIN numbers of all the cars we looked at. The VIN number shows the registered mileage, any accidents the car was in, and other general information that helps you make up your mind about the price.

It was actually harder than expected to find a car that met our criteria (<10 years old, <150k miles, <4k$) but finally we found a Mazda Protege from 2001 with 138k miles for 2650$ and a Toyota Corolla from 1999 for 3500$. We called both guys and organized test drives on the next day.


This afternoon our bags finally arrived. I had to call US Airways a couple of times until I got to the right person and I was then told that they already tried to deliver the bags twice but nobody picked up the phone at our hotel and that nobody would answer the door. Luckily I got a very understanding and friendly person on the other end and she organized a third delivery of our bags. I waited on the veranda until we were finally reunited with our bags. Thanks again Piedmont House for not answering the phone nor opening the door when a delivery guy comes by.


Day 3 (August 23rd): banking troubles (1) and meeting our ride Marvin

As we were slowly running low on dollars we tried to wire money (10k$) from Switzerland to our Wells Fargo account and asked a Wells Fargo banker to write down the wiring instructions for our checking account. From an earlier fraudulent charge I ended up with two checking accounts, one with the money and one with 0$ in it. We closed the account with 0$ and found out afterwards that the banker gave us the wiring information for the checking account with 0$ in it. The wire ended up somewhere in the air, Wells Fargo removes 72$ from the 10k$ and sent the money back where we payed the conversion fees twice (CHF to USD and USD to CHF) and we basically lost 250$ in this transaction thanks to confusing information from a Wells Fargo banker. Compared to Europe the US banking system is completely broken; everything relies on checks and money transfers between banks is completely inconvenient and a huge hassle.

Another huge problem is that the average banker (at any bank) is just a trained monkey. The bankers will lie to your face and tell you any misinformation they want just to 'help' you. All of them are very friendly and sound kind of competent. But different bankers contradict whatever the previous banker said. As a banker in the US you don't need any training, education, or you don't even need a clue what's going on. For example, I had a life-long-free-account and I got a fraudulent charge on my debit card. Instead of just issuing a new debit card (with a new number) banker A decided to sign me up for a new checking and new savings account that is no longer free as there was no way of issuing a new card with a new number according to her. That's how I ended up with 2 savings and 2 checking accounts in the first place. She told me that the account would be free and she would set up some transfers and get everything ready. Banker B told me that we can close the old bank accounts so that I only have one checking and saving account each left (shortly thereafter the wire arrived and we lost our 250$). Banker C then told me that Banker's A and B were full of shit and that we could have kept the other free accounts. Some bankers told us that we can use our European Maestro (EC) cards to withdraw money, others told us we couldn't. Basically no two banker told us the same consistent story or information. This makes it very hard to trust the US banking system as Wells Fargo appears to be one of the better banks. My conclusion: never leave too much money in the US, transfer as much as possible back to your home accounts where banking is a serious business and not just a joke.

On the afternoon we had our appointment with Jason to test drive the first car. We liked the stick shift Mazda Protege from the start, the car was in good shape and the test drive went smooth. One of the most important things when buying a second hand car is to bring it to a mechanic and after reading the Yelp reviews we decided to go to Steve's Auto Care in El Cerrito. We didn't have an appointment and Steve told us that we were a bit too late and that he couldn't do a full check, yet he looked at the cor for almost 30 minutes and gave us great information about the state of the car and what to expect. That's when we decided that whenever we had any repairs we would go to Steve! In the end we decided that we would buy the Mazda as it was a good deal and we both liked the car. We scheduled to hand over the money in cash on the next day as the amount was low enough not to bother about a cashiers check.

Day 4 (August 24th): happy birthday

Today was my wife's birthday and I surprised here with breakfast in bed with some cake and a nice card. After breakfast I started calling different people. We organized home renter insurance for our apartment, car insurance for our new car so that we could drive from Jason's house to our apartment. Geico was the insurer of our choice for both the car insurance and the home insurance as they offered a reasonable deal and coverage (around 250$ each). After covering the insurance we got ourselves appointments at the DMV for our written driving tests - the international driving licence is not accepted in the US and you need to redo both the written and the behind-the-wheel test. After sorting out all our telephone calls we went on an online shopping spree on Amazon prime and bought router, modem, and other stuff to start up our digital life.

In the afternoon we celebrated Lumi's birthday by going to the movies and watching Brave. Later we took the BART to Jason and finally bought our car - we named him Marvin and parked him in the garage of our apartment.

Day 5 (August 25th): the lush life

In the last couple of days we were able to find an apartment and to buy a car, we deserved a day off! We slacked around for a bit, walked around on the campus, and went to an all you can eat pizza place near Telegraph avenue. Afterwards we went to the movies again. I guess we deserved it!

Day 6 (August 26th): moving in

In the US you can actually move in on Sundays. We were very happy to leave crappy Piedmont House and took the bus to our new apartment. Unfortunately we got quite an unpleasant surprise: the apartment was not cleaned by the previous tenant. The whole place was quite yucky, the kitchen and bathroom floors were not cleaned and very sticky, the shelves very dirty, or there was left over stuff in there as well, the stove and oven were super dirty and sticky. We taught hard what we should do and in the end we decided to go to Target to buy cleaning material and to clean the floor and some of the shelves and cupboards we use. We just put all the baking trays and all other stuff that was laying around into a cupboard and closed it until we move out. That's when Lumi hit rock bottom the second time. For our safety we took lots of pictures so that the owner cannot complain if we do not clean the apartment when we move out.

In the morning we bought a GPS navigation system for our car - these things are so convenient! In the afternoon we went to Ikea and bought all the basic kitchen stuff, a mattress, a table, a couch table and lots of other small things. Until late at night we spent our time building all the stuff we bought and I even managed to wreck our living room table by turning in the screws so tight that they came out at the top end.

First week recap:

We managed to move out of the worst youth hostel ever without getting any diseases (I was bitten a couple of times by something that lived in the mattress), we found a place to stay, we bought a car, we got the apartment cleaned up and made it livable. If you are interested in how much money you'll need for the start: apartment 2000-4000$ deposit and first week, car 2000-4000$, furniture and basic appliances: 1000-2000$.

Day 7 (August 27th): building a place to live

We went to Ikea again to buy a second table plus more chairs. This way we can use the wrecked table as a desk in the second bedroom and if we have many guests we can put both tables together. Our next item on the list was to go to Target and buy all the basic food stuff that we need. We spent the rest of the day building, constructing, and cleaning.

The sad part of this day was that our Swiss Mastercard was blocked. The fraud protection kicked in when we tried to buy furniture from Ikea the second time. I had to call the emergency number to get the card reactivated.

Day 8 (August 28th): the written DMV test

We assumed that we have an appointment but you have to wait at the DMV even if you have an appointment (for 30 minutes - if you don't have an appointment than you have to wait up to 3 hours). The written driving exam was a peace of cake. We learned for about 3 hours each and Lumi aced the test, I had one mistake (6 mistakes are allowed).

In the afternoon we went to another shopping spree and bought our couch at Target and a huge amount of other stuff online: a bike to commute to UC, a TV from Woot, and a bed box from Walmart.

Day 9 (August 29th): getting settled and meeting the gang

While I had to attend one of the most boring meetings ever Lumi had fun with the Comcast guy who installed our internet access. As part of the J1 visa I had to attend the mandatory visa information meeting. If you don't attend this meeting then you don't get authorization to travel outside the US during your postdoc. As this was my second time as a J1 the meeting did not yield any additional information for me and I just had to sit it out.

I thought that I could visit the other postdocs and PhD students while I was at Berkeley. During lunch I met with the security reading group and got to know some interesting people.

Day 10 (August 30th): meeting Mario and family

This was the first time we tried to do sports here in the US. We went running but the GPS did not pick up a signal until we finished our track. We found some spots with a great view over the bay area. Later that night we were invited by Mario and his family to have dinner at their place. What a wonderful and chilling night.

Day 11 (August 31st): trying to work

Our last Ikea and Walmart trip. We bought the last couple of things we forgot the last times and completed our furniture.

Day 12 (September 1st): beautify the apartment and checking out the nightlife

Lumi started painting the walls and beautifying our apartment while I tried to work a couple of hours. After almost 1 1/2 months of holidays it's kind of hard to get back into "work mood". After work we went bowling to our local bowling alley. Later that night we found out that it is kind of hard to get food in the US after 10pm if you are not driving around. Sizzlers, Taco Bell, and McDonalds all close between 9pm and 10pm for walk-in customers. On the other hand the Taco Bell and McDonalds drive-ins are open all night long. We actually have to get used to this kind of mentality.

Second week recap:

We started making the apartment livable, built all of our furniture, passed the written DMV test, got internet access, went to the Visa information meeting, and had a meeting with other post docs. This week was kind of productive and we managed to get settled in our new home.

Conclusion: so far, so good

We had a hard start, got lucky with the apartments and the car and managed to play our cards well. Our experience shows that you need at least one week to organize an apartment and a car. The second week is optional and helps to construct all the furniture and to get settled in. During your first two weeks you have to accept to hit rock bottom once or twice - the culture shock combined with a huge list of stuff that you need to do can be demanding and tough, but you'll get over it. Plan well and it will end well.

One of the things we have to get used to around here is that the culture is so different: everything is built on the cheap and optimized for low cost of ownership combined with high current costs. Apartments have no isolation but gas heating, cars are cheap but need more fuel per distance compared to European cars.

We have settled for the next year and we are ready for visitors. We already partially explored the area but there is still lots to see and we are always happy about people who join us!