rosieblue
article thumbnail
[๊ฟ€ํŒ] ์œˆ๋„์šฐ ํŒŒ์ผ ํŒŒ์ผ์‹œ์Šคํ…œ์„ ์œˆ๋„์šฐ ํ„ฐ๋ฏธ๋„์ด ์•„๋‹Œ ๋ฆฌ๋ˆ…์Šค ํ„ฐ๋ฏธ๋„๋กœ ์‹คํ–‰ํ•˜๊ธฐ

wsl ๋‹น์—ฐํžˆ ์•Œ๊ฒ ์ง€๋งŒ, wsl์„ ์ด๋ ‡๊ฒŒ ์“ธ ์ˆ˜ ์žˆ๋Š”์ง€๋Š” ๋‚˜๋„ ๋ฐฉ๊ธˆ ์ฒ˜์Œ ์•Œ์•˜๋‹ค.์ง€๊ธˆ๊นŒ์ง€ wsl๋ฅผ ์“ฐ๋ฉด ๊ทธ๋ƒฅ ์šฐ๋ฆฌ์˜ ํ˜ธ์ŠคํŠธ ์ปดํ“จํ„ฐ๋ž‘ ์™€์•ˆ์ „ํžˆ ๋ถ„๋ฆฌ๋œ ๊ฐ€์ƒ์˜ ํ™˜๊ฒฝ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ๋Š”๋ฐ ๊ทธ๊ฒŒ ์•„๋‹ˆ์—ˆ๋‹ค..  ์ฐธ๊ณ ๋กœ ์œ„๋Š” /dev/sdc๊ฐ€ /์™€ /mnt/wslg/distro์— ๋งˆ์šดํŠธ๋˜์–ด์žˆ๋‹ค๋Š” ์ด์•ผ๊ธฐ์ž„ใ…‡ใ…‡ ํŒŒ์ผ์‹œ์Šคํ…œ ๊ณต๋ถ€ํ•˜๋‹ค๊ฐ€ ๋‚ด ํŒŒ์ผ์‹œ์Šคํ…œ์ด ๋ญ”์ง€ ๊ถ๊ธˆํ•ด์„œ mount | grep ^/dev ๋ฅผ ์จ์„œ ๋งˆ์šดํŠธ๋œ fs๋“ค์„ ๋‹ค ์ฐ์–ด๋ณด์•˜๋‹ค๊ทผ๋ฐ ์ €๋Ÿฌ๋ฉด ์œ„์ฒ˜๋Ÿผ /dev๋กœ ์‹œ์ž‘ํ•˜๋Š” ์• ๋“ค๋งŒ ๋‚˜์™€์„œ ๊ทธ๋ƒฅ grep ์ฃผ์ง€๋ง๊ณ  ๊ทธ๋ƒฅ mount๋งŒ ์ง„ํ–‰ํ–ˆ๋Š”๋ฐ ์—„์ฒญ ๊ธธ๊ฒŒ ๋ง‰ ๋‚˜์˜ค๊ณ  ๋งจ ์•„๋ž˜์— ๋ฐ‘ ํ™”๋ฉด์ด ์ฐํ˜”๋‹ค... ๊ทธ๋Ÿฐ๋ฐ ๋ณด๋‹ˆ๊นŒ ์œˆ๋„์šฐ์—์„œ ์šฐ๋ฆฌ๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” C,D drive์˜€์Œใ…‡ใ…‡..   ๊ทธ๋ž˜์„œ ๊ถ๊ธˆํ•ด์„œ /mnt/c๋กœ ๊ฐ€๋ดค๋‹ค... ๊ทผ๋ฐ ใ„นใ…‡ ์ด ๋””..

๋ฆฌ๋ˆ…์Šค์—์„œ ํ•˜๋“œ์›จ์–ด ์ •๋ณด ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•

cat /proc/cpuinfo odroid@odroid:~$ cat /proc/cpuinfo processor : 0 BogoMIPS : 48.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x1 CPU part : 0xd05 CPU revision : 0 lscpu haeun@DESKTOP-8NK4D08:~$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physic..

