Posts Tagged ‘security’

CNVD-2010-00979

Monday, June 21st, 2010

互联网是一个很容易以讹传讹的地方,这大概是人们不满意 google 的地方,要搞个知识搜索取而代之。

最近金山毒霸和360杀毒口水之争,我无意关心了一把。看到被多家网站(包括人民网)转发的金山网盾再陷新的诚信危机“漏洞门”,其中提到

5月24日,中国国家信息安全漏洞库证实金山网盾存在一个高危的内核本地提权漏洞(国家漏洞库编号:CNVD-2010-00979),并公布了该漏洞利用相关细节。同一天,国外权威漏洞机构Secunia研究并收录了金山网盾这一漏洞,同时对该漏洞进行了自己的解释和归类(SA ID:SA39916)。国内外两大权威安全机构同时证实金山网盾存在高危漏洞,把此前一直高调否认软件有漏洞的金山公司置于非常尴尬的境地。

我好奇了一下,上 cnvd 和 secunia 去查了一下,CNVD-2010-00979 和 SA ID:SA39916 讲的是多个供应商”rpc.pcnfsd”整数溢出漏洞,跟金山网盾无关,真不知道这个刹有其事的报导从何而来。

虽然CNVD-2010-00979 跟金山网盾无关,但我有感觉无风不起浪,因为这是在 cnvd 上搜索金山网盾的结果:

Google search result cached something

Google search result cached something

但实际查看被缓存的页面却什么也没有:

Nothing on cached page

Nothing on cached page

或许 cnvd 只把详细信息公开给了 google spider;或许这其中有太多的内幕是我们常人无法知道的……

Discovery: PhProxy & CHtml

Tuesday, June 15th, 2010

我认为突破访问限制的终级方案是 VPN,可是设置 VPN 的技术含量有点高,到现在我还搞不掂 OpenVPN,只能徘徊于 PPTP。今天发现可爱的 php 也有了 proxy(或许早就有了,我不知道罢了),虽然我用不着,但对国内的朋友们确实是天大的福音。简单易行,一分钟就能搭一个!

我只发现 phproxy 三个不大的缺陷:

  1. 无法代理流文件(比如无法看 youtube 上的 video,但访问 youtube 没问题)
  2. 因为 phproxy 工具栏在网页顶部,如果代理网页在相同位置绝对定位,则会重叠在一起(比如 wikipedia,我想修改一下 style.css 就好了,或者做一个自动隐藏的工具栏)
  3. 有些被代理的网页自检而跳出代理,重定向到原来的 url(比如 google spreadsheet)

牛人真不少,还有一个 CHtml,竟然用 recaptcha 去实现突破,构思非常巧妙。

Magento product model is read only to frontend controller

Wednesday, June 2nd, 2010

最近我写了一个小程序:Deal of the day for Magento。

它主要有以下功能:
每天定时按预设权重随机抽取一个产品作为 deal of the day;在产品名称前加上 “Deal of the day:” 字样;设定它的 is_deal_of_the_day 为 true;设定一个 special price;归类到一个 sales category 下;同时把昨天的已过时的 deal 重置为原先状态。

Magento 支持 cronjob 我是知道的,但测试的第一个环节倒不是这个程序能否定时启动,而是程序能否完成独立完成这一系列的操作。为求简单,我把整个过程写在一个 frontend controller 的 indexAction 里,然后用访问 url 的方式去触发这个过程。我没有用 backend controller,因为我考虑到 Magento wiki 上介绍的 cronjob 万一不管用(之前我没有用过 Magento conjob),我还可以用 curl + linux crontab (这个我很熟)去触发这个过程。当然我会把这个 url 做得谁都猜不到,以策安全。

但是,在 frontend controller 里一运行到 $product->save() 或 $productCollection->save(),就抛出以下错误:

Warning: Invalid argument supplied for foreach() in /path/to/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 995

初看这个错误,我总以为是 product EAV 某个 attribute 损坏了,因为我经常修改 product attributes,一不小心,改坏了哪个不该改的 attribute 也不奇怪。可难就难在 attributes 那么多,我无法知道哪个坏了啊。我围绕着 Abstract.php 995 行左看右看,没有头绪整整一个下午,最后发现,如果把同样代码放在 backend controller 里,product 就可以 save 了。

整整一个下午的时间只给我一个启示:product model 在 frontend 是只读的,估计又属于 Magento 安全机制范畴。联想到以前碰到的一个问题:如果用户在 Magento backend 已登录,能否在 frontend 探知,以便针对 backend 用户访问 frontend 时显示不对外人开放的内容(就像 wordpress 那样会在每个 post 显示 edit link)。但 Magento 把 backend 和 frontend 严格地分开,我研究好久,也没有让 frontend 访问到 backend session。

我想,打破 Magento 苦心经营的安全机制去做一些事是不可取的。比如 deal of the day 定时切换的功能,就用 magento 鼓励的 cron.php 去启动,非常的方便,也非常的安全。只是我空下来还是想钻牛角尖: Magento 是怎么把 backend 和 frontend 严格地分开的?只有知道了原理,如果、万一、假如、倘若我要 frontend 执行 backend 操作,也能做到了。

Absolutely secure online banking

Saturday, April 10th, 2010

一年前我老板中了个毒导致银行账号密码失窃差点损失7,800镑,之后他来问我公司应该建立怎么的安全制度(security protocol)。

我认为,要绝对的安全很容易,但往往增强安全的同时给用户日常操作带来不便,抵消了网上银行的优势。如何加强安全又不失方便性?我当时的解决方案是:

  1. 设立一台独立主机服务器,打上所有的安全补丁,启用必要的防火墙。服务器上只要有个浏览器,其他的都是不必要的。建议使用Firefox with Linux。
  2. 客户端以ssh+vnc方式连入服务器。
  3. 客户端连入服务器后,只能操作网上银行,不得浏览其他任何网站,也不得进行其他任何操作。

第2步是个技术活,可以保证客户端即使在中木马等病毒的情况下,病毒也无法探知客户端通过服务器中转的输入。除非病毒能监视并分析所有的键盘、鼠标操作。

第3步是关键,必须严格执行。安全隐患大多是人为的因素,如何用户没有好的安全意识,再好的技术支持也枉然。

但这个方案未能得到贯彻。没过几天老板好了伤疤忘了痛,仍用日常电脑登录网上银行。在我看来不复杂的绝对安全的方案对他来说还是太复杂了,没有方便性的方案就不是解决方案。如何保证网上银行的绝对安全作为悬而未决的课题在我脑袋里盘绕了一年,直到最近尝试了 Chromium OS,我看到曙光。

稍后谈谈我对 Chromium OS 的看法。

OpenPassword

Thursday, April 1st, 2010

Inspired by OpenId, I want to start a project – OpenPassword.

What is it for?
People are hesitate to register themselves from site to site. One of the reasons is people are afraid of giving password to the web sites they do not trust much. Most people do not have big memory, so they have to use the same password for all web sites. They may or may not aware that any webmaster / web owner who has access to the password database could try the same password on other sites (or even worse – for online banking). Whether people’s passwords are in safe depends on how honest the webmaster / web owner is. Even the webmaster / web owner is honest, does he have basic skills to keep password in safe? I see a lot of web sites save passwords unencrypted, which could be a disaster.

OpenId comes to solve this problem. But currently not all web sites support OpenId. What if you are in a position you have to use some web sites which do not support OpenId? You have to take care of security yourself. My proposal is:

  1. You register different web sites with different passwords.
  2. The passwords are generated with one-way encryption.
  3. You host encryption algorithm and salt in a safe place, so you do not need remember the passwords. Every time you need them, you generate / retrieve them on the fly.

My worry about Linksys wireless security

Monday, December 14th, 2009

前文提到 Linksys IP Camera 只能连入 Linksys wireless router,一开始就不喜欢厂家设置人为技术障碍的做法。细想之下,更觉得 Linksys wireless 安全机制堪忧。

因为 Linksys WVC210 wireless IP camera 在设置无线联网时,只问一个 SSID,只要是 Linksys wireless router,不需密码就自动联入?如果是别人家的 Linksys wireless router 怎么办?虽然我凭着一个 Linksys WVC210 wireless IP camera 也控制不了别人家的网络设备,但如果我能对 Linksys WVC210 wireless IP camera 进行编程,是不是就相当于在别人家放置了颗隐形炸弹?Linksys wireless 或许有它独到之处,或许能隔离自动联网的设备,但我总觉得 wireless device isolation 不如直接用 password 来得更安全(至少心理上更舒服)。

Mybookworld is not safe

Thursday, November 26th, 2009

我的 Mybookworld samba service 建有若干用户,各自的目录是凭各自的密码访问。昨天发现,Mybookworld 竟然不再问密码,任由我畅行在各个用户目录。Mybookworld 有一个 ip address 和一个自称的 device name,还有一个路由器指派它的 device name。凭前二者访问仍然正常,只是凭路由器指派的 device name 访问时密码失效。

我刚开始还以为我上次误点了“记住密码”,运行

net use * /d

Mybookworld 还是任由我畅通无阻。奇了怪了,难道 windows 有其他我不知道的地方记住了访问密码?转念一想,不是 windows 的原因,因为我不可能多次为多个用户误点“记住密码”。

于是重启 Mybookworld,问题依旧。正好有个 firmware 更新,更新后问题还是依旧。没辙了!

原本准备在 internet 上开放对 Mybookworld 的 ssh 访问,这下打消主意 —— Mybookworld 不够安全,samba 会出这等问题,保不准 ssh 也会出问题。

别说我是事后诸葛亮,刚拿到 Mybookworld 时,我看了一下它的配置,就觉得它很容易出现安全漏洞。举个例子:用 Mybookworld 自带的 web interface 创建的用户并不是 Linux 用户,这些用户属组全是 root:jewab,使用 root 就是一个非常不好的 bad practice,况且权限控制依赖于 Mybookworld 自带的程序,一点也没用到 Linux 强大的权限控制。开发 Mybookworld 的人水平再高,难道能高到抛弃一套完美的机制自搞一套?

再举个例子,启用 Mybookworld nfs 服务时可以指定 IP Allowed,但是 /etc/exports 却是这么写的

/nfs/myname *(rw,all_squash,sync,insecure,anonuid=65534,anongid=65534)

我非常不理解,nfs 服务明明可以限定 IP,然而 Mybookworld 又不用它,又在自搞一套。可它自搞的一套非常地不稳定,经常发生 allow list 上的用户不许访问。我不知道会不会有 deny list 上的用户反而被允许,那就更糟了。

PayPal Spoof

Tuesday, September 22nd, 2009
PayPal Looks Like Phishing

An email from PayPal: looks like phishing

I had an email from PayPal a while ago. I believe it was sent by some careless staff of PayPal.

PayPal always remind people aware of phishing emails. At the bottom of the email, it says – How do I know this is not a spoof email? Spoof or ‘phishing’ emails tend to have generic greetings such as “Dear PayPal member”. Email from PayPal will always address you by your first and last name.

However, this particular email address me “Dear First Name Last Name”.

Email images not showing up in IE8

Saturday, July 18th, 2009

I was asked by someone why on his PC images in html emails were not displayed.

He was using google mail web interface (SSL enabled – Automatically enforce Secure Socket Layer (SSL) connections when your users access Gmail, Calendar, Docs, and Sites) and IE8. I was using the same google mail but Firefox. On my PC the images in html emails could show up. So I thought the problem was with some settings in IE8.

Following this thought I found it was a setting in IE8: Internet Options -> Security -> Custom Level -> Miscellaneous -> Display mixed content. If it was disabled, IE8 would not http content in a page accessed via https. There should be a prompt before IE8 permanently disable it, but I guess few people can understand this security warning.

IE8 mixed content security warning

IE8 mixed content security warning

This security setting is not only affecting email pages, but email pages are most likely being affected, specially marketing emails. Will we see more eshot programmes embedding img src with https?

Bonjour is not virus

Friday, April 24th, 2009
Bonjour bundled with Sarifi

Bonjour bundled with Sarifi

不知道 Bonjour 是怎么进入到我的电脑的,我不用Sarifi已经好多年。我不喜欢Apple的东西,装Sarifi只是为了测试,测试完毕重装系统也没再想着把Sarifi装回来。

第一次注意到 Bonjour 进程的存在着实让我担心了一把,还以为是什么病毒,Google 了一下才知道是 Apple 开发的一个玩意儿才打消了我的顾虑。今天我再次安装Sarifi,里面提到 Bonjour,因为事先跟 Bonjour 有过接触,所以注意到了,拷屏下来告诉初识 Bonjour 的人,Bonjour 是无害的(但我也没意识到 Bonjour 有什么好处)。