2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ディレクトリリスティング とは

Last updated at Posted at 2022-11-26

勉強前イメージ

ディレクトリを見るやつ?

調査

ディレクトリリスティング とは

webサーバにおいて本来見えないはずのディレクトリ配下のファイルの一覧を表示させる攻撃方法です。
ディレクトリを指定したアクセスがあるとそのディレクトリに含まれるファイルやディレクトリの一覧が見えてしまいます。

例えば、以下のようなディレクトリ構成のwebサーバがあったとします。

[root@localhost html]# tree
.
├── index.html
└── test_dir
    ├── a.html
    ├── b.html
    └── c.html

http://[IPアドレス]/test_dir/ を指定してwebページでアクセスを行うと以下のようにディレクトリの中のファイルが見えてしまいます。
これを悪用して隠しファイルや情報を読み取られてしまう可能性があります。
また、 ディレクトリトラバーサル になってしまうこともあります。

1Index of _test_dir — Mozilla Firefox 2022-11-26 14.png

このディレクトリ内ののファイルを表示する機能はwebサーバの機能で / で終わるURLを指定すると表示されます。
apacheだとDirectoryIndexで設定されています。
DirectoryIndexは以下の機能があります。

  • indexのファイルがあればそれを表示
  • indexのファイルがなければ一覧を表示

見えないようにするには?

/etc/httpd/httpd.conf にある Indexes を削除することで見えなくすることは可能です。

....
    Options Indexes FollowSymLinks
    Options FollowSymLinks
....
service httpd restart

設定後は以下のように見えなくなりました。

2403 Forbidden — Mozilla Firefox 2022-11-26 14.53.0.png

勉強後イメージ

確かにファイル見えちゃうと攻撃できたりしちゃうよね....

参考

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?