PR

hostsファイルが改ざんされていないか調べる方法。

Windows10

ウィルスやマルウェアに感染した際にhostsファイルを書き換えられる場合もあり(改ざん)、そのチェック方法と修復方法です。

操作はWindows10 home で行います。

 

スポンサーリンク

hostsファイルとは

ホスト名 (ドメイン名) のデータベースが記録されたファイル。
TCP/IPを利用するコンピュータにおけるホスト名のデータベースで、IPアドレスとホスト名の対応を記述したテキストファイルである。hosts のフォーマットは、4.2BSDで登場した。

 

参考リンク: hosts – Wikipedia

hostsファイルの開き方と確認方法

「ファイル名を指定して実行」を開きます。
開き方は『Windowsキー+R』、またはタスクバーの検索ボックスから『ファイル名を指定して実行』と入力します。

hosts02

 

ファイル名を指定して実行を開いたら以下のコマンドをコピー&ペーストしOKします。

NOTEPAD C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS

hosts01

開いたテキストを確認する

正常であればhostsファイルは以下のようになっています。

Windows10/8.1/8/7の場合

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
#      127.0.0.1      localhost
#      ::1            localhost

 

・OSにより多少内容は変わるがほぼ書いていることは同じである。
・ポイントは全部始まりに「#」が付いている事を確認する。
・例) 102.54.94.97    rhino.acme.com など、「IPアドレス+ホスト名の部分」が余分に追加されていない事を確認する。

2018/6/27 追記

Windows 10 ビルド1079では少し変更がありました。

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
#      127.0.0.1      localhost
#      ::1            localhost

下から3行目に# localhost name resolution is handled within DNS itself.が追加されていました。

Windows Vista/2008の場合

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
#     102.54.94.97    rhino.acme.com         # source server
#      38.25.63.10    x.acme.com             # x client host
127.0.0.1      localhost
::1            localhost
  • 赤字部分、「127.0.0.1 localhost」と「::1 localhost」の、先頭の「#」が外れているのがデフォルトの状態。
  • これ以外にホスト名の指定が入っていないか確認する

書き換え(改ざん)をチェックするポイント

◆: 「127.0.0.1 localhost」と「::1 localhost」以外のIPアドレスとホスト名が記述されていて、そのホストを自分で指定した覚えが無かったら要注意。
◆: セキュリティソフト、オンラインショッピング、オンラインバンキング、FacebookなどSNSサイトのホスト名が書かれていたら、ウイルス感染を疑う。

書き換え(改ざん)を修復する方法

Windows 7/Vista/XPの場合

マイクロソフトが配布している修復ツールを使い直します。
ページ内、中段辺りに「ダウンロード」ボタンがあります。
How can I reset the Hosts file back to the default?

Windows 10/8.1/8の場合

◆ :以下のテキストが「hostsファイルのデフォルト」になりますので、
テキストをコピーし、メモ帳に貼り付けます。

ここから

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

ここまで

◆: コピーしたテキストを「hosts」と言う名前で任意の場所に保存します。
※保存の際は『.txt』などの拡張子を付けないで保存します。

◆: システムフォルダを開きます。
『C:\Windows\System32\drivers\etc』

◆: 現在ある、hostsファイルをリネームします『hots.old』に

◆: 先ほど任意の場所に保存したデフォルトのhostsファイルのそのまま、ドラッグ&ドロップで上書きします。
この際に管理者権限が求められます。

以上でhostsファイルの確認方法と修復(デフォルトに戻す)方法でした。

コメント

タイトルとURLをコピーしました