Werkzeug / Flask Debug
Last updated
Last updated
AWSćććć³ć°ćå¦ć³ćå®č·µććļ¼HackTricks Training AWS Red Team Expert (ARTE) GCPćććć³ć°ćå¦ć³ćå®č·µććļ¼HackTricks Training GCP Red Team Expert (GRTE)
ććŖćć®ć¦ć§ćć¢ććŖćććććÆć¼ćÆććÆć©ć¦ćć«åƾććććć«ć¼ć®č¦ē¹ćå¾ć
å®éć®ććøćć¹ć«å½±éæćäøććé大ć§ęŖēØåÆč½ćŖčå¼±ę§ćč¦ć¤ćć¦å ±åćć¾ćć 20仄äøć®ć«ć¹ćæć ćć¼ć«ćä½æēØćć¦ę»ęé¢ććććć³ć°ććē¹ęØ©ćęę ¼ćććć»ćć„ćŖćć£åé”ćč¦ć¤ććčŖååććććØćÆć¹ććć¤ććä½æēØćć¦éč¦ćŖčؼę ćåéććććŖćć®åŖåćčŖ¬å¾åć®ććå ±åęøć«å¤ćć¾ćć
ćććć°ćć¢ćÆćć£ććŖå “åć/console
ć«ć¢ćÆć»ć¹ćć¦RCEćåå¾ććććØć試ćæćććØćć§ćć¾ćć
ć¤ć³ćæć¼ćććäøć«ćÆććććmetasploitć®ćć®ćŖć©ćććć¤ćć®ćØćÆć¹ććć¤ććććć¾ćć
å “åć«ćć£ć¦ćÆć/console
ćØć³ććć¤ć³ćććć³ć§äæč·ćććććØćććć¾ćććć”ć¤ć«ćć©ćć¼ćµć«ć®čå¼±ę§ćććå “åććć®ćć³ćēęććććć«åæ
č¦ćŖćć¹ć¦ć®ę
å ±ćę¼ę“©ćććććØćć§ćć¾ćć
ć¢ććŖć§ćććć°ćØć©ć¼ćć¼ćøćå¼·å¶ēć«č”Øē¤ŗććć¦ććććē¢ŗčŖćć¾ćļ¼
A message regarding the "console locked" scenario is encountered when attempting to access Werkzeug's debug interface, indicating a requirement for a PIN to unlock the console. The suggestion is made to exploit the console PIN by analyzing the PIN generation algorithm in Werkzeugās debug initialization file (__init__.py
). The PIN generation mechanism can be studied from the Werkzeug source code repository, though it is advised to procure the actual server code via a file traversal vulnerability due to potential version discrepancies.
ć³ć³ć½ć¼ć«PINćęŖēØććć«ćÆć2ć¤ć®å¤ę°ć»ćććprobably_public_bits
ćØ private_bits
ćåæ
č¦ć§ćļ¼
probably_public_bits
username
: Flaskć»ćć·ć§ć³ćéå§ććć¦ć¼ć¶ć¼ćęćć¾ćć
modname
: éåøøćÆ flask.app
ćØęå®ććć¾ćć
getattr(app, '__name__', getattr(app.__class__, '__name__'))
: äøč¬ēć« Flask ć«č§£ę±ŗććć¾ćć
getattr(mod, '__file__', None)
: Flaskćć£ć¬ćÆććŖå
ć® app.py
ćøć®ćć«ćć¹ćč”Øćć¾ćļ¼ä¾ļ¼ /usr/local/lib/python3.5/dist-packages/flask/app.py
ļ¼ćapp.py
ćé©ēØć§ććŖćå “åćÆćapp.pyc
ć試ćć¦ćć ććć
private_bits
uuid.getnode()
: ē¾åØć®ćć·ć³ć®MACć¢ćć¬ć¹ćåå¾ććstr(uuid.getnode())
ć§10é²ę°å½¢å¼ć«å¤ęćć¾ćć
ćµć¼ćć¼ć®MACć¢ćć¬ć¹ćē¹å®ććć«ćÆćć¢ććŖć§ä½æēØććć¦ććć¢ćÆćć£ććŖććććÆć¼ćÆć¤ć³ćæć¼ćć§ć¼ć¹ļ¼ä¾ļ¼ ens3
ļ¼ćē¹å®ććåæ
č¦ćććć¾ććäøęćŖå “åćÆć**/proc/net/arp
ćę¼ę“©ććć¦ććć¤ć¹IDćč¦ć¤ććę¬”ć« /sys/class/net/<device id>/address
ććMACć¢ćć¬ć¹ćę½åŗćć¾ćć
16é²ę°ć®MACć¢ćć¬ć¹ć10é²ę°ć«å¤ęććę¹ę³ćÆ仄äøć®éćć§ćļ¼
get_machine_id()
: /etc/machine-id
ć¾ććÆ /proc/sys/kernel/random/boot_id
ććć®ćć¼ćæććęå¾ć®ć¹ć©ćć·ć„ļ¼/
ļ¼ć®å¾ć® /proc/self/cgroup
ć®ęåć®č”ćØé£ēµćć¾ćć
AWSćććć³ć°ćå¦ć³ćå®č·µććļ¼HackTricks Training AWS Red Team Expert (ARTE) GCPćććć³ć°ćå¦ć³ćå®č·µććļ¼HackTricks Training GCP Red Team Expert (GRTE)