mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
142 lines
12 KiB
Markdown
142 lines
12 KiB
Markdown
# CloudFlareを明らかにする
|
||
|
||
{{#include ../../banners/hacktricks-training.md}}
|
||
|
||
## Cloudflareを明らかにするための一般的な手法
|
||
|
||
- ドメインの**履歴DNSレコード**を提供するサービスを使用できます。ウェブページが以前使用されていたIPアドレスで実行されている可能性があります。
|
||
- **履歴SSL証明書**を確認することで、オリジンIPアドレスを指している可能性があります。
|
||
- **IPに直接ポイントしている他のサブドメインのDNSレコード**も確認してください。他のサブドメインが同じサーバーを指している可能性があります(FTP、メール、または他のサービスを提供するために)。
|
||
- ウェブアプリケーション内に**SSRF**を見つけた場合、それを悪用してサーバーのIPアドレスを取得できます。
|
||
- shodanなどのブラウザでウェブページのユニークな文字列を検索してください(おそらくgoogleや類似のものも?)。そのコンテンツを持つIPアドレスを見つけることができるかもしれません。
|
||
- 同様に、ユニークな文字列を探す代わりに、ツールを使ってファビコンアイコンを検索できます: [https://github.com/karma9874/CloudFlare-IP](https://github.com/karma9874/CloudFlare-IP) または [https://github.com/pielco11/fav-up](https://github.com/pielco11/fav-up)
|
||
- これは非常に頻繁には機能しませんが、サーバーがIPアドレスでアクセスされたときに同じ応答を送信する必要がありますが、何が起こるかわかりません。
|
||
|
||
## Cloudflareを明らかにするためのツール
|
||
|
||
- [http://www.crimeflare.org:82/cfs.html](http://www.crimeflare.org:82/cfs.html) または [https://crimeflare.herokuapp.com](https://crimeflare.herokuapp.com) でドメインを検索します。あるいは、そのAPIを使用するツール [CloudPeler](https://github.com/zidansec/CloudPeler) を使用します。
|
||
- [https://leaked.site/index.php?resolver/cloudflare.0/](https://leaked.site/index.php?resolver/cloudflare.0/) でドメインを検索します。
|
||
- [**CloudFlair**](https://github.com/christophetd/CloudFlair) は、ドメイン名を含むCensys証明書を使用して検索し、その証明書内のIPv4を検索し、最後にそれらのIPでウェブページにアクセスしようとするツールです。
|
||
- [**CloakQuest3r**](https://github.com/spyboy-productions/CloakQuest3r): CloakQuest3rは、Cloudflareや他の代替手段によって保護されたウェブサイトの真のIPアドレスを明らかにするために慎重に作成された強力なPythonツールです。その主な目的は、Cloudflareの保護シールドの背後に隠されたウェブサーバーの実際のIPアドレスを正確に識別することです。
|
||
- [Censys](https://search.censys.io/)
|
||
- [Shodan](https://shodan.io/)
|
||
- [Bypass-firewalls-by-DNS-history](https://github.com/vincentcox/bypass-firewalls-by-DNS-history)
|
||
- ウェブページが存在する可能性のあるIPのセットがある場合は、[https://github.com/hakluke/hakoriginfinder](https://github.com/hakluke/hakoriginfinder) を使用できます。
|
||
```bash
|
||
# You can check if the tool is working with
|
||
prips 1.0.0.0/30 | hakoriginfinder -h one.one.one.one
|
||
|
||
# If you know the company is using AWS you could use the previous tool to search the
|
||
## web page inside the EC2 IPs
|
||
DOMAIN=something.com
|
||
WIDE_REGION=us
|
||
for ir in `curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.service=="EC2") | select(.region|test("^us")) | .ip_prefix'`; do
|
||
echo "Checking $ir"
|
||
prips $ir | hakoriginfinder -h "$DOMAIN"
|
||
done
|
||
```
|
||
## CloudインフラからCloudflareを明らかにする
|
||
|
||
AWSマシンのために行われた場合でも、他のクラウドプロバイダーに対しても行うことができます。
|
||
|
||
このプロセスの詳細については、以下を確認してください:
|
||
|
||
{{#ref}}
|
||
https://trickest.com/blog/cloudflare-bypass-discover-ip-addresses-aws/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks
|
||
{{#endref}}
|
||
```bash
|
||
# Find open ports
|
||
sudo masscan --max-rate 10000 -p80,443 $(curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.service=="EC2") | .ip_prefix' | tr '\n' ' ') | grep "open" > all_open.txt
|
||
# Format results
|
||
cat all_open.txt | sed 's,.*port \(.*\)/tcp on \(.*\),\2:\1,' | tr -d " " > all_open_formated.txt
|
||
# Search actual web pages
|
||
httpx -silent -threads 200 -l all_open_formated.txt -random-agent -follow-redirects -json -no-color -o webs.json
|
||
# Format web results and remove eternal redirects
|
||
cat webs.json | jq -r "select((.failed==false) and (.chain_status_codes | length) < 9) | .url" | sort -u > aws_webs.json
|
||
|
||
# Search via Host header
|
||
httpx -json -no-color -list aws_webs.json -header Host: cloudflare.malwareworld.com -threads 250 -random-agent -follow-redirects -o web_checks.json
|
||
```
|
||
## Cloudflareを通じてCloudflareをバイパスする
|
||
|
||
### 認証されたオリジンプル
|
||
|
||
このメカニズムは、**Cloudflareのリバースプロキシ**サーバーと**オリジン**サーバー間の接続を認証するために**クライアント**[**SSL証明書**](https://socradar.io/how-to-monitor-your-ssl-certificates-expiration-easily-and-why/)に依存しています。これは**mTLS**と呼ばれます。
|
||
|
||
顧客は独自の証明書を設定する代わりに、Cloudflareの証明書を使用して、**テナントに関係なく**Cloudflareからの接続を許可できます。
|
||
|
||
> [!CAUTION]
|
||
> したがって、攻撃者は単に**Cloudflareの証明書を使用してCloudflareにドメインを設定し、**それを**被害者**ドメインの**IP**アドレスにポイントすることができます。この方法では、彼のドメインを完全に保護されていない状態に設定し、Cloudflareは送信されたリクエストを保護しません。
|
||
|
||
詳細は[**こちら**](https://socradar.io/cloudflare-protection-bypass-vulnerability-on-threat-actors-radar/)。
|
||
|
||
### CloudflareのIPアドレスをホワイトリストに追加
|
||
|
||
これにより、**Cloudflareの**IPアドレス範囲から発信されない接続が**拒否されます**。これは、攻撃者が単に**Cloudflareに自分のドメインをポイントして**被害者の**IP**アドレスを攻撃するという前の設定にも脆弱です。
|
||
|
||
詳細は[**こちら**](https://socradar.io/cloudflare-protection-bypass-vulnerability-on-threat-actors-radar/)。
|
||
|
||
## スクレイピングのためのCloudflareのバイパス
|
||
|
||
### キャッシュ
|
||
|
||
時には、単にCloudflareをバイパスしてウェブページをスクレイピングしたいだけです。これにはいくつかのオプションがあります:
|
||
|
||
- Googleキャッシュを使用:`https://webcache.googleusercontent.com/search?q=cache:https://www.petsathome.com/shop/en/pets/dog`
|
||
- [https://archive.org/web/](https://archive.org/web/)などの他のキャッシュサービスを使用
|
||
|
||
### ツール
|
||
|
||
以下のようなツールは、Cloudflareのスクレイピングに対する保護をバイパスすることができます(またはバイパスできたことがあります):
|
||
|
||
- [https://github.com/sarperavci/CloudflareBypassForScraping](https://github.com/sarperavci/CloudflareBypassForScraping)
|
||
|
||
### Cloudflareソルバー
|
||
|
||
いくつかのCloudflareソルバーが開発されています:
|
||
|
||
- [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr)
|
||
- [cloudscraper](https://github.com/VeNoMouS/cloudscraper) [ガイドはこちら](https://scrapeops.io/python-web-scraping-playbook/python-cloudscraper/)
|
||
- [cloudflare-scrape](https://github.com/Anorov/cloudflare-scrape)
|
||
- [CloudflareSolverRe](https://github.com/RyuzakiH/CloudflareSolverRe)
|
||
- [Cloudflare-IUAM-Solver](https://github.com/ninja-beans/cloudflare-iuam-solver)
|
||
- [cloudflare-bypass](https://github.com/devgianlu/cloudflare-bypass) \[アーカイブ済み\]
|
||
- [CloudflareSolverRe](https://github.com/RyuzakiH/CloudflareSolverRe)
|
||
|
||
### 強化されたヘッドレスブラウザ <a href="#option-4-scrape-with-fortified-headless-browsers" id="option-4-scrape-with-fortified-headless-browsers"></a>
|
||
|
||
自動化されたブラウザとして検出されないヘッドレスブラウザを使用します(そのためにカスタマイズが必要な場合があります)。いくつかのオプションは:
|
||
|
||
- **Puppeteer:** [puppeteer](https://github.com/puppeteer/puppeteer)用の[ステルスプラグイン](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth)。
|
||
- **Playwright:** [ステルスプラグイン](https://www.npmjs.com/package/playwright-stealth)が近日中にPlaywrightに登場します。進捗は[こちら](https://github.com/berstend/puppeteer-extra/issues/454)と[こちら](https://github.com/berstend/puppeteer-extra/tree/master/packages/playwright-extra)でフォローしてください。
|
||
- **Selenium:** [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver)は最適化されたSelenium Chromedriverパッチです。
|
||
|
||
### Cloudflare内蔵のバイパスを持つスマートプロキシ <a href="#option-5-smart-proxy-with-cloudflare-built-in-bypass" id="option-5-smart-proxy-with-cloudflare-built-in-bypass"></a>
|
||
|
||
**スマートプロキシ**は、Cloudflareのセキュリティ対策を打破することを目的とした専門企業によって継続的に更新されています(それが彼らのビジネスです)。
|
||
|
||
その中には:
|
||
|
||
- [ScraperAPI](https://www.scraperapi.com/?fp_ref=scrapeops)
|
||
- [Scrapingbee](https://www.scrapingbee.com/?fpr=scrapeops)
|
||
- [Oxylabs](https://oxylabs.go2cloud.org/aff_c?offer_id=7&aff_id=379&url_id=32)
|
||
- [Smartproxy](https://prf.hn/click/camref:1100loxdG/[p_id:1100l442001]/destination:https%3A%2F%2Fsmartproxy.com%2Fscraping%2Fweb)は、独自のCloudflareバイパスメカニズムで知られています。
|
||
|
||
最適化されたソリューションを求める方には、[ScrapeOps Proxy Aggregator](https://scrapeops.io/proxy-aggregator/)が際立っています。このサービスは、20以上のプロキシプロバイダーを単一のAPIに統合し、ターゲットドメインに対して最適でコスト効果の高いプロキシを自動的に選択するため、Cloudflareの防御を回避するための優れたオプションを提供します。
|
||
|
||
### Cloudflareのアンチボット保護をリバースエンジニアリング <a href="#option-6-reverse-engineer-cloudflare-anti-bot-protection" id="option-6-reverse-engineer-cloudflare-anti-bot-protection"></a>
|
||
|
||
Cloudflareのアンチボット対策をリバースエンジニアリングすることは、スマートプロキシプロバイダーによって使用される戦術であり、多くのヘッドレスブラウザを運用する高コストなしで広範なウェブスクレイピングに適しています。
|
||
|
||
**利点:** この方法は、Cloudflareのチェックを特にターゲットにした非常に効率的なバイパスを作成することを可能にし、大規模な操作に最適です。
|
||
|
||
**欠点:** 欠点は、Cloudflareの意図的に不明瞭なアンチボットシステムを理解し、欺くことに関わる複雑さであり、Cloudflareが保護を強化するにつれて、さまざまな戦略をテストし、バイパスを更新するための継続的な努力が必要です。
|
||
|
||
これを行う方法についての詳細は、[元の記事](https://scrapeops.io/web-scraping-playbook/how-to-bypass-cloudflare/)で見つけてください。
|
||
|
||
## 参考文献
|
||
|
||
- [https://scrapeops.io/web-scraping-playbook/how-to-bypass-cloudflare/](https://scrapeops.io/web-scraping-playbook/how-to-bypass-cloudflare/)
|
||
|
||
{{#include ../../banners/hacktricks-training.md}}
|