LoginSignup
2
6

More than 1 year has passed since last update.

【ファルコンになりたいプロジェクト】素人セキュリティ エンジニアの些細な記録

Last updated at Posted at 2021-05-07

概要

素人がファルコンを目指した些細な記録です.
l_nhfigbm616-1.jpg

ファルコン特製USBを作る

176934043.2.jpg

ファルコンがPCに指して使用していたのはUSBのlive linux osだと思われます.
普通にusbにosをインストールすると使い物にならないくらい遅いのでたぶんliveです.

ちなみに,上記の画像のようなUSBをドラマでは使っていました.かっこいいですね!!

0. 参考サイト

0.1 ライブUSB関係

設定保存可能なライブUSB(Ubuntu)を作る
https://qiita.com/nagayaoh/items/d15b0e5836e23060a976

Install Ubuntu 20.04 On LIVE USB / SSD With Persistent Storage (Plug & Play)
https://www.youtube.com/watch?v=cHF1ByFKtZo

Ubuntu
https://ubuntu.com/​

Rufus
https://rufus.ie/

0.2 beep音無効化関係

kali linux 起動時のブートメニューの修正(beep音がうるさい)
https://www.kume.biz/news_article.storyid_158.htm

Kali Linux の live-build による custom iso
https://qiita.com/shinn1r0/items/9a24888a84c87f693b33

0.3 kali linux docker 関係

Dockerを使ってKali Linuxの環境を構築した時のメモ
https://qiita.com/rocinante-ein/items/680f20d37a7e536d307b

Kali Linux 2020.2 Release (KDE & PowerShell)
https://www.kali.org/blog/kali-linux-2020-2-release/

Kali Linux 2020.2 の変更点まとめ
https://life-hacker.site/2020/06/07/kali-linux-2020-2/

How to solve Kali Linux apt-get install: E: Unable to locate package checkinstall
https://ourcodeworld.com/articles/read/961/how-to-solve-kali-linux-apt-get-install-e-unable-to-locate-package-checkinstall

Docker for Windows で Kali Linuxを起動してみた
https://tech.akat.info/?p=3388

0.4 docker ssh 関係

[Docker入門]コンテナにsshでアクセスするための設定メモ
https://qiita.com/kuboshu83/items/f827ad7068550cded72d

秘密鍵を指定してSSH接続をする
https://qiita.com/uichi/items/ff93de77b86b28efeabd

WindowsでSSHの鍵を作る
https://qiita.com/digdagdag/items/9e5c061e7d86e0af9a57

1. ubuntuでlive usbの作成

最終的にはkali linuxで実装します.
しかし,相当躓きポイントがありそうなので,まずは簡単なubuntuで実装していきたいと思います.
最終的にはこんな感じになります.

1.1 rufusでlive usbの作成

普通にlive usbを使用すると,起動の度にデータがリセットされますので,persistentの機能を使用してデータが保存されるlive usbを作っていきます.

まず,下記設定でlive usbを作ります.
image.png

1.2 cfgファイルの編集

作成したUSBの下記ファイルの設定を変更していきます.

G:\boot\grub\grub.cfg

cfgファイルに下記を追加します.

grub.cfg
...

menuentry "Try Ubuntu without installing" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --- persistent
    initrd  /casper/initrd
}

...

fsck.mode=skipを追加すると毎回ファイルチェックしずに起動します.
ファイルチェックをすると起動毎に5分以上かかるので大変です.
最終的にはこうなります.

grub.cfg

if loadfont /boot/grub/font.pf2 ; then
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

set timeout=5
menuentry "Ubuntu" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  persistent file=/cdrom/preseed/ubuntu.seed  quiet splash ---
    initrd  /casper/initrd
}
menuentry "Ubuntu (safe graphics)" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  persistent file=/cdrom/preseed/ubuntu.seed  quiet splash nomodeset ---
    initrd  /casper/initrd
}

menuentry "Try Ubuntu without installing" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip quiet splash --- persistent
    initrd  /casper/initrd
}

menuentry "OEM install (for manufacturers)" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  persistent file=/cdrom/preseed/ubuntu.seed only-ubiquity quiet splash oem-config/enable=true ---
    initrd  /casper/initrd
}
grub_platform
if [ "$grub_platform" = "efi" ]; then
menuentry 'Boot from next volume' {
    exit 1
}
menuentry 'UEFI Firmware Settings' {
    fwsetup
}
fi

