NSPA3 — 網路安全封包分析筆記

Sheng-Shan Chen
2 min readOct 25, 2021

--

花了一萬五上課做的筆記

建議直接到 sectools.tw 觀看比較整齊

https://sectools.tw/nspa3/

Note

小於1024的port

流量太大 wireshark 會當掉
可以用 tcpdump 代替之

Wireshark color

  • 淺藍 UDP
  • 灰色 連線(SYN)或斷線(FIN)
  • 紅色 緊急斷線
  • 藍紫色 加密封包
  • 綠色 明碼傳送
  • 黑色
  • 黑底紅字 不要理他 封包掉了或出錯或要求重送 fault control
  • 黑底綠字 網路目標無法連線 ip位置不對 、 對方 port number 沒開(可能是防火牆會回這個)

開啟封包的Country , City , As Number, As Organization

Locate: statistics -> End Points -> Ipv4

  1. Edit -> Preference -> Name Resolution -> maxmind database
  2. Google -> GEOIP free download -> maxmind database
  3. 3個壓縮檔 -> C:\目錄\ (要放大家都能存取的目錄)

GEOLite 是下載灰色的位置

以AS Number 來忽略

  • Google : 15169
  • 中華電信數位分公司 : 3462
  • Microsoft : 8068, 8070, 8075

認as number 會比擋ip好

Display Filter

not ip.geoip.asnum==15169

or

not ip.geoip.asnum in {15169 3462 8068 8070 8075}

Capture Filter

No broadcast

可以 save this filter 命名 忽略正常封包

過濾內網 — 忽略內網封包

((not ip.geoip.asnum in {15169 3462 8068 8070 8075}) and (not (ip.src == 10.0.0.0/8 and ip.dst==10.0.0.0/8))) and (not arp)

快速加國家別的欄位

移到欄位 -> Colum Preferences -> Appearance -> Columns

國家 Custom ip.geoip.country 0

快速加公司別的欄位

移到欄位 -> Colum Preferences -> Appearance -> Columns

國家 Custom ip.geoip.org 0

key Points of HTTP Communication

  • HTTP uses TCP-80 for default communication
  • HTTP/HTTPS 預設通訊埠
  • 使用80/443,但可更改為其他port
  • TCP/80 其內容與行為,則必須為HTTP協定,若不符合HTTP行為,則為異常通訊,TCP/443 也是

HTTP與HTTPS用戶端原則

  • HTTP或HTTPs服務,在執行之前,通常會產生DNS詢答封包,
  • 下列情況可能沒有DNS封包
  • DNS Cache 3~5 sec
  • 直接使用IP位址
  • etc 目錄 hosts 檔案異動
  • 惡意行為 -> Worm 感染、弱掃
  • chrome , quic UDP 443

DNS 詢答

  • 一問一答 Query Reply
  • 1Q2R, 1QnR(DNS Spoofing)
  • 1Q 沒有 R
  • 無Q 有R (DNS Spoofing)

tcp.flags.syn == 1 or dns

檢查DNS與網路連線 — 1

((tcp.port == 80 or tcp.port == 443) and tcp.flags.syn ==1) or dns

不要台灣

not ip.geoip.country == “Taiwan”

HTTP Method (query Command)

  • 瀏覽器丟的
  • GET : access the Web resource files
  • POST: send user data back into Web
  • 其他 問你在不在 行不行 能不能
  • HEAD: ask for accessing Web resource files
  • OPTIONS: ask for checking parameters of applications
  • TRACE: ask for checking loops of applications
  • 具備攻擊性
  • CONNECT: dynamically switch to a tunnel by proxy
  • PUT: upload file to store into server (WebDAV)
  • DELETE: erase file from server (WebDAV)

HTTP Response Status Code

  • 1xx: General Host Information
  • 2xx: Execute Command Successfully
  • 200 OK
  • 206 Partial Content
  • 3xx: Resource Redirection
  • 301 Moved Permanently
  • 302 Relocate URL
  • 304 Not Modified (Local Cache)
  • 4xx: Client Error
  • 400 Bad Request
  • 401 Unauthorized (Access Denied)
  • 403 Forbidden
  • 404 File not found
  • 5xx: Server Error

netstat

windows: netstat -anop tcp
Linux: sudo netstat -tupan

病毒練習網站

dump md5 file

CertUtil -hashfile aaa.exe MD5

Source and Targe (不考)

  • Referer: 大部分都有參考來源
  • Host 應該要等於網站名稱
  • User-Agent

32 不考 34 不考

SMTP Commands

  • HELO
  • EHLO

狀態通訊

  • 有態(有前後文)
  • SMTP
  • POP3
  • Telnet
  • FTP
  • IMAP

--

--