article thumbnail
[OS/System Programming] pthread (1)

๋…ธ์…˜์— ์ •๋ฆฌํ•˜๋ ค๋‹ค๊ฐ€ ๊ทธ๋ƒฅ ๋ธ”๋กœ๊ทธ์— ์ •๋ฆฌํ•œ๋‹ค.. ๊ฐ‘์ž๊ธฐ ์ด๊ฑธ ํ•˜๋Š” ์ด์œ ๋Š” ๋žฉ์—์„œ ๋‚˜ํ•œํ…Œ ํ•˜๋ผ๊ณ  ํ•˜์‹  ์ผ์ด ์Šค๋ ˆ๋“œ ๊ด€๋ จ์ด์–ด์„œ ๋จผ์ € ํ”„๋กœ๊ทธ๋ž˜๋ฐํ•˜๋Š” ๊ฒƒ์ข€ ์ œ๋Œ€๋กœ ์•Œ์•„๋ณด๊ณ  ์ผ์„ ํ•˜๋ ค๊ณ  ํ•œ๋‹ค.. ์ฐธ๊ณ ๋กœ pthread๊ด€๋ จ ์ฒ˜๋ฆฌ๋ฅผ ํ•  ๋•Œ, 'undefined reference to `pthread_create' ์ด๋Ÿฐ ์˜ค๋ฅ˜๊ฐ€ ๋‚  ์ˆ˜๋„ ์žˆ๋Š”๋ฐ, ์ด๊ฑธ ํ•ด๊ฒฐํ•˜๋ ค๋ฉด ์ปดํŒŒ์ผ ํ•  ๋•Œ ์•„๋ž˜์ฒ˜๋Ÿผ -lpthread ์˜ต์…˜์„ ์ถ”๊ฐ€ํ•ด์ฃผ์–ด์•ผํ•œ๋‹ค! gcc -o pthread pthread.c -lpthread pthread_create ํ•จ์ˆ˜ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); /* ์ฒซ๋ฒˆ..

article thumbnail
[Linux] /proc ๋””๋ ‰ํ† ๋ฆฌ

/proc ๋ฆฌ๋ˆ…์Šค์—๋Š” ์ปค๋„๊ณผ ์ปค๋„ ๋ชจ๋“ˆ๋กœ๋ถ€ํ„ฐ ํ”„๋กœ์„ธ์Šค์—๊ฒŒ ์ •๋ณด๋ฅผ ์ „์†กํ•ด์ฃผ๊ธฐ ์œ„ํ•œ ์ถ”๊ฐ€์ ์ธ ๋ฉ”์นด๋‹ˆ์ฆ˜์ธ /proc ํŒŒ์ผ์‹œ์Šคํ…œ์ด ์žˆ๋‹ค. ์›๋ž˜๋Š” ํ”„๋กœ์„ธ์Šค ์ •๋ณด์— ์‰ฝ๊ฒŒ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๊ธฐ ์œ„ํ•ด ๋งŒ๋“ค์–ด์กŒ๊ธฐ ๋•Œ๋ฌธ์— proc(process)๋ผ๋Š” ์ด๋ฆ„์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค๊ณ  ํ•œ๋‹ค ํ”„๋กœ์„ธ์Šค ์ •๋ณด ๋Œ€์ถฉ ์•„๋ฌด ํ”„๋กœ์„ธ์Šค๋‚˜ ์‹คํ–‰ํ•˜๊ณ  ์ด ์นœ๊ตฌ์˜ proc ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ฐ€๋ณด๊ฒ ๋‹ค ์ด๋ ‡๊ฒŒ ์—ฌ๋Ÿฌ ์ •๋ณด๋“ค์„ ๋‹ด์€ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์ƒ์„ฑ์ด ๋๋‹ค /proc/[pid]/maps ์•„๋ž˜์ฒ˜๋Ÿผ ๋ฉ”๋ชจ๋ฆฌ ๋งคํ•‘์ด ์–ด๋–ป๊ฒŒ ๋˜์–ด์žˆ๋Š”์ง€ ๋ณด์—ฌ์ค€๋‹ค /proc/[pid]/cmdline ํ”„๋กœ์„ธ์Šค ์ธ์ˆ˜๋ฅผ ๋‹ด๋Š” ์• ๋‹ค! ์šฐ๋ฆฌ๋Š” ๋”ฑํžˆ ์˜ต์…˜์„ ์ฃผ์ง€์•Š์•˜๊ธฐ ๋•Œ๋ฌธ์— ์•„๋ž˜์ฒ˜๋Ÿผ ์ถœ๋ ฅ๋๋‹ค /proc/[pid]/cwd ํ•ด๋‹น ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹คํ–‰๋˜๊ณ  ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๋งํฌ๋กœ ๊ฑธ์–ด๋‘” ๊ฑฐ๋‹ค ์•„๋ž˜์ฒ˜๋Ÿผ ๋˜‘๊ฐ™์ด ์ƒ๊ฒผ๋‹ค /proc/..

article thumbnail
[๋“œ๋ฆผํ•ต(Dreamhack)] pathtraversal

#!/usr/bin/python3 from flask import Flask, request, render_template, abort from functools import wraps import requests import os, json users = { '0': { 'userid': 'guest', 'level': 1, 'password': 'guest' }, '1': { 'userid': 'admin', 'level': 9999, 'password': 'admin' } } def internal_api(func): @wraps(func) def decorated_view(*args, **kwargs): if request.remote_addr == '127.0.0.1': return func(*..

article thumbnail
[OS/Linux] ํ”„๋กœ์„ธ์Šค ๊ถŒํ•œ, ID, ํ”„๋กœ์„ธ์Šค ๊ด€๋ฆฌ ์ •๋ณด ๊ด€๋ จ ํ•จ์ˆ˜

ํ”„๋กœ์„ธ์Šค์—์„œ์˜ UID User ID(UID)๋Š” 32bit์˜ ์ •์ˆ˜๊ฐ’! ์ด๊ฑธ๋กœ user๋ฅผ ์‹๋ณ„! ruid : Real User ID!! ์ฆ‰ ์ด ํ”„๋กœ์„ธ์Šค๋ฅผ '์‹œ์ž‘'ํ•œ ์œ ์ €์˜ ์•„์ด๋”” euid : '๊ถŒํ•œ ๊ฒ€์‚ฌ'ํ•  ๋•Œ ์‚ฌ์šฉ๋˜๋Š” id. ๋ณดํ†ต์€ ruid์™€ ๊ฐ™๊ฒ ์ง€๋งŒ SetUID๋น„ํŠธ ๋“ฑ์ด ์„ค์ •๋œ ๊ฒฝ์šฐ, ํŒŒ์ผ ์†Œ์œ ์ž์˜ ์•„์ด๋””๋กœ ๋ฐ”๋€œ. ๋”ฐ๋ผ์„œ ์–˜๋ฅผ root๋กœ ๋ฐ”๊พผ๋‹ค๋ฉด root๊ถŒํ•œ์œผ๋กœ ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒ ์ง€ suid : Saved User ID!! Privileged Process(๋ณดํ†ต root๊ฐ€ ์‹คํ–‰ํ•œ ํ”„๋กœ์„ธ์Šค)๊ฐ€ ๋ชจ์ข…์˜ ์ด์œ ๋กœ ๊ถŒํ•œ์„ ๋‚ฎ์ถฐ์•ผํ•˜์ง€๋งŒ ๋‹ค์‹œ ๋Œ์•„์˜ฌ๋•Œ ํ•„์š”ํ•œ ์•„์ด๋”” Non-root process๊ฐ€ ์ž์‹ ์˜ euid๋ฅผ ๋ฐ”๊พธ๋ ค๊ณ  ํ•  ๋•Œ, euid๋Š” ํ˜„์žฌ์˜ ruid, euid, suid๋กœ ๋ฐ–์— ์„ค์ •ํ•  ์ˆ˜ ์—†์Œ eui..