HackTheBox Walkthrough - lame

This post is writeup of the HackTheBox machine created by ch4p. Nmap Nmap result Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-27 10:46 EDT Nmap scan report for 10.10.10.3 Host is up (0.29s latency). Not shown: 996 filtered ports PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 2.3.4 |_ftp-anon: Anonymous FTP login allowed (FTP code 230) | ftp-syst: | STAT: | FTP server status: | Connected to 10.10.14.15 | Logged in as ftp | TYPE: ASCII | No session bandwidth limit | Session timeout in seconds is 300 | Control connection is plain text | Data connections will be plain text | vsFTPd 2....

<span title='2019-10-28 00:00:00 +0000 UTC'>October 28, 2019</span>&nbsp;·&nbsp;5 min&nbsp;·&nbsp;999 words&nbsp;·&nbsp;FAMASoon

HackTheBox Walkthrough - Devel

This post is writeup of the HackTheBox machine created by ch4p. Nmap Quick port scan reveals FTP service and web server. # nmap -sC -sV 10.10.10.5 Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-15 21:00 EDT Nmap scan report for 10.10.10.5 Host is up (0.28s latency). Not shown: 998 filtered ports PORT STATE SERVICE VERSION 21/tcp open ftp Microsoft ftpd | ftp-anon: Anonymous FTP login allowed (FTP code 230) | 03-18-17 02:06AM <DIR> aspnet_client | 03-17-17 05:37PM 689 iisstart....

<span title='2019-10-16 00:00:00 +0000 UTC'>October 16, 2019</span>&nbsp;·&nbsp;6 min&nbsp;·&nbsp;1188 words&nbsp;·&nbsp;FAMASoon

10進数表記のIPアドレスでwebサイトにアクセスする

はじめに なんとなくGitHubを漁っていたら面白そうなリポジトリを見つけた。 https://github.com/OsandaMalith/IPObfuscator 内容はIPアドレスを10進数や16進数、8進数に変換してwebサイトにアクセスするというもの。 バラバラの基数でも最終的にIPアドレスっぽくなればアクセスできるみたい。 そういえば10進数のIPアドレス表記を利用する攻撃活動もありましたね。 悪用ダメ絶対。 実装を見てみる https://github.com/OsandaMalith/IPObfuscator/blob/master/ip.c なるほど。 1バイトずつ読んで基数変換しているみたい。 実装してみた なんとなくGo言語で実装してみた https://github.com/famasoon/go-IPObfuscator すごく可読性の低いコードになってしまったので後々、修正する。 正直あまり実用性はない。 出力方法も書いておく。 $ git clone https://github.com/famasoon/go-IPObfuscator $ cd go-IPObfuscator $ go run main.go Enter IP Address: 222.165.163.91 http://3735397211 http://0xde.0xa5.0xa3.0x5b http://0336.0245.0243.0133 http://0x00000000de.0x00000000a5.0x00000000a3.0x000000005b http://00000000336.00000000245.00000000243.00000000133 http://0xde.0xa5.0xa3.91 http://0xde.0xa5.163.91 http://0xde.165.163.91 http://0336.0245.0243.91 http://0336.0245.163.91 http://0336.165.163.91 http://0xde.0xa5.41819 http://0336.0245.41819 http://0xde.0245.41819 http://0xde.10855259 http://0336.10855259 http://0xde.0xa5.0243.0133 http://0xde.0245.0243.0133 出力されたリンクを踏むとGoogle に飛ぶ。 結構、見た目を変えてもアクセスできるので奥が深い。 おわり

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;1 min&nbsp;·&nbsp;54 words&nbsp;·&nbsp;FAMASoon

Container Registry に自分の作ったDockerイメージをpushする

https://cloud.google.com/container-registry/docs/pushing-and-pulling?hl=ja プライベートなDockerコンテナレジストリが欲しかったので使ってみた。 gcloudコマンドのセットアップを終える gcloud auth configure-dockerでDocker Registryの認証をする 下記コマンドでビルド済みのイメージ名にタグ付けをする $ docker tag [任意のイメージ名] gcr.io/[プロジェクトID]/[イメージ名]:[バージョン] 下記コマンドでContainer RegistryにDocker イメージを push $ docker push gcr.io/[プロジェクト名]/[イメージ名]:[バージョン] これで作ったDockerイメージのContainer Registryへpush完了

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;1 min&nbsp;·&nbsp;23 words&nbsp;·&nbsp;FAMASoon

Create Binary Analysis VM

Create Binary Analysis VM I created VM for reverse engineering. This is the note at that time. Install Virtual Box To run VMs needs hypervisor. I choose the Virtual Box. Because, Virtual Box is easy to use and free. To install Virtual Box navigate to the this page. https://www.virtualbox.org/wiki/Downloads You choose the package for your system, and download it. Run the installer. If you are using the mac OS, you can install with this command too....

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;244 words&nbsp;·&nbsp;FAMASoon

Create Binary Analysis VM

Create Binary Analysis VM I created VM for reverse engineering. This is the note at that time. Install Virtual Box To run VMs needs hypervisor. I choose the Virtual Box. Because, Virtual Box is easy to use and free. To install Virtual Box navigate to the this page. https://www.virtualbox.org/wiki/Downloads You choose the package for your system, and download it. Run the installer. If you are using the mac OS, you can install with this command too....

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;244 words&nbsp;·&nbsp;FAMASoon

Create Binary Analysis VM

Create Binary Analysis VM I created VM for reverse engineering. This is the note at that time. Install Virtual Box To run VMs needs hypervisor. I choose the Virtual Box. Because, Virtual Box is easy to use and free. To install Virtual Box navigate to the this page. https://www.virtualbox.org/wiki/Downloads You choose the package for your system, and download it. Run the installer. If you are using the mac OS, you can install with this command too....

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;244 words&nbsp;·&nbsp;FAMASoon

Finding IRP dispatch routine

Environment Windows 10 In VM Attached Windbg How to finding First, show deviceobject structures kd> !drvobj DeviceObj 7 Driver object (ffffa3828a49b060) is for: \Driver\DeviceObj Driver Extension List: (id , addr) Device Object list: ffffa3828c2869f0 DriverEntry: fffff80043a55064 DeviceObj DriverStartIo: 00000000 DriverUnload: fffff800439d1950 DeviceObj AddDevice: 00000000 Dispatch routines: [00] IRP_MJ_CREATE fffff800439d4ff0 DeviceObj+0x4ff0 [01] IRP_MJ_CREATE_NAMED_PIPE fffff800439d4ff0 DeviceObj+0x4ff0 [02] IRP_MJ_CLOSE fffff800439d4ff0 DeviceObj+0x4ff0 [03] IRP_MJ_READ fffff800439d4ff0 DeviceObj+0x4ff0 [04] IRP_MJ_WRITE fffff800439d4ff0 DeviceObj+0x4ff0 [05] IRP_MJ_QUERY_INFORMATION fffff800439d4ff0 DeviceObj+0x4ff0 [06] IRP_MJ_SET_INFORMATION fffff800439d4ff0 DeviceObj+0x4ff0 [07] IRP_MJ_QUERY_EA fffff800439d4ff0 DeviceObj+0x4ff0 [08] IRP_MJ_SET_EA fffff800439d4ff0 DeviceObj+0x4ff0 [09] IRP_MJ_FLUSH_BUFFERS fffff800439d4ff0 DeviceObj+0x4ff0 [0a] IRP_MJ_QUERY_VOLUME_INFORMATION fffff800439d4ff0 DeviceObj+0x4ff0 [0b] IRP_MJ_SET_VOLUME_INFORMATION fffff800439d4ff0 DeviceObj+0x4ff0 [0c] IRP_MJ_DIRECTORY_CONTROL fffff800439d4ff0 DeviceObj+0x4ff0 [0d] IRP_MJ_FILE_SYSTEM_CONTROL fffff800439d4ff0 DeviceObj+0x4ff0 [0e] IRP_MJ_DEVICE_CONTROL fffff800439d5020 DeviceObj+0x5020 [0f] IRP_MJ_INTERNAL_DEVICE_CONTROL fffff800439d4ff0 DeviceObj+0x4ff0 [10] IRP_MJ_SHUTDOWN fffff800439d4ff0 DeviceObj+0x4ff0 [11] IRP_MJ_LOCK_CONTROL fffff800439d4ff0 DeviceObj+0x4ff0 [12] IRP_MJ_CLEANUP fffff800439d4ff0 DeviceObj+0x4ff0 [13] IRP_MJ_CREATE_MAILSLOT fffff800439d4ff0 DeviceObj+0x4ff0 [14] IRP_MJ_QUERY_SECURITY fffff800439d4ff0 DeviceObj+0x4ff0 [15] IRP_MJ_SET_SECURITY fffff800439d4ff0 DeviceObj+0x4ff0 [16] IRP_MJ_POWER fffff800439d4ff0 DeviceObj+0x4ff0 [17] IRP_MJ_SYSTEM_CONTROL fffff800439d4ff0 DeviceObj+0x4ff0 [18] IRP_MJ_DEVICE_CHANGE fffff800439d4ff0 DeviceObj+0x4ff0 [19] IRP_MJ_QUERY_QUOTA fffff800439d4ff0 DeviceObj+0x4ff0 [1a] IRP_MJ_SET_QUOTA fffff800439d4ff0 DeviceObj+0x4ff0 [1b] IRP_MJ_PNP fffff800463238f0 nt!...

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;8 min&nbsp;·&nbsp;1553 words&nbsp;·&nbsp;FAMASoon

Golang + Nuxt.js + Kubernetes でWebサービスを作る

Golang でAPIサーバを作る Golang + Nuxt.js + Kubernetes でWebサービスを作るシリーズ第一弾。 まずはGolangでシンプルなAPIサーバを作成してみる。 今回はGETリクエストで渡されたドメインのwhois情報を取得するAPIサーバを書く。 APIサーバのソースコードはGitHubにアップロード済み https://github.com/famasoon/webapp-api まずは適当なディレクトリを作る。 mkdir webapp-api cd webapp-api 次にGoの依存関係を初期化。 GO111MODULE=on go mod init 今回はGo言語のEchoというモジュールでHTTPリクエストを、gowhoisでwhois関連の処理を行う。 必要なモジュールをgo getで取得。 go get github.com/labstack/echo/... go get -u github.com/famasoon/gowhois 下記のmain.goでAPIサーバを書く。 package main import ( "net/http" "github.com/famasoon/gowhois/whois" "github.com/labstack/echo" ) type whoisInfo struct { Domain string `json:"domain"` WhoisResult string `json:"result"` } func main() { e := echo.New() e.GET("/", func(c echo.Context) error { return c.String(http.StatusOK, "OK") }) e.GET("/api/v1/whois/:domain", getWhoisResult) e.Logger.Fatal(e.Start(":8080")) } func getWhoisResult(c echo....

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;6 min&nbsp;·&nbsp;1250 words&nbsp;·&nbsp;FAMASoon

Ingressのヘルスチェックに対応する

tl;dr “/“パスへのHTTPリクエストに対し200ステータスを返すように実装すればよい Ingress のヘルスチェック GKEでIngressを使っていた所ヘルスチェックをうまく通過しない。 色々と調べたところIngressのヘルスチェックはreadinessProbe.httpGetを指定しないと、デフォルトでは”/“パスにHTTP GETリクエストを送信し200ステータスが帰ってこない場合は対象ポッドが動作していないとみなすみたい。 https://github.com/kubernetes/ingress-gce/issues/42 readinessProbe.httpGetを指定しても別に良かったが、”/“パスは使っていないし、どうせヘルスチェック用にyamlを書き足しAPIのエンドポイントを作るのだったら、”/“へのリクエストに200返すようなコードを書いておけばいいだろうと思い、下記のGolangコードをエンドポイントに追加して対応した。 package main import ( "net/http" "github.com/labstack/echo" "github.com/labstack/echo/middleware" ) func main() { e := echo.New() e.Use(middleware.Logger()) e.Use(middleware.Recover()) e.GET("/", func(c echo.Context) error { return c.String(http.StatusOK, "OK") }) e.Logger.Fatal(e.Start(":8080")) } 参考 Ingressというよりk8sの話だが、ヘルスチェックについては下記ドキュメントが参考になった https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/ https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/

<span title='2019-10-12 00:00:00 +0000 UTC'>October 12, 2019</span>&nbsp;·&nbsp;1 min&nbsp;·&nbsp;40 words&nbsp;·&nbsp;FAMASoon