1.3 起動してみる

こんな感じで"Try Ubuntu without installing"がでてきます.

image.png

下記画像は壁紙を変更して再起動した後の画像です.
データが保存されるので壁紙やフォルダを作成してもちゃんと反映されてますね.

image.png

2. kali linuxでlive usbの作成

最終的な動作確認動画

2.0 作り方動画

** 作成中 **

2.1 kali linux

0c4ad61c.png

kali linuxとはセキュリティ用のOSです.
このOSの特徴は下記の通りです.

  • ペネトレーションテストが主な目的
    • 様々な技術を駆使して侵入を試みる
    • システムにセキュリティ上の脆弱性が存在するかどうかのテスト
    • 「侵入実験」や「侵入テスト」とも呼ばれる
  • BackTrackの後継のOS

2.2 rufusでlive usbの作成

色々なサイトでパーミッションを作成したり,ex4を作成したり相当ややこしいことをしてますが,rufusでワンパンです!!!
ここは,ほぼubuntuと同じです.下記の設定で永続的なkali linuxのlive usbが作成できます.

*ファイルシステムをNTFSにするとubuntuでは上手く動作したのですが,kaliではブート画面にすら出てきませんのでご注意を

image.png

2.3 cfgファイルの編集

kaliでは,cfgファイルの編集は必要ありません.
神OSですね!!

grub.cfg

source /boot/grub/config.cfg

# Live boot
menuentry "Live system" --hotkey=l {
    linux   /live/vmlinuz-5.10.0-kali3-amd64 boot=live persistence components quiet splash noeject findiso=${iso_path}
    initrd  /live/initrd.img-5.10.0-kali3-amd64
}
menuentry "Live system (fail-safe mode)" {
    linux   /live/vmlinuz-5.10.0-kali3-amd64 boot=live persistence components noeject memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal
    initrd  /live/initrd.img-5.10.0-kali3-amd64
}

menuentry "Live system (forensic mode)" {
    linux /live/vmlinuz-5.10.0-kali3-amd64 boot=live persistence components quiet splash noeject findiso=${iso_path} noswap noautomount
    initrd /live/initrd.img-5.10.0-kali3-amd64
}
menuentry "Live system (persistence, check kali.org/prst)" {
    linux /live/vmlinuz-5.10.0-kali3-amd64 boot=live persistence components quiet splash noeject findiso=${iso_path} persistence
    initrd /live/initrd.img-5.10.0-kali3-amd64
}
menuentry "Live system (encrypted persistence, check kali.org/prst)" {
    linux /live/vmlinuz-5.10.0-kali3-amd64 boot=live persistence components quiet splash noeject findiso=${iso_path} persistent=cryptsetup persistence-encryption=luks persistence
    initrd /live/initrd.img-5.10.0-kali3-amd64
}

# Installer (if any)
source /boot/grub/install_start.cfg

if [ ! -e /boot/grub/install.cfg ]; then
menuentry "Start installer with speech synthesis" {
    linux /install/gtk/vmlinuz speakup.synth=soft vga=788 net.ifnames=0 --- quiet
    initrd /install/gtk/initrd.gz
}
fi

submenu 'Advanced options...' {

source /boot/grub/theme.cfg

# More installer entries (if any)
source /boot/grub/install.cfg

# Memtest (if any)
source /boot/grub/memtest.cfg

}


2.4 起動してみる

ブート画面からUSBを選択します.
image.png

上から4つ目のpersistenceを選択します.
image.png

無事に起動しました
image.png

2.4 永続性の確認

live modeで起動しているので,通常なら再起動したら作成したフォルダやインストールしたものはすべてリセットされます.
しかし,今回は永続化したlive modeです.
そこで,再起動してもフォルダがリセットされないことを確認していきましょう.

「bbbb」フォルダを作成します.
image.png

再起動します.
image.png

「bbbb」フォルダが残っていますね.
image.png
これで,永続性の確認が完了しました.

3. live usbのカスタマイズ

3.1 beep音の無効化

** 作成中 **

再度osをビルドする必要がありそうです.

4. kali linux docker

docker 版もありそうなので,そっちもやってみました.

** 作成中 **

5. zipファイルをハッキングしてみる

hacking.jpg

