문제 정보는 다음과 같다.
기본 설정을 사용한 서비스입니다. 로그인한 후 Organization에 플래그를 설정해 놓았습니다. |
문제를 다운로드 받고,
접속 정보를 요청해서 사이트를 들어가면
다음과 같은 페이지가 나온다!
Grafana가 뭘까..
검색해보니 Grafana는 멀티플랫폼 오픈 소스 애널리틱스
및 인터랙티브 시각화 웹 애플리케이션이라고 나왔다.
(출처: 위키백과)
간단하게, 오픈소스 대시보드 도구라고 할 수 있다.
여기서 주어진 파일은 ini 설정 파일인데 열어보자.
열어보면 709줄되는 내용이 나오는데,
힌트가 될만한 내용을 뽑아보자.
우선, 문제 정보가 Organization에 플래그를 설정했다고 한다.
Organization을 Ctrl+F를 통해 찾아보면 다음과 같은 내용이 나오고,
### Users ### 부터 긁어와서 내용을 보자.
#################################### Users ###############################
[users]
# disable user signup / registration
allow_sign_up = false
# Allow non admin users to create organizations
allow_org_create = false
# Set to true to automatically assign new users to the default organization (id 1)
auto_assign_org = true
# Set this value to automatically add new users to the provided organization (if auto_assign_org above is set to true)
auto_assign_org_id = 1
# Default role new users will be automatically assigned (if auto_assign_org above is set to true)
auto_assign_org_role = Viewer
# Require email validation before sign up completes
verify_email_enabled = false
# Background text for the user field on the login page
login_hint = email or username
password_hint = password
# Default UI theme ("dark" or "light")
default_theme = dark
# External user management
external_manage_link_url =
external_manage_link_name =
external_manage_info =
# Viewers can edit/inspect dashboard settings in the browser. But not save the dashboard.
viewers_can_edit = false
# Editors can administrate dashboard, folders and teams they create
editors_can_admin = false
[auth]
# Login cookie name
login_cookie_name = grafana_session
# The lifetime (days) an authenticated user can be inactive before being required to login at next visit. Default is 7 days.
login_maximum_inactive_lifetime_days = 7
# The maximum lifetime (days) an authenticated user can be logged in since login time before being required to login. Default is 30 days.
login_maximum_lifetime_days = 30
# How often should auth tokens be rotated for authenticated users when being active. The default is each 10 minutes.
token_rotation_interval_minutes = 10
# Set to true to disable (hide) the login form, useful if you use OAuth
disable_login_form = false
# Set to true to disable the signout link in the side menu. useful if you use auth.proxy
disable_signout_menu = false
# URL to redirect the user to after sign out
signout_redirect_url =
# Set to true to attempt login with OAuth automatically, skipping the login screen.
# This setting is ignored if multiple OAuth providers are configured.
oauth_auto_login = false
# limit of api_key seconds to live before expiration
api_key_max_seconds_to_live = -1
#################################### Anonymous Auth ######################
[auth.anonymous]
# enable anonymous access
enabled = false
# specify organization name that should be used for unauthenticated users
org_name = DH{THIS_IS_FAKE_FLAG}
# specify role for unauthenticated users
org_role = Viewer
천천히 따라가면서 알만한 내용의 '영어'를 읽어보자.
1) 일단은.. 추가 회원가입은 불가인것같다.
2) 로그인 폼의 placeholder 설정도 적혀있다.
3) UI 테마는 다크나 라이트인데 다크이다.
4) 로그인 쿠키는 grafana_session 이름이다.
5) 익명 접근은 false이다.
6) 허가되지 않은 유저는 특정 이름을 설정하는데,
org_name이 DH{THIS_IS_FAKE_FLAG} 이다.. ㅋ
해당 내용을 봐도 잘 모르겠어서 위에서부터
괜찮은 내용을 좀 더 찾아봤다.
#################################### Database ############################
[database]
# You can configure the database connection by specifying type, host, name, user and password
# as separate properties or as on string using the url property.
# Either "mysql", "postgres" or "sqlite3", it's your choice
type = sqlite3
host = 127.0.0.1:3306
name = grafana
user = root
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password =
# Use either URL or the previous fields to configure the database
# Example: mysql://user:secret@host:port/database
url =
# Max idle conn setting default is 2
max_idle_conn = 2
# Max conn setting default is 0 (mean not set)
max_open_conn =
# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours)
conn_max_lifetime = 14400
# Set to true to log the sql calls and execution times.
log_queries =
# For "postgres", use either "disable", "require" or "verify-full"
# For "mysql", use either "true", "false", or "skip-verify".
ssl_mode = disable
ca_cert_path =
client_key_path =
client_cert_path =
server_cert_name =
# For "sqlite3" only, path relative to data_path setting
path = grafana.db
# For "sqlite3" only. cache mode setting used for connecting to the database
cache_mode = private
이거는 데이터베이스 내용인데,
1) DB는 sqlite3를 사용하는 것 같다.
2) root 유저가 존재한다.
3) 만약에 패스워드에 # 이나 ; 문자가 들어있으면,
따옴표 3개로 감싸라고 하면서 예시를 알려준다. (음?)
내리다보니, 보안쪽 중요한 내용도 있는 것 같았다.
#################################### Security ############################
[security]
# disable creation of admin user on first start of grafana
disable_initial_admin_creation = false
# default admin user, created on startup
admin_user = admin
# default admin password, can be changed before first start of grafana, or in profile settings
admin_password = admin
# used for signing
secret_key = SW2YcwTIb9zpOOhoPsMm
# disable gravatar profile images
disable_gravatar = false
# data source proxy whitelist (ip_or_domain:port separated by spaces)
data_source_proxy_whitelist =
# disable protection against brute force login attempts
disable_brute_force_login_protection = false
# set to true if you host Grafana behind HTTPS. default is false.
cookie_secure = false
# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled"
cookie_samesite = lax
# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
allow_embedding = false
# Set to true if you want to enable http strict transport security (HSTS) response header.
# This is only sent when HTTPS is enabled in this configuration.
# HSTS tells browsers that the site should only be accessed using HTTPS.
# The default will change to true in the next minor release, 6.3.
strict_transport_security = false
# Sets how long a browser should cache HSTS. Only applied if strict_transport_security is enabled.
strict_transport_security_max_age_seconds = 86400
# Set to true if to enable HSTS preloading option. Only applied if strict_transport_security is enabled.
strict_transport_security_preload = false
# Set to true if to enable the HSTS includeSubDomains option. Only applied if strict_transport_security is enabled.
strict_transport_security_subdomains = false
# Set to true to enable the X-Content-Type-Options response header.
# The X-Content-Type-Options response HTTP header is a marker used by the server to indicate that the MIME types advertised
# in the Content-Type headers should not be changed and be followed. The default will change to true in the next minor release, 6.3.
x_content_type_options = false
# Set to true to enable the X-XSS-Protection header, which tells browsers to stop pages from loading
# when they detect reflected cross-site scripting (XSS) attacks. The default will change to true in the next minor release, 6.3.
x_xss_protection = false
1) 초기 admin 생성 불가능이 false면 가능하다는 듯하다.
2) admin의 user는 admin이고 password도 admin이다.
3) secret_key가 노출되어 있다.
4) 그 외에 브루트포스나 화이트리스트, XSS 보안이 false로 되어있다.
우선, 로그인폼에 admin, admin으로 작성해보자.
Logged in! 이라는 alert와 함께,
비밀번호를 변경하라고 나온다.
Skip 해준뒤 들어오면 다음과 같이 대시보드가 나온다.
문제 정보에서 로그인한 후
Organization을 확인하라 했으니,
왼쪽 메뉴를 살펴보자.
그 중, 맨 아래 방어막 아이콘을 누르면
Server Admin이라고 나오는데,
Orgs를 들어갔더니 별게 없었다.
생각해보니 설정파일인 ini를 줬었는데,
밑에 Settings를 들어가보자.
그리고 스크롤을 내리다보면?
우리가 낚였던 FAKE 자리에
플래그 값이 채워져있다.
'CTF > 웹해킹' 카테고리의 다른 글
[Dreamhack] session (0) | 2022.09.14 |
---|---|
[Dreamhack] simple-ssti (0) | 2022.09.06 |
[Dreamhack] php-1 (0) | 2022.09.01 |
[Dreamhack] proxy-1 (0) | 2022.08.30 |
[Dreamhack] pathtraversal (0) | 2022.08.29 |