株式会社LOWWS プログラマーのルボミル・ポポヴ(Lyubomir Popov)にインタビューし、 現在携わっているプロジェクトの中で興味深い技術や最新の知見について聞いていくコーナーです。
今回はペネトレーションテストの重要性について聞きました。
日本語の記事に続いて英語の記事があります
This is a segment where we interview Lyubomir Popov, a programmer at LOWWS Inc., to explore interesting technologies and the latest insights from his current projects.
We asked about the importance of penetration testing this time.
The English article follows the Japanese article.
ペネトレーションテストの必要性
ルボ:ウェブサイトのセキュリティ評価は、別名でペネトレーションテストと呼ばれることもあります。これは、ウェブサイトのセキュリティを「ブラックボックス」としてチェックするテストです。つまり、そのウェブサイトのソースコードにはアクセスせず、IPアドレスやドメイン名だけを使って調査を行います。
そして、そのウェブサイトに存在する可能性のある脆弱性を探します。よく知られている脆弱性のリストとしては、OWASP Top 10 というものがあります。これは毎年、ウェブサイト全体で最も多い、代表的な脆弱性をまとめたリストです。
たとえば、クロスサイトスクリプティング(XSS)という攻撃手法があります。これは、攻撃者がアプリケーションのユーザーの操作方法を乗っ取る手法です。たとえば、テキストフィールドに悪意のあるJavaScriptを埋め込み、それが後から他のユーザーによって閲覧されることでスクリプトが実行される仕組みなどです。
この攻撃により、サービス拒否(DoS)を起こすことも可能です。つまり、そのフィールドを表示したユーザーにとって、ウェブサイトが正しく表示されなくなります。さらに深刻なケースとしては、セキュリティの侵害にもつながります。
これがクロスサイトリクエストフォージェリ(CSRF)と組み合わさると、たとえばユーザーの同意なしにパスワードを変更することが可能になります。つまり、改ざんされたフィールドをユーザーが表示した瞬間に、パスワードが自動的に変更され、攻撃者がそのユーザーとしてログインできるようになります。または、パスワードやクレジットカード情報などのデータを抜き取ることにも使われます。
たとえば、顧客がウェブサイトにクレジットカード情報を入力しているときに、そのサイトが脆弱で攻撃されていた場合、その情報が盗まれるリスクがあります。
他にも、SQLインジェクションという脆弱性があります。入力データが正しくサニタイズされていない場合、それが原因でウェブサイトやプラットフォームが侵害されることがあります。たとえば、ユーザーのログイン情報や機密情報など、データベースから直接引き出される可能性があります。
XML外部エンティティ(XXE)攻撃もあります。プラットフォームがXMLを解析する場合、外部ファイルを含めるためのパラメータがあります。これが適切にサニタイズされていなかったり、設定が不適切だったりすると、攻撃者により、設定ファイルやパスワードを含む機密ファイルを抜き取られる可能性があります。
コマンドインジェクションも代表的な攻撃です。たとえば、IPアドレスやドメイン名を入力すると、それに基づいて外部コマンドを実行するような機能があるとします。ここで入力がサニタイズされていないと、コマンドの後にパイプ記号(|)を使って別のコマンドを実行させることができます。たとえば、ファイル一覧を表示させるコマンドや、サーバー内のファイルを削除する rm コマンドなどが実行可能になります。
このような理由から、入力内容の検証とサニタイズはとても重要です。
次に、サーバーサイドリクエストフォージェリ(SSRF)という攻撃もあります。たとえば、製品の在庫をチェックするために外部サービスにリクエストを送るウェブサービスがあるとします。このリクエスト先URLを操作できてしまうと、本来外部からはアクセスできない内部ネットワーク上のサービスにアクセスすることができます。
たとえば、管理画面は通常外部からのアクセスにはユーザー名とパスワードが必要ですが、内部ネットワークからのアクセスには制限がない場合があります。このようなケースでは、SSRFを利用して内部のURLにリクエストを送り、パスワードなしで管理画面にアクセスできてしまいます。これにより、ファイアウォールの設定を変更したり、外部からアクセスできないはずのデータベースにアクセスすることが可能になります。
こうしたさまざまな攻撃に対して、ウェブプラットフォームは脆弱である可能性があります。そのため、セキュリティテストはとても重要です。
また、セキュリティテストはプロジェクトチームとは別の外部の人間が行うのが望ましいです。開発者自身が「自分の書いたコードは正しい」と思い込んで見落としてしまうケースもあるからです。外部の視点からチェックすることで、見逃されていた設定ミスや脆弱性が見つかることがあります。
ナオト:クライアントは大きな企業ですか?なぜペネトレーションテストが必要だったのですか?
ルボ:彼らは、自社のシステムに見落としがないか確認したかったのです。プロジェクトの規模に関係なく、このようなテストは役立ちます。開発中にうっかり設定ミスをしたり、思いもよらない方法で攻撃を受けることもあるからです。
ナオト:では、小規模なプロジェクトでもこのようなテストは必要ということですね?
ルボ:はい、特に機密情報を扱う場合には外部の視点でセキュリティをチェックするのがよいです。万が一、機密情報がネット上に流出したら大変です。最近では、ダークネットを監視するサービスもあります。メールアドレスを登録しておけば、その情報が流出した際に通知を受け取ることができます。
たとえば、あるサービスで自分のアカウント情報が漏れた場合、通知が届きます。パスワードも一緒に流出している場合もあります。これは、サイト側がパスワードをハッシュ化していないためで、本来あってはならないことです。それでも、そういうサイトは存在します。
そのため、異なるサービスごとに異なるパスワードを設定することが大切です。パスワードの使い回しは危険です。
エンジニア文化には、コードレビューやシステムチェックの習慣があります。これは堅牢なシステムを作るうえでとても重要です。
オープンソースソフトウェアの強みの一つは、コードが公開されているため、誰でも確認でき、脆弱性を報告することができる点です。悪用する人もいるかもしれませんが、多くの善意ある人たちが問題を報告してくれます。
HackerOneのようなプラットフォームを使えば、セキュリティの専門家に依頼して、ウェブサイトやプラットフォームの脆弱性をチェックしてもらうこともできます。
この分野は急速に進化しています。最近のAIの発展もあり、セキュリティテストやペネトレーションテストにもAIが活用され始めています。これにより、テストのスピードやコスト面でも効率化が図られ、セキュリティの専門家でない人でも自身のプロジェクトの安全性をチェックできるようになるかもしれません。
ナオト:AIでテストができるとは知りませんでした。
ルボ:AIは本当にいろんな分野に活用されています。セキュリティもその一つで、今後ますます発展していくと思います。
The Need for Pen Testing
Lyubo: Website security assessments or penetration tests—another way to call them. For these, you need to check the website’s security as a black box. You don’t have access to the source code. You just have the IP and domain name, and you start looking for vulnerabilities in the website.
A good list of the most common vulnerabilities is the OWASP Top 10. Every year, they publish a list of the top vulnerabilities found in websites.
One example is the cross-site scripting (XSS) attack. It’s a vulnerability that allows an attacker to compromise how users interact with the application—for example, by injecting custom JavaScript into a text field that is then executed when someone else views the content. This can lead to denial of service, such as breaking the website for the user, or even more serious security issues.
In combination with cross-site request forgery (CSRF), for example, you could change a user’s password without their consent. So, if a website is vulnerable, and someone opens a field that was modified with malicious code, their password could be changed automatically, allowing an attacker to log in as them. It can also be used to extract sensitive data, like passwords or credit card information, during the input process.
Another vulnerability is SQL injection. If the data entered into a field isn’t properly sanitized, it can lead to unauthorized access to the platform. Attackers could extract login data or other sensitive information directly from the database.
There’s also XML External Entity (XXE) attacks. If a platform is parsing XML, some parameters in XML allow external file inclusion. If this isn’t configured correctly, an attacker could extract sensitive files, such as configuration files or those containing passwords.
Another is command injection. For example, if a platform allows users to enter an IP or domain to ping, and the input is not sanitized, an attacker might inject additional commands like listing or deleting files on the server.
That’s why input validation and sanitation are critical.
Another type is Server-Side Request Forgery (SSRF). Let’s say you have a website checking product availability via external services. If you can manipulate the URL being called, you might access internal services that are otherwise not accessible from outside the network. For instance, an internal admin panel that doesn’t require authentication from inside the network could be exploited using SSRF. That could lead to changes in firewall configurations or access to internal databases.
There are many different types of attacks that a web platform can be vulnerable to. That’s why it’s important to conduct security testing. It’s also best if the test is done by someone outside the project team. Developers often overlook issues because they believe their implementation is correct. An outsider can spot misconfigurations or vulnerabilities that the original team missed.
Naoto: I’m curious about your client. Is the client a big company? Why did they need a penetration test?
Lyubo: They wanted to see if there were any vulnerabilities they had missed. It’s good to run these tests regardless of company size. Developers can unintentionally make configurations that open the door to attackers.
Naoto: So even small projects need this kind of test?
Lyubo: Yes, especially if sensitive data is involved. An outside security check is good to have. Leaking sensitive information is a serious issue. That’s why there are darknet monitoring services. You can register your email, and they’ll monitor for data leaks and notify you if any of your accounts have been compromised. Sometimes leaked data includes passwords, especially if the site didn’t hash them. This is why it’s important to use different passwords for different services. Reusing passwords is risky.
Naoto: Engineers seem to have a culture of code reviews or system checks.
Lyubo: Yes, that’s an important part of creating robust systems. Open-source software is good at this because the code is visible, so anyone can find and report vulnerabilities. Yes, bad actors can also see the code, but many good people will report issues so they can be fixed.
There are platforms like HackerOne where you can hire people to test your website or platform for vulnerabilities. The security space is evolving rapidly. With the rise of AI, people are beginning to use it for penetration testing too. AI could make testing faster and more affordable. Even non-security experts might soon be able to use AI to test their projects.
Naoto: I didn’t know you could use AI for tests.
Lyubo: You can use AI for many things. It’s evolving across many areas.
この記事はインタビューをもとにAIを使用して作成されています。 This article was created using AI based on interviews.