昨日(2021/6/23)の記事でzipのパスワードは無意味っていう記事を見てしまいまして,そこでオープンソースのソフトを用いたら秒で解析か可能と記載されておりました.そこで,そのオープンソースってkaliじゃねっと思ったので実際にやってみました.

5.1 必要なもの

  • fcrackzip (kali linuxならデフォルトで入っています.) まじでkali最強!!!

5.2 パスワード付zip作成

ZIP内のファイルを適当に作成します.
ファイルは適当にカレンダーのtxtファイルでも作成しましょう.

┌──(masaki㉿masaki)-[~/ドキュメント/git-repo/ZipCrackDemo]
└─$ calendar 
 6月 24    Senate repeals Gulf of Tonkin resolution, 1970
 6月 24    The capital of Jamaica, Kingston, is founded, 1664
 6月 24    Battle of Carabobob in Venezuela
 6月 24    Fisherman's Day in Madagascar, Mozambique and Somalia
 6月 24    Kings Day in Spain
 6月 24    Peasants Day in Peru
 6月 24    St. Jean-Baptiste Day in Quebec
 6月 24    Jeff Beck is born in Surrey, England, 1944
 6月 24    Muere en un accidente de aviación Carlos Gardel, 1935
 6月 24    Chris Faulhaber <jedgar@FreeBSD.org> born in Springfield, Illinois, United States, 1971
 6月 24    N'oubliez pas les Jean-Baptiste !
 6月 24    S'il pleut à la saint Jean,
    Guère de vin ni de pain.
 6月 24    Ermordung von Reichsaußenminister Rathenau, 1922
 6月 24    Beginn der Berliner Blockade, 1948
 6月 24    Iván
 6月 24    Midsummer (quarter day)
 6月 25    Eric Arthur Blair (a.k.a. George Orwell) born, 1903
 6月 25    Custer's Last Stand at Little Big Horn, 1876
 6月 25    North Korea invades South Korea, 1950
 6月 25    Alberto Ginastera dies in Geneva, Switzerland, 1983
 6月 25    Georg Philipp Telemann dies in Hamburg, Germany, 1767
 6月 25    Michael Joseph Jackson dies in Los Angeles, California, 2009
 6月 25        Dan državnosti
 6月 25    Bonne fête aux Prosper !
 6月 25    Après la saint Jean, si le coucou chante,
    L'année sera rude et méchante.
 6月 25    Begin der Korea-Krieges, 1950
 6月 25    Georg Philipp Telemann in Hamburg gestorben, 1767
 6月 25    Vilmos, Viola
┌──(masaki㉿masaki)-[~/ドキュメント/git-repo/ZipCrackDemo]
└─$ calendar > calender.txt    

次に,これをパスワード付きのZIPにします.とりあえずは数字のみのパスワードにしましょう.

┌──(masaki㉿masaki)-[~/ドキュメント/git-repo/ZipCrackDemo]
└─$ zip -e --password=123456 calender1.zip calender.txt 

5.3 パスワード付zipの解析

5.3.1 パスワードは数字かつ解析の文字指定も数字での解析

条件:パスワードは数字, 解析の文字指定も数字

下記のコマンドでパスワードを解析してみましょう.
コマンドの詳細はこちらを参照

┌──(masaki㉿masaki)-[~/ドキュメント/git-repo/ZipCrackDemo]
└─$ fcrackzip -u calender1.zip -l 2-6 -c 1a                                                                            1 ⚙


PASSWORD FOUND!!!!: pw == 123456

パスワードが数字かつ解析条件に数字のみの指定だと秒で終わる!!!
あながち記事で言ってることも間違いではなさそう.では文字列の可能性も考慮するとどうなるのか検証していきましょう.

5.3.2 パスワードは数字かつ解析の文字指定は文字あるいは数字での解析

解析候補に数字が入ってくるだけで秒では終わらない感じになりました.パスワードは見つけられず.....

┌──(masaki㉿masaki)-[~/ドキュメント/git-repo/ZipCrackDemo]
└─$ fcrackzip -u calender1.zip -l 2-6 -c 1a                                                                            1 ⚙
^Z
zsh: suspended  fcrackzip -u calender1.zip -l 2-6 -c 1a

原因として,数年前のノートPCだからという可能性もあります.GPUとか使えればいけそうな感じがしますね.

5.4 まとめ

数字のみのパスワードは危険ということがわかりました.
気をつけましょう.

使用したファイルと手順を記した文書一式をアップしておきます.

2
6
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
6