You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/network-services-pentesting/pentesting-web/nextjs.md
+69-2Lines changed: 69 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ my-nextjs-app/
49
49
-**app/:** Central directory for your application’s pages, layouts, components, and API routes. Embraces the **App Router** paradigm, enabling advanced routing features and server-client component segregation.
50
50
-**app/layout.tsx:** Defines the root layout for your application, wrapping around all pages and providing consistent UI elements like headers, footers, and navigation bars.
51
51
-**app/page.tsx:** Serves as the entry point for the root route `/`, rendering the home page.
52
-
-**app/\[route]/page.tsx:** Handles static and dynamic routes. Each folder within `app/` represents a route segment, and `page.tsx` within those folders corresponds to the route's component.
52
+
-**app/[route]/page.tsx:** Handles static and dynamic routes. Each folder within `app/` represents a route segment, and `page.tsx` within those folders corresponds to the route's component.
53
53
-**app/api/:** Contains API routes, allowing you to create serverless functions that handle HTTP requests. These routes replace the traditional `pages/api` directory.
54
54
-**app/components/:** Houses reusable React components that can be utilized across different pages and layouts.
55
55
-**app/styles/:** Contains global CSS files and CSS Modules for component-scoped styling.
## Next.js Server Actions Enumeration (hash to function name via source maps)
1272
+
1273
+
Modern Next.js uses “Server Actions” that execute on the server but are invoked from the client. In production these invocations are opaque: all POSTs land on a common endpoint and are distinguished by a build-specific hash sent in the `Next-Action` header. Example:
1274
+
1275
+
```http
1276
+
POST /
1277
+
Next-Action: a9f8e2b4c7d1...
1278
+
```
1279
+
1280
+
When `productionBrowserSourceMaps` is enabled, minified JS chunks contain calls to `createServerReference(...)` that leak enough structure (plus associated source maps) to recover a mapping between the action hash and the original function name. This lets you translate hashes observed in `Next-Action` into concrete targets like `deleteUserAccount()` or `exportFinancialData()`.
- Group 2: symbol or path that can be resolved to the original function via the source map when present
1296
+
1297
+
If the script advertises a source map (trailer comment `//# sourceMappingURL=<...>.map`), fetch it and resolve the symbol/path to the original function name.
1298
+
1299
+
### Practical workflow
1300
+
1301
+
- Passive discovery while browsing: capture requests with `Next-Action` headers and JS chunk URLs.
1302
+
- Fetch the referenced JS bundles and accompanying `*.map` files (when present).
1303
+
- Run the regex above to build a hash↔name dictionary.
0 commit comments