mount

package
v0.786.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mount decodes the ONC RPC NFS MOUNT protocol v3 (RFC 1813, program 100005) — the service that hands a client the root file handle for an NFS export. It is the NFS-reconnaissance companion to internal/portmap (rpcbind): after rpcinfo locates mountd, a captured MOUNT exchange exposes the NFS attack surface — the exact **export path** a client mounts, the **result** (a successful mount vs an MNT3ERR_ACCES denial — the export's access control in action), the **file handle** the server returns (the capability to read the export; a captured / guessable NFS file handle is the classic NFS file-handle-reuse attack), and the **auth flavors** the server accepts (AUTH_NULL / AUTH_SYS are trivially spoofable, the root of most NFS compromises).

Wrap-vs-native judgement

Native. A MOUNT message is an ONC RPC header (xid, type, call/reply
fields) plus a short procedure body — an XDR path string (call) or a
status + file handle + auth-flavor list (reply). A byte-field read +
bounded XDR walks; stdlib only, no new go.mod dep. The RPC framing is
parsed by the shared internal/oncrpc package (used by portmap, mount
and nfs); this package implements only the MOUNT procedure bodies.

Verifiable / no confidently-wrong output

The RPC header, the MOUNT / UNMOUNT call path and the MOUNT reply
(status / file handle / auth flavors) were verified field-for-field
against scapy's NFS-MOUNT layer (scapy.contrib.mount). Because an RPC
reply does not carry the procedure it answers, a reply body is typed
as a MOUNT reply only when its first word is a defined mountstat3 code
and the file-handle + flavor structure parses within the body — else
it is surfaced raw. The EXPORT / DUMP procedures (showmount) are
deliberately not decoded: scapy does not model them, so they cannot be
differentially verified here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	XID         string `json:"xid"`
	MessageType int    `json:"message_type"`
	MessageName string `json:"message_name"`

	// Call.
	Program     *uint32 `json:"program,omitempty"`
	ProgVersion *uint32 `json:"program_version,omitempty"`
	Procedure   *uint32 `json:"procedure,omitempty"`
	ProcName    string  `json:"procedure_name,omitempty"`
	Path        string  `json:"mount_path,omitempty"`

	// Reply.
	AcceptStat  *uint32  `json:"accept_stat,omitempty"`
	AcceptName  string   `json:"accept_stat_name,omitempty"`
	Status      *int     `json:"mount_status,omitempty"`
	StatusName  string   `json:"mount_status_name,omitempty"`
	FileHandle  string   `json:"file_handle,omitempty"`
	AuthFlavors []string `json:"auth_flavors,omitempty"`

	BodyHex string   `json:"body_hex,omitempty"`
	Notes   []string `json:"notes,omitempty"`
}

Result is the decoded view of an NFS MOUNT-protocol RPC message.

func Decode

func Decode(input string) (*Result, error)

Decode parses an NFS MOUNT-protocol ONC RPC message (the mountd payload, without any TCP record marker) from hex (whitespace / ':' / '-' / '_' separators and a '0x' prefix tolerated).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL