Check then use is a dangerous security pattern

A commentator here recently noted the danger ofthe Unix pattern of stat()'ing a filename, checking to see if the statresults look good, and then open()'ing the file. The problem is thatin many cases an attacker can change what the filename is pointing tobetween the time you stat() it and when you open() it, so that youcheck a harmless thing but open a dangerous thing.

In thinking about this, I came to realize that this is an example


努力偷懶(關島之行之二)

Sheraton Laguna Guam是偏遠了點,但如果像我用巴士代步,也很方便的


Continue reading...

Doing one-shot booting with GRUB

For a long time, one of the advantages of LILO over GRUB was that LILO had a one-shot mode, where it would make an entry thedefault for only one reboot. I've been pleased to recently discover thatGRUB can now do this too, although in the grand Linux tradition it's nottoo documented.

The magic incantation is the GRUB shell command:

savedefault --default= --once

(This has to be issued in a GRUB shell, such as what you


Implicit generalized open()'s are dangerous

A number of languages have open() functions that are generalized bydefault; they open more than plain files, sometimes far more. Suchfunctions are dangerous bear traps lying in wait for the unwary andinsufficiently paranoid, because what the programmer thinks is a simplefile open may be something very different and more dangerous. Inturn, this means that all an attacker needs to do is find some way to supply a 'file name' that your programwill try to open.

There's two core problems: the


A more abstract view of the generalized open() issue

Part of the generalized open() problem is thatsuch generalized open() s silently cross what I will call 'securitycontexts'. Here a security context is both what you can do and wherethe data is coming from; read versus write versus run a pipe, localfiles versus remote URLs, and so on.

When something is security sensitive (and open() is here), it shouldeither be explicit about what security context it is operating in,or it should at least be explicit about the


Come, sweet death

kaworu

渚薰又再一次死在碇真嗣手上。

在電視版裏,渚薰是個很特別的角色:他只出現一集,但卻是最受歡迎的角色之一。他的對白不多,但句句都似乎很高深莫測。他是朋友,但也是敵人。他的樣子斯文而瘦削,但卻能使用強大的ATF


律政鴨

律政鴨

「來來來,林總,我敬您一杯!明天再陪您們到食樹皮樂園看碼頭老鼠!」Eric說得手舞足蹈,一口氣乾了手上那杯茅台,大陸豪客們都被他逗得心花怒放。這傢伙如果不做律師,大可以轉行去做鴨。

雖然Eric升做partner不過兩年

少壯派之死

少壯派之死
在中關村苦戰三日三夜,雙方終於簽妥這單PE deal。北京那班三十出頭的IT才俊,有本事從私募基金那裡弄來八億現款,難怪笑得比陳四萬還燦爛。
年輕才俊正在內地商界叱吒風雲。創造「阿里巴巴」神話的馬雲才四十

一個城市的變身(關島之行之一)


飛機上看到的塞班島最後一個畫面,真是依依不捨呢


舊地重遊,有可能是一雒冒險行為,因為幾年前好玩的地方,現在不一定好玩,幾年前好正的地方,現在可能十分把鬼.



我自己有一個親身經歷,好多年之前,我太太在曼谷一
Continue reading...

不要計較,要享受(塞班島之旅之三)

Continue reading...