The attacker starts with a bug, not a login: a memory-corruption or logic flaw in a client application that turns attacker-controlled input into code execution. The best-documented example is CVE-2017-11882 in Microsoft Equation Editor (EQNEDT32.EXE), where crafted equation data in an embedded OLE object overflows a fixed buffer and overwrites a return address, handing control to the attacker inside a 32-bit process that has been unchanged since Office 2000. A single opened document is enough; there is no macro prompt to click through, because the exploit runs before any macro-security dialog would appear.
From that first-stage code execution, the payload typically calls WinExec() or CreateProcess() to launch a living-off-the-land binary, most often rundll32.exe pointed at a file it just wrote to a temp or AppData path, using a non-.dll extension like .pdf or .png to slip past extension-based filters. That LOLBin then decodes and loads the real payload, frequently reflectively injecting it into a second, dormant system process such as ImagingDevices.exe or RegSvcs.exe via process hollowing, so nothing malicious ever touches disk as an unpacked executable.
Delivery does not require the exploit to sit in the visible attachment. Word's altChunk feature lets a .docx silently load a second file, typically an RTF, from within the archive, so a scanner that only inspects the outer document misses the payload entirely. Persistence usually lands as a Run key or a copy of the loader dropped into %AppData%, so the exploit chain hands off to ordinary commodity malware behavior within seconds of the document opening.