Loading…
Join us at OWASP AppSec APAC 2014 !!
Thursday, March 20 • 10:30am - 11:20am
ソースコードスキャナーを選ぶ(書く)方法 / How to choose (or write) your own source code scanner

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

ソースコード診断ツールは高価なものになりがちで、かつフォールスポジティブ(誤検知)とフォールスネガティブ(見逃し)が起こりがちです。こうした問題を解決するため、XPath を使ってソースコード診断ツールを作る方法を紹介します。   

セキュリティ業界でアツいトピックのひとつに、ソースコードスキャナーがあります。しかしながら、いくつかの商用のソリューションを評価してみても、明らかに完璧だと思えるものはありません。サンプルコードのつまみ食いも見つけられませんし、良く知られているオープンソースプロジェクトのCVE脆弱性は基準になりませんし、あるコード実行脆弱性はサポートされていません。それなのに高額です。それでもわたしたちはなにがなんでもそれを信じなければなりませんし、結局のところ、自分自身でソースコードスキャナを書く事は、とってもめんどくさいし難しいことです。そうですよね。
実際は、そうではありません。いくつかの商用のスキャナーツールで、カスタマイズしたルールセットを提供できるような製品のように、オープンソースPMDプロジェクトでは、アブストラクトシンタックスツリーを活用することによってルールセット造りが可能です。 これは、AndroidやJavaのスキャン手段を自作することができることになります。PHPではどうでしょうか。
この状況を解決するため、わたしは試作品ですが自動スキャンツールを書いてみました。これは、Abstruct Syntax Tree構造を活用しており、nikicが作ったPHPパーザを使うことにより、PMDライクなPHP用のカスタマイズされたスキャナとなります。 最大の利点は、XPathをPMDのように使ってルールを作る事ができる点です。

Source code scanning is prone to false positive and negatives. And it is expensive. It is time to write our own source code scanner using XPath.

Source code scanners are one of the hottest topics in the security industry. However after evaluating some commercial solutions, it is clear that none of them are perfect. Sample code snippets cannot be detected, CVE vulnerabilities in famous open source projects are not benchmarked against, and one common code execution vulnerability is not supported. Yet, it is expensive. But we have to trust it anyways, after all, writing a source code scanner of your own is very complicated and difficult. Or is it?
Actually no. Just like some of the commercial scanners who provides customizable ruleset creation, the open source PMD project also allows the creation of ones ruleset by utilizing the Abstract Syntax Tree. This means we can create our own scanning methodologies for Android and Java web applications. But what about PHP?
To solve this situation, I wrote an experimental automation scanner, which utilize the Abstract Syntax Tree structure generated by the PHP-parser project written by nikic, and make it into a PMD like customizable scanner for PHP. And the best part is, you can write all the rules in XPath just like PMD.

Speakers
YC

Yu-Lu "Chris" Liu

Yu-Lu "Chris" Liu, security engineer at Rakuten, Inc. In his previous job, Mr. Liu was responsible for doing mobile security research, and penetration testing with multinational companies, major banks in Japan, as well as governmental websites. After he joined Rakuten, he is mostly... Read More →


Thursday March 20, 2014 10:30am - 11:20am PDT
TERRACE ROOM

Attendees (0)