侯智晟
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ###### `tryhackeme` `Passive Recon` `Active Recon` Owner: 侯智晟 Email: meowheckerouo@gamil.com [TOC] # Passive Reconnaissance Passive Reconnaissance allows us to collect information without directly connecting to the target. Command line Tools - whois---query whois server - nslookup---Query DNS server - dig---Query DNS server Whois and DNS server data are public. Online Server - DNSDumpster - Shodan.io Common Passive Recon Activities Lookup target DNS record from public DNS servers. Check job ads related to the target website. Read employees' social media profiles. .... ## Whois (Protocol) Retrieve target information from the domain registrar (public). Whois is a request/response protocol following RFC 3912 specifications. listen on 43 port ![圖片](https://hackmd.io/_uploads/ryWIY0NnT.png) Whois record contains domain information: - Domain Registrar - Contact info of registrant - Creation, update, and expiration date - Name Server (DNS server) -> Domain ### Find Extra Attack surfaces If the owner didn't subscribe to privacy service: - Register Email - DNS Server - Other User Information Note Many whois servers have protection mechanisms against the abuse of whois info queries. Nowadays, many registrants provide privacy services to avoid email harvesting and keep information private. ### LAB - whois Client (cmd tools) ``` whois "Domain Name" ``` ![圖片](https://hackmd.io/_uploads/rJSf6RV36.png) ![圖片](https://hackmd.io/_uploads/SJ1nTCNna.png) ![圖片](https://hackmd.io/_uploads/B1V30A42a.png) Solved !! ## nslookup (cmd tools) nslookup query the DNS server(Public/Internal) and retrieve the IP or external information. Syntax ``` nslookup TYPES DOMAIN_NAME TARGET_DNS_SERVER ``` ### Commands Args - TYPES A - IPv4 AAAA - IPv6 CNAME -> Pointer to NAME e.g query: meow.com -> Return: meowhecker.com MX -> Mail Server SOA -> Start of Authority TXT -> Text Records (Comment) - DOMAIN_NAME The Target domain we want to query - TARGET_DNS_SERVER This optional Google -> 8.8.8.8/8.8.4.4 Cloudflare -> 1.1.1.1 / 1.0.0.1 More Public Server https://duckduckgo.com/?q=public+dns&ia=answer For instance -> `nslookup -type=A tryhackme.com 1.1.1.1` ![圖片](https://hackmd.io/_uploads/By6RVOrnT.png) We can more deeply check or recon those IP address, if these are in the scope of testing. ### Analysis Target Mali Server ``` nslookup -type=MX tryhackme.com 1.1.1.1 ``` ![圖片](https://hackmd.io/_uploads/S1eYwuHnp.png) ### TXT record Query ``` nslookup -type=txt tryhackme.com 1.1.1.1 ``` ![圖片](https://hackmd.io/_uploads/S16tuOH2T.png) ## Dig (Domain Information Groper) More Advance DNS record query tools Syntax: ``` Dig DOMAIN_NAME TYPE @NAMER_SERVER ``` ![圖片](https://hackmd.io/_uploads/Bk_4pdrhp.png) ### LAB - TXT Record Target Domain -> thmlabs.com ![圖片](https://hackmd.io/_uploads/ryzh6dBna.png) Solved !! ## DNSDumpster (Online) DNSDumpster can enumerate domains and subdomains, allowing attackers to find external attack faces by enumerating subdomains. ![圖片](https://hackmd.io/_uploads/SJyE09Shp.png) Sub-domain enumerate technique is depend Brute-force DNS query website:https://dnsdumpster.com/ Target: tryhackme.com ### DNS Server Info ![圖片](https://hackmd.io/_uploads/Hkpw1iB3p.png) ### MX record ![圖片](https://hackmd.io/_uploads/HkPsJjH2p.png) ### TxT Record ![圖片](https://hackmd.io/_uploads/BkxCkiB3p.png) ### Host Record (Sub domain) ![圖片](https://hackmd.io/_uploads/BksxxsHnp.png) ### Mapping the domain ![圖片](https://hackmd.io/_uploads/HkAwgiHh6.png) ### LAB-DNSDumspter ![圖片](https://hackmd.io/_uploads/ByjCxoBhT.png) Solved ! ## Shodan.io Shodan attempts to connect to every online device, building a search engine of devices. ![圖片](https://hackmd.io/_uploads/S12EPjHn6.png) ![圖片](https://hackmd.io/_uploads/ryMBYiBh6.png) - Ip - Host Company - Geographic Location - Server type and version ### Search Fundamentals #### Banner Shodan stores received information in the object called a banner, which is the fundamental unit of data. Case-1 Device banner ``` { "data": "Moxa Nport Device Status: Authentication disabled Name: NP5232I_4728 MAC: 00:90:e8:47:10:2d", "ip_str": "46.252.132.235", "port": 4800, "org": "SingTel Mobile", "location": { "country_code": "SG" } } ``` Data -> device response Case-2 HTTP banner ``` HTTP/1.1 200 OK Server: nginx/1.1.19 Date: Sat, 03 Oct 2015 06:09:24 GMT Content-Type: text/html; charset=utf-8 Content-Length: 6466 Connection: keep-alive ``` Web software -> nginx #### Search Banner Shodan only searches the data property! if we want to search more Moxa Nport device ![圖片](https://hackmd.io/_uploads/Sypc2iHhp.png) ![圖片](https://hackmd.io/_uploads/Bksh3iS3T.png) Search Filter (Login Require) Syntax ``` filterName:value ``` For instant ``` country:TW ``` ### LAB- Shodan.io ![圖片](https://hackmd.io/_uploads/B1khpsHhT.png) ![圖片](https://hackmd.io/_uploads/HyxyRsB2a.png) ![圖片](https://hackmd.io/_uploads/Sk9b0jr2T.png) ![圖片](https://hackmd.io/_uploads/BJbz0jH2p.png) Solved ! # Active Reconnaissance Using ping, telnet, web browser tools to gather information Active Recon have invasive, Before we do that we need to obtain proper legal authentication We directly connect to target machine such action typically might leave information in logs (IP info, Connection Time) Engagement , we have to pretend normal user such connect via HTTP Common Active Recon Activities Connect to target via HTTP, FTP, SMTP, Ping pretending employees Calling the company ## TraceRoute TraceRoute tool allow us to discover the router across the path form our machine to target machine ### TTL (Time to Live ) ![圖片](https://hackmd.io/_uploads/H1SYFnH26.png) ### TimeOUT Packet Drop ![圖片](https://hackmd.io/_uploads/r1qmq2rnT.png) So we can abuse the mechanism to router information. `*` indicate that our system didn’t receive two expected ICMP time exceeded in-transit messages. ![圖片](https://hackmd.io/_uploads/HkSPshSha.png) ### LAB-Trace Route ![圖片](https://hackmd.io/_uploads/rJvQh2rhT.png) ![圖片](https://hackmd.io/_uploads/ByrHh3r2a.png) ![圖片](https://hackmd.io/_uploads/SJ-t3nHhp.png) Solved !! ## Telnet Cline/Server Model Telnet protocol allow us communication with remote server via command line interface. Telnet Default server (22) ### Connect to remote server and retrieve banner Connect to Port 80 Server Send: `GET / HTTP/1.1` host:"target DOmain" We will receive server's banner after we send the request. ![圖片](https://hackmd.io/_uploads/H1Ry3TU2a.png) We have to press double enter after end of message We obtain the web software version -> To find Public vulnerability. ### LAB - Telnet-Web Server ![圖片](https://hackmd.io/_uploads/BygyBJw2p.png) Solved !! ## NetCat NetCat support TCP/UDP protocol, it can be used to be client or server Flags: - l Listen mode - p Specify the port - n Number Only (IP Address) not use DNS to resolute the Domain - v / vv verbos Information - k Keep listens after the client disconnection Sever ``` nc -lvnpk 443 ``` Client ``` nc MACHINE_IP PORT ``` Once client connect to server, the server will create the tcp tunnel for message communication ![圖片](https://hackmd.io/_uploads/rkScHVOn6.png) ### LAB NetCat Retrieve the target's banner >A banner is a piece of information displayed by a host that provides details about the service or system ![圖片](https://hackmd.io/_uploads/HJDDOEOn6